Sign in to follow this  
MTclip

rotating 1 point about another

Recommended Posts

okay.. I have 2 points A and B I know A's coords and length from A to B is constant I also know the angle that B will be from A so how do i find out B's coords at that angle.. edit:: I should say that the angle is in radians thanks..

Share this post


Link to post
Share on other sites
Assuming 2D...

B.x = A.x + length * cos( angle );
B.y = A.y + length * sin( angle );

This assumes that if angle == 0, the the line AB is parallel to the X axis.

Share this post


Link to post
Share on other sites
Quote:
Original post by JohnBolton
Assuming 2D...

B.x = A.x + length * cos( angle );
B.y = A.y + length * sin( angle );

This assumes that if angle == 0, the the line AB is parallel to the X axis.


Or, if you prefer,

B.x = A.x + length * cos( angle + theta );
B.y = A.y + length * sin( angle + theta );

Where you adjust theta so that when angle == 0 the following is true:

cos( theta ) = (B.x - A.x)/length
sin( theta ) = (B.y - A.y)/length

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