PDA

View Full Version : modify Polygon tool


yamoussoukro
11-25-2010, 03:33 PM
how i make my own tool. i make copy PolyStar.jsfl and PolyStar.xml files and name it "Kolmio.jsfl" and "Kolmio.xml". i have modify Kolmio.jsfl code but what do I need if i want example triangle.any help are welcome. triangle = kolmio in finnish :)
function buildPolygonObj( pt1, pt2, thePolygon )
{
// calculate the center point
var ctr = new Object;
ctr.x = pt1.x;
ctr.y = pt1.y;

// calculate the radius
var rad = fl.Math.pointDistance(pt1, pt2);

// find the angle between points
var doStar = (style == STAR);
var dTheta = 2.0*Math.PI/nSides;

var param = pointParam;
if (param < 0.1) param = 0.1;
if (param > 0.9) param = 0.9;

// make a copy of the unit curve
var x = pt2.x - pt1.x;
var y = pt2.y - pt1.y;
var cs = Math.cos(dTheta);
var sn = Math.sin(dTheta);
thePolygon[0] = x;
thePolygon[1] = y;
var index = 2;
for (var i=0; i<nSides; i++)
{