Imagine a 4 sided polygon $ABCD$ with all sides of the same length and the point $C$ at $(0,0)$. Given the location of point $A$ (which is the top point of a rhombus-like shape), I need to find the angle of the line $BC$ relative to the x-axis (let's call it $\Theta_1$), and the angle of the line $CD$ relative to the x-axis (let's this one $\Theta_2$)
Some constraints:
- $C$ (the bottom point) will always be located at $(0,0)$
- We will always know the location of $A$
- $BC$ will never cross $CD$
- All sides will always be the exact same length
- $\Theta_1$ and $\Theta_2$ will always be positive or 0.
My only thinking is that we can always treat the shape as a symmetrical rhombus with some additional rotation applied, so if we can calculate the inner angle of $C$, we can subtract that from 180 to get $\Theta_1$+$\Theta_2$
If we can also calculate the rotation of the rhombus, we can then figure out what $\Theta_1$ and $\Theta_2$ are.
This math is probably relatively simple to all you geniuses out there, but I haven't learned trigonometry yet (I'm going into HS this year) so I can't really wrap my head around it. Also sorry if I'm not denoting variables and things correctly, I've never used mathjax before.
I've searched the web and have found nothing about this. Perhaps I'm using the wrong search terms? Pointing me towards a useful resource would be sufficient, as well.
Since the sides are equal, you have a rhombus. You know that $C$ is at the origin, and point $A$ is at some (known) $(x_A,y_A)$ position. Draw the perpendicular from $A$ to the $x$ axis. Let's call the intersection point $P$. Then $\triangle APC$ is a right angle triangle, with the right angle at $P$. The tangent function relates the angle between $AC$ and $PC$ to the coordinates of $A$.$$\tan \Theta_0=\frac{AP}{PC}=\frac{x_A}{y_A}$$ The inverse of $\tan$ function would give you the angle. Note that points in opposite quadrants have the same tangent. So if you write some computer code, use the $\operatorname{atan2}$ function to get the angle.
Now we should look at the angle between the side of the rhombus and the diagonal. In $\triangle ABC$ you know the length of two sides (say $L$), and the length $AC$ from Pythagora's theorem: $$AC=\sqrt{x_A^2+y_A^2}$$ Draw a perpendicular from $B$ to $AC$. The intersection is $M$, the middle of $AC$. Then $\triangle CMB$ is a right angle triangle. Since you know one of the sides and the hypotenuse, we will use the cosine function to relate them. $$\angle BCM=\Delta\Theta\\\cos\Delta\Theta=\frac{CM}{BC}=\frac{\frac12\sqrt{x_A^2+y_A^2}}{L}$$ And $\Delta\Theta$ is given by the inverse function: $$\Delta\Theta=\arccos\frac{\sqrt{x_A^2+y_A^2}}{2L}$$ Then $$\Theta_{1,2}=\Theta_0\pm\Delta\Theta$$