2
$\begingroup$

I have computer program I am writing where I need to calculate the position of a point(called P) when rotated around another point.

I am attempting to come up with a general function/formula I can use to calculate this point P but my Maths is a little weak & I cannot identify what arc/tangent formula I am meant to use.

Can you assist me to come up with a formula I can use to calculate point P for rotations that can be both positive & negative?

enter image description here

I know how to calulate the length of the line between points (14,446) & (226,496) but not how to calculate the blue point x,y position - BTW: the length of this line is the same as the line between the blue point & (14,446)

len = sqrt( (496-446)^2 + (226-14)^2 );     = 227.56; 

1 Answers 1

5

Let's say that the point you're rotating is $(p_x,p_y)$ (your lower-right red point), that the center of rotation is $(c_x,c_y)$ (your middle red point), and that the rotation has magnitude $\theta$ (positive being counterclockwise, your angle being $165°$). Then the resulting point (your blue point) is at $(c_x+(p_x-c_x)\cos\theta+(c_y-p_y)\sin\theta,\;\;c_y+(p_y-c_y)\cos\theta+(p_x-c_x)\sin\theta).$

  • 0
    I could kiss you! :D lol I've been struggling with this for ages. Thank you math genius2012-01-28