More scripts: Vector
Syntax Highlighing:
comments, key words, predefined symbols, class members & methods, functions & classes
# vsetflag.sml
clear();
vector V;
array numeric xPoints[10], yPoints[10];
numeric numPolys, numPoints;
GetOutputVector(V, "VectorToolkit");
# not going to use labels so tell it not to create qtree
VectorSetFlags(V, "NoLabelQTree");
# draw some boxes - this will create polygons
# all closed lines are converted to polygons
xPoints[1] = 0;
yPoints[1] = 0;
xPoints[2] = 100;
yPoints[2] = 0;
xPoints[3] = 100;
yPoints[3] = 100;
xPoints[4] = 0;
yPoints[4] = 100;
xPoints[5] = 0;
yPoints[5] = 0;
VectorAddLine(V, 5, xPoints, yPoints);
# now add some points
numeric i;
for i = 1 to 4 {
VectorAddPoint(V, xPoints[i] + 150, yPoints[i] + 150);
}
numPolys = NumVectorPolys(V);
numPoints = NumVectorPoints(V);
print("number of polygons, points: ", numPolys, numPoints);