Pie Chart Algorithms?

Sivakatirswami katir at hindu.org
Thu Mar 2 03:58:54 CST 2006

```Alex, you are a gem! Thanks:

Interesting to note that "round" produced smoother motion than
"statRound"

The following will works for any circle name "baseCircle" at any
location on the card... Watch the little red ball move run around the
circle (smile) I renamed your vars to something meaningful -- yes,
it's verbose, but as i get older, my short term memory may fail
between reading line 1 and line 10 (grin), one advantage of xTalk.
(see my thoughts on this on the dot notation thread)

and (obviously) setting a single value to "i" in this

on mouseUp
put the loc  of  grc "baseCircle" into tCenter
put getPoints(item 1 of tCenter,item 2 of tCenter,the width of grc
"baseCircle"/2) into tCirclePoints
repeat for each line x in tCirclePoints
set the loc of grc  "mars" to x
wait 2 milliseconds
end repeat
end mouseUp
--  returns a list of points on the circumference of a circle
repeat with tCircumPoint= 0 to 360
--put 90 into tCircumPoint
tResult
end repeat
return tResult
end getPoints

function cosInDegrees angleInDegrees
return cos(angleInDegrees * pi / 180)
end cosInDegrees

function sinInDegrees angleInDegrees
return sin(angleInDegrees * pi / 180)
end sinInDegrees

On Mar 01, 2006, at 12:32 PM, Alex Tweedly wrote:

> Not professional, but maybe "interested amateur" :-)
> (this returns floating point numbers - remember to convert to
> integers before using as points of a polygon or similar)

```