Lets say I have a rectangle (height > width). I need to know the bottom middle 
point. That would be point(clipWidth / 2, clipHeight).

So we'll say:
var x = clipWidth / 2;
var y = clipHeight;

Closest I've gotten is using:
x=ClipWidth / 2 + Math.cos(angle)
y=ClipWidth / 2 - Math.sin(angle)

That's pretty close already -- it's what you would use to draw a
circle (by iterating the angle and connecting the resulting dots).

What you need is those two values:
var cos = Math.cos( angle );
var sin = Math.sin( angle );

Then do the following with x and y from above (your "vector" for the
"rotation matrix"):
var rotX = cos * x - sin * y;
var rotY = sin * x + cos * y;

rotX and rotY are your coordinates (relative to the rectangle clip's
position on its parent clip).

One more thing:
_rotation is stored as one byte, so it's rounded to 360 / 255. That's
something you will have to take in account for the angle if you want
to be exact, easiest would be to read the angle from the _rotation
property after you've changed that.

HTH,
Mark




On 10/4/06, Jason C Reynolds <[EMAIL PROTECTED]> wrote:
Hi, having some math problems... hoping someone can help....

Lets say I have a rectangle (height > width). I need to know the bottom middle 
point. That would be point(clipWidth / 2, clipHeight).
But I am having a hard time keeping track of this point after I rotate that 
clip. If I rotate the clip 40 degrees (clip._rotation = -40), where on the 
stage is that bottom middle point now?

I have searched the forums, and came up with alot of finding the angles, but 
all seem to assume I know 2 points.
Closest I've gotten is using:
x=ClipWidth / 2 + Math.cos(angle)
y=ClipWidth / 2 - Math.sin(angle)

Sorry, I'm soooo rusty with math and hoping someone can push me in the right 
direction. Right now I'm trying to figure out the radius of the 'circle' that 
is formed while rotating, but that isn't going anywhere (fast anway).

Thanks for any tips,
Jason
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to