Question : Find the coordinates of point of triangle that has only two known points and angle

the problem could has this shape



p1     p2                                                               p0
                                          or                
     p0                                                          p2               p1

p0(x0,y0) and p1(x1,y1) are known, i want know the coordinates p2, where I have the angle between the line p0p1 and p0p2 is known and those lines are equal too.

Answer : Find the coordinates of point of triangle that has only two known points and angle

> p1 (r,theta) polar = (sqrt(x1^2+y1^2) , y1/x1)

This is wrong.  There should be some kind of inverse trig function here instead of y1/x1, and for that matter what happens when x1 is zero?

We just need to rotate p1 around p0 by an angle of theta to find p2.

let r1 = (p1.x - p0.x, p1.y - p0.y).  This is the location of p1 relative to p0.

r2 will be the location of p2 relative to p0.

let r2 be r1 rotated clockwise by theta:
r2.x = cos(theta)*r1.x + sin(theta)*r1.y
r2.y = -sin(theta)*r1.x + cos(theta)*r1.y

Then get p2's absolute location:
p2.x = r2.x + p0.x
p2.y = r2.y + p0.y


Random Solutions  
 
programming4us programming4us