Rotating Graphics

Springer, Paul paul.springer at sensis.com
Fri Mar 5 12:10:03 EST 2004


Thanks again Dar, I am beginning to see the light. So it looks like the
hardest thing I have to do is figure out the trigonometry for the custom
rotation function. I don't suppose someone might have such a function for an
isosceles triangle?

-Paul

-----Original Message-----
From: Dar Scott [mailto:dsc at swcp.com] 
Sent: Friday, March 05, 2004 12:03 PM
To: How to use Revolution
Subject: Re: Rotating Graphics


On Friday, March 5, 2004, at 09:28 AM, Springer, Paul wrote:

> Thanks for the help. As a beginner with RR, I need a little 
> clarification.

It is I who needs to be clear.

> 1. When you say "Rotate that." Do you mean with a built in command or 
> with a
> custom command that is re-calculating where the points should be?

Custom command or function.  Like this:

function rotateAboutPoint  centerPoint, pointList  -- returns point list
   set the numberFormat to "0.###########"
   ...
end rotateAboutPoint

...
put the exactPoints of graphic "Space Hog 1" into hPoints
put rotateAboutPoint( spaceStationLoc, hPoints ) into hPoints
set the exactPoints of graphic "Space Hog 1" to hPoints
...

> 2. Aren't there points already defined for the polygons vertices?

Yes.

> Do I need
> to somehow use my custom properties instead of those?

Yes and maybe no.

My guess is that you are seeing a drift and shrink because of 
truncation.  Since the points for a polygon must be whole numbers the 
accumulated errors show quickly.  The use of a custom property to hold 
points allows greater precision and much, much less drift.

You don't have to hold them in a custom property.  You can keep them in 
a global array with one set of points for each polygon.  You don't have 
to use a setProp, you can explicitly create the (rounded) points from 
the exactPoints each time you change the points.

If you rotate images or groups, too, you might want to set things up so 
that you send a command of yours to the control and the control knows 
how to rotate itself.

Another benefit of this method is that you can make very small changes 
that do not affect the display, but will add up.

Dar Scott

_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


More information about the use-livecode mailing list