Pie Chart Algorithms?

Sivakatirswami katir at hindu.org
Wed Mar 1 14:47:43 EST 2006


Doing that only increased the size the arc line that was drawn. The  
two radius lines from the center out to the end of the arc, forming  
the pie did not always appear, sometimes yes, sometimes no...  but by  
setting the opaque on create oval to true then the background color  
appears whether or not the radius lines show or not.. so that works.  
I have to test some more. possible the opaque property is turning the  
radius lines off and on as well...

Now my next challenge is to get a list of points on the circumference  
of any circle.  I checked the mailing lists and can't find the  
algorithm or sample script that would do this. If anyone has the  
"professional" algorithm to do this please do post it... /H's chart  
stack is protected...

I'm working with setting a single radius at 3 o'clock and rotating  
this through 90 degrees using "revRotatePoly" and logging the end  
point on 90 iterations of 1 degree. And then I think I can use the  
relative values of this quadrant for the other three quadrants. But,  
I think this must be  horrible hack and that someone has a much  
"cleaner" way to get this list of pioints -- some very "cool" math  
function...

ON mouseUp
     put (the right of grc "BaseCircle" & "," & the height of grc  
"BaseCircle"/2+the top of grc "BaseCircle") into tVariablePosition
    put 1 into tIncrement
   set the points of grc "Line" to (the loc of grc "baseCircle",  
tVariablePosition)
   put line 2 of the points of grc "line" into tLoc
   repeat 90 times
      put tLoc & cr after fld "props" ## log the end point on each  
iteration
   set the points of grc "Line" to (the loc of grc "baseCircle",  
tVariablePosition)
   revRotatePoly the long id  of  grc "line",tIncrement
   put tIncrement +1 into tIncrement
   put line 2 of the points of grc "line" into tLoc
   set the loc of grc "littleBall" to tLoc
   end repeat

   END mouseup

result

628,364 (3 o'clock on this particular circle)
626,368
626,372
626,376
626,380
626,384
626,390
etc (90 lines of such points... from 3 o'clock to 6 o'clock --  
straight down)

OK set this aside for a while... it's something to work on when the  
brain needs a break from "real" work on a rainy day off...

Hopefully someone will come to my rescue by the time I try to carry  
this forward.

And a related issue: move grc "ball" to the points of grc "oval"  
doesn't do anything... oval's don't have any points (?) doesn't make  
sense to me: any line object on a screen is a series of pixels... how  
can it not have points?

Sivakatirswami






On Mar 01, 2006, at 7:33 AM, Devin Asay wrote:

>
> On Feb 28, 2006, at 3:35 PM, Sivakatirswami wrote:
>>
>
>> The only caveat I discovered that there was some unknown  
>> "condition" wherein the arc is drawn sans the radius lines... i.e  
>> you get just a curved line..a simple arc...   but, if I draw an  
>> oval manually and set it's arc angle one gets a complete "pie" cut  
>> polygon shape. And now my script only creates the full pie shape..
>>
>> Can anyone tell us what determines whether full pie piece is drawn  
>> or just the arc without radius lines?
>
> Don't you just need to set the lineSize of the oval graphic to > 0 ?
>
> Devin
>
> Devin Asay
> Humanities Technology and Research Support Center
> Brigham Young University
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the Use-livecode mailing list