Sign in to follow this  
manu1001

rotation about an arbitrary point

Recommended Posts

manu1001    122
if a point rotates through 'theta' about the origin, how do i calculate through how much it has been rotated about an arbitrary point (rx, ry) ?

Share this post


Link to post
Share on other sites
polypterus    100
I'm not sure I understand the question but how about something like:
vOldVec  = Normalize(pOldPosition - pArbitraryPoint)
vNewVec = Normalize(pNewPosition - pArbitraryPoint)

fAngle = acos( DotProduct(vOldVec,vNewVec) )

Of course this doesn't give you a direction of rotation however I'm not even sure that even applies given the problem.

Share this post


Link to post
Share on other sites
quasar3d    814
Quote:
Original post by manu1001
if a point rotates through 'theta' about the origin, how do i calculate through how much it has been rotated about an arbitrary point (rx, ry) ?


It won't really work for an arbitary point. If you are just transforming a single point (which goes from it's original position a, to it's transformed position b), then only the points that lay on the line through the origin, and a point halfway points a and b, might be the center of a rotation that transform that partcular point from a to b, but as soon as you want to rotate multiple points using the same rotation, then it generally won't be possible to express that rotation as a rotation around any other point than the origin.

But I have the idea that you really are trying to do something else though, so maybe you could be a bit more specific on what you're trying to do?

[Edited by - quasar3d on May 2, 2009 7:52:59 PM]

Share this post


Link to post
Share on other sites
trunks14    154
You have to 'bring' the point about which you want the rotation to happen to the origin.
Then Apply the rotation and finally 'undo' your first translation.

In homogenous coordinates we would have:



Where:

(Px, Py) is the point to rotate about
(x, y) is the point you want transformed
theta is the angle of rotation
(Rx, Ry) is the rotated point

If you do the Matrix multiplications you will find a formula for Rx and Ry:




So, if I'm not wrong, the final formula to rotate about a point in 2-space would be:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this