another yucky geometry question

Jim Hurley jhurley at infostations.com
Wed Sep 28 10:29:23 EDT 2005


>
>Message: 7
>Date: Tue, 27 Sep 2005 15:51:40 -0700
>From: TJ Frame <tjframe at gmail.com>
>Subject: Re: another yucky geometry question
>To: How to use Revolution <use-revolution at lists.runrev.com>
>Message-ID: <7348a9e80509271551c98ad31 at mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>Jim.. wow that is one amazingly useful function for my needs.. just played
>around with it by hooking it up to mulitple sliders and its going to be
>super useful for my project!
>  PS: I dont know what type of system you are using, but on my computer the
>function takes less that 1 millisecond even with the step 4 part removed. I
>get nothing but "0" milliseconds when I run the function. I'm running
>a 1.7ghz p4 with 2 1/2 gigs of Ram..
>   - TJ
>


TJ,

Thanks. Glad it was useful. I did a little playing the drawEllipse 
handler myself. Things like the script below. It grows the ellipse as 
it moves it across the screen. One could also rotate the ellipse as 
it moves.

It would be nice if RR would allow one to set the angle of an 
ellipse. My function would then be obsolete. Has anybody requested 
this enhancement?

On the issue  of speed. My  system is not fast, a PowerBook G4, 
running at 1.67 GHz.  Are you sure you are putting the millisec into 
the start and end times? I'm envious.

on mouseUp
   put the millisec into tStartTime
   put 300 into x0
   put 300 into y0
   put 100 into a
   put  30 into b
   repeat with phi = 1 to 360 step 4
     drawEllipse a,b,phi,x0,y0
     wait 0 millisec
     --The above line is ecessary to get a screen refresh in Mac OS X
     --Wish Mark would fix this.
     add 5 to x0
     add 1 to b
   end repeat
   put the millisec - tStartTime
end mouseUp

on drawEllipse a,b,tAng,xLoc,yLoc
   repeat with aa = 1 to 360 step 4
     put r(aa,tAng,a,b,) into r
     put round(xLoc+ r*cos(pi/180*aa)),round(yLoc+r*sin(pi/180*aa)) & 
cr after tPoints
   end repeat
   set the points of grc "ellipse2" to tPoints
end drawEllipse


function r angl,phi,a,b
   put cos(pi/180*(angl+phi)) into c
   put sin(pi/180*(angl+phi)) into s
   return sqrt(1/(c*c/a/a + s*s/b/b))-- Ellipse at angle phi
end r

Jim



More information about the use-livecode mailing list