vline.sml

  Download

More scripts: Vector

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
            
# vline.sml
clear();
vector V;
array numeric xPoints[10], yPoints[10], lineList[10];
numeric numLines;
GetOutputVector(V, "VectorToolkit");
#initialize some points for our line
xPoints[1] = 0;
yPoints[1] = 0;
xPoints[2] = 50;
yPoints[2] = 45;
xPoints[3] = 75;
yPoints[3] = 80;
xPoints[4] = 100;
yPoints[4] = 100;
# add 4 lines - each with four points
numeric i, j;
for i = 1 to 4 {
	VectorAddLine(V, 4, xPoints, yPoints);
	# change the points to make a different line
	for j = 1 to 4 {
		xPoints[j] = xPoints[j] + 200;
		yPoints[j] = yPoints[j] + 20;
		}
	}
numLines = NumVectorLines(V);
print("number of Lines: ", numLines);
VectorDeleteLine(V, 1);
numLines = NumVectorLines(V);
print("number of Lines: ", numLines);
lineList[1] = 1;
lineList[2] = 2;
VectorDeleteLines(V, lineList, 2);
numLines = NumVectorLines(V);
print("number of Lines: ", numLines);