My software is going to control a Laser. I know the Laser's current Position defined as $P_1$ with coordinates $(x,y)$ and the place where it will be after a clockwise rotation around a point $C$, defined as point $P_2$ with coordinates $(x_1,y_1)$.
I have following information:
- $P_1 (x,y)$
- $P_2 (x_1,y_1)$
- Distance $d$ from $P_1$ to $C$ (is the same as distance from $P_2$ to $C$)
- There will be two points as a solution. the one i need is the one that is the center point of a CLOCKWISE rotation going from $P_1$ to $P_2$
What I need is the $(x_C,y_C)$ coordinates of C.
What would be the easiest way to solve this?
The difficulties I have are 2..
First of all how do i find the 2 possible C points?
And second, how do i determine what point is the one i need?
EDIT:
Just to clarify: All i know in the beginning is a string: G2 x15 y30 R20 where G2 indicates a clockwise rotation, from the current location (known) to point x15 y30 with a radius of 20. This is all I have to start with..
This just comes down to computing an isosceles triangle because $$\|\vec{P}_1 - \vec{C}\| = \|\vec{P}_2 - \vec{C}\| = d$$ and the angles at $\vec{P}_1$ and $\vec{P}_2$, let's call them $\beta$, are equal. $\|\vec{P}_1 - \vec{P}_2\| =: a$ is known. Use basic trigonometry and you're done.
From Pythagoras we get the triangle's height from $$h = \sqrt{d^2 - (a/2)^2}$$ and $$\beta = \arcsin \frac{h}{d}.$$
With the angle between $\vec{P}_2 - \vec{P}_1$ and the x-axis $$\phi = \arctan \frac{P_{2,y}-P_{1,y}}{P_{2,x}-P_{1,x}}$$ you get $$\vec{C} = \vec{P}_1 + d \cdot \left(\begin{array}{c} \cos(\phi+\beta) \\ \sin(\phi+\beta) \end{array}\right)$$ or in simpler notation $$C_x = P_{1,x} + d \cdot \cos(\phi+\beta) \\ C_y = P_{1,y} + d \cdot \sin(\phi+\beta) $$
but take care of the sign of $\beta$, which I didn't give much attention.