views:

118

answers:

5

I have the following setting:

alt text

I know P1, P2 and the angle alpha, now how do i calculate the coordinates of P3? (Note: P3 is on the same circle with origin P1 and radius P1P2)

The blue lines indicate the coordinate system

+4  A: 

If you rotate the vector P1->P2 by alpha about P1 you'll get the vector P1->P3. Then knowing P1 you can get P3.

The basic equation for rotation about the origin is:

[ cos(α) -sin(α) ] [x]
[ sin(α)  cos(α) ] [y]

You might have to change the signs with your coordinate system, but I always have to it by trial and error as I can never remember!

Don't forget - as S.C. Madsen says sin and cos expect angles to be in radians not degrees.

Wikipeida's article on rotation has more information.

ChrisF
Thanks. However I cant solve the problem. P1 is (150/210). P2 is (150/110) and alpha is 30. But if i calculated this and draw the point it isn't on the line.
Roflcoptr
My solution for P3 is P3(135/111). Maybe this is wrong :D
Roflcoptr
The problem is that you need to translate P1 to the origin before the rotation and then translate back to its original place.
ysap
+1  A: 

Let r be the distance from P1 to P2. Then P3 lies r*sin(α) in the negative x-direction from P1, and r*cos(α) in the negative y-direction from P1. For more details, see Wikipedia on trigonometry. Hence P3 has coordinates P1 - (r*sin(α), r*cos(α)).

Sidenote: It's a shame SO doesn't have LaTeX support, like MO.

gspr
Thanks. However I cant solve the problem. P1 is (150/210). P2 is (150/110) and alpha is 30. But if i calculated this and draw the point it isn't on the line.
Roflcoptr
My solution for P3 is P3(135/111). Maybe this is wrong :D
Roflcoptr
+1  A: 

The angle has to be in radians when invoking sin and cos, you state the angle alpha is 30, so it seems to be in degrees. Other than that I think 'gspr' and 'ChrisF' have given excellent advice on how to solve this.

S.C. Madsen
Thanks! this solved the problem! Now i have to find out which answer to accept :D all helped!
Roflcoptr
I'm glad you solved your problem. May I suggest you select Fischer's answer as the solution, since he has the lowest reputation of all the people who helped out.
S.C. Madsen
+7  A: 

The formula stated above from Wikipedia is usable here to rotate the vector P1->P2 (V12).

V12 = [0, -100]

When rotated (beware of α is -30 degrees in your drawing) the vector P1->P3 becomes

x' = V12(x)*cos(α) - V12(y)*sin(α) = 0*cos(-30) - (-100)*sin(-30) = -50
y' = V12(x)*sin(α) + V12(y)*cos(α) = 0*sin(-30) + (-100)*cos(-30) = -86.6

When translated with the point P1 the coordinates for P3 becomes

[x, y] = [-50+150, -86.6+210] = [100, 123.4]
Fischer
This is also the correct solution! thanks!
Roflcoptr
+2  A: 

Complex_To_Vector(Vector_To_Complex(P_2 - P_1) * ei*alpha) + P_1.

(Just for fun -- not a serious suggestion)

Josephine
Why not serious? It is a good and simple solution, if you ask me.
ysap
Well, thank you, but I'm just worried the level of the answer compared to the level of the question is too high -- I'm concerned it may be more mystifying than helpful/educational to the original author. But don't let me stop you from upvoting! :)
Josephine
I'm just not sure which solution is faster
Roflcoptr