I want to construct Pythagoras trees but my math is rusty so that I need to simplify the calculations. The tree is constructed counter-clockwise.
My approach:
Let A, B be $(x_0, y_0)$, $(x_1, y_1)$.
Hypotenuse $\lambda = \sqrt{(x_1 - x_0)^2 + (y_1 - y_0)^2}$
Let the desired acute angle be $\alpha$.
If AB is parallel to x-axis, the other vertex $P$:
$(x_2, y_2) = (x_0 + \lambda \cdot cos(a) \cdot cos(a), y_0 + \lambda \cdot cos(a) \cdot sin(a))$
Rotate $P$ around $A$.
Equation of rotation:
$\begin{align} x_r = cos(\beta) \cdot (x_p - x_c) - sin(\beta) \cdot (y_p - y_c) + x_c \\ y_r = sin(\beta) \cdot (x_p - x_c) + cos(\beta) \cdot (y_p - y_c) + y_c \end{align}$
Where $(x_c, y_c)$ is center of rotation, $(x_p, y_p)$ is point being rotated, and $\beta$ is rotation angle.
Substitute trigonometric functions and insert values:
$\begin{align} x_3 = \frac{x_1 - x_0} {\lambda} \cdot (x_2 - x_0) - \frac{y_1 - y_0} {\lambda} \cdot (y_2 - y_0) + x_0 \\ y_3 = \frac{y_1 - y_0} {\lambda} \cdot (x_2 - x_0) + \frac{x_1 - x_0} {\lambda} \cdot (y_2 - y_0) + y_0 \end{align}$
How to simplify the calculations, so that given the angle $\alpha$ and points A, B the other vertex can be directly calculated?
Update
Upon closer inspection of the equations, I found that $x_0$, $y_0$ and $\lambda$ terms can be eliminated:
$\begin{align} x_2 = (x_1 - x_0) \cdot cos(\alpha)^2 - (y_1 - y_0) \cdot cos(\alpha) \cdot sin(\alpha) + x_0 \\ y_2 = (y_1 - y_0) \cdot cos(\alpha)^2 + (x_1 - x_0) \cdot cos(\alpha) \cdot sin(\alpha) + y_0 \end{align}$
Can they be simplified further?