Calculating points of a mega circle..
Gordon Tillman
got at mindspring.com
Tue Sep 13 13:42:54 EDT 2005
Hi TJ,
> Hi folks
> Anyone know how I would calculate the points of a circle given a
> specific
> number of required points and a massive radius. For example I'm
> looking to
> generate a list of 7200 points that describe a circle with a radius of
> 999999
> Any ideas how to go about this?
> Thanks,
> - TJ
Something like this would do it...
--gordy
function getCirclePoints pXOrigin, pYOrigin, pNumPoints, pRadius
local tIncr, tTheta, tTwoPi, tX, tY, tPoints
put pi * 2 into tTwoPi
put tTwoPi / pNumPoints into tIncr
put 0 into tTheta
repeat pNumPoints times
put pRadius * cos(tTheta) + pXOrigin into tX
put pRadius * sin(tTheta) + pYOrigin into tY
put tX & "," & tY & return after tPoints
add tIncr to tTheta
end repeat
return tPoints
end getCirclePoints
More information about the use-livecode
mailing list