Function, GetLineLength()
Posted: Wed Sep 03, 2014 11:34 am
Didn't see any functions for getting the length of line graphic with multiple points so figured I'd post mine here in case someone in the future world will need it.
Example,
Function,
Not exactly the prettiest nor the fastest, but should be of some help.
Example,
Code: Select all
answer GetLineLength("Line")
Code: Select all
function GetLineLength obj
put the points of grc obj into tempPoints
put empty into prevPoint
put 0 into totalDistance
repeat for each line l in tempPoints
if (prevPoint is not empty) then
add sqrt(((item 1 of l-item 1 of prevPoint)^2) + ((item 2 of l-item 2 of prevPoint)^2)) to totalDistance
end if
put l into prevPoint
end repeat
return totalDistance
end GetLineLength