# Getting an angle

I have a unit circle, and two angles: $\alpha=\angle{JON}\in[0,\pi]$ and $\beta=\angle{IOM}\in[0,\frac{\pi}{2}]$. Using angles, we can get points $N$, $M$ as on the image. Then, dropping a perpendicular from point $N$ to line $OM$ we can get point $A$.

Now, let us have another angle $\gamma=\angle{IOB}$.

The problem is how to calculate an angle $x=\angle{MAB}$ as a function of $\gamma$.

EDIT:

The original problem is mapping real rime cycle to astronomic time. Let the circle around $IOJ$ be the system of time representation. Time goes anticlockwise. Point $I=0$ (right) is 06:00, $J=0.5\cdot\pi$ (top) is 12:00, $-0.5\cdot\pi$ (bottom) is 00:00, $\pi$ is 18:00.

The sunrise equation gives us a sun noon, sunrise and sunset time for a current location. Let $M$ point be the noon time. We can set also $N$ point as sunrise time. Now, we can build a coordinate system in which $0$ will be real sunrise, $0.5\cdot\pi$ - real astronomic noon, etc.

Values $\in [0,\pi]$ will be the daytime, $[-\pi,0]$, resp. the nighttime.

I like MvG's idea of solution, but it seems to be unrealistic on the graphic: cardinality of the set of positive and negative values are the same, but should be different for chosen parameters $\alpha, \beta$.

As an illustration, cycle obtained using formula $\tan x = \frac{\sin(\gamma-\beta)}{\cos(\gamma-\beta)-\sin(\alpha+\beta)}$. Red line is original time cycle, cyan one is transformed cycle:

EDIT2:

After a little playing with coeffitients I have got such graphic:

The top picture represents a long day (summer), the bottom is a winter. I think, this solution looks adequately. Thanks @MvG.

• Do you know how to compute coordinates for points, $A$ in particular? Do you know how to use trigonometric functions to compute angles from coordinates? Have you tried considering the simpler case where $A$ is an arbitrary point on the segment $OI$? – MvG Oct 4 '13 at 15:10

You can define coordinates as follows:

\begin{align*} O &= \begin{pmatrix}0\\0\end{pmatrix} & N &= \begin{pmatrix}\sin\alpha\\\cos\alpha\end{pmatrix} & M &= \begin{pmatrix}\cos\beta\\\sin\beta\end{pmatrix} & B &= \begin{pmatrix}\cos\gamma\\\sin\gamma\end{pmatrix} \end{align*}

With a bit of computation (I did this using projective geometry, i.e. using homgenous coordinates and cross products), you can from this determine

$$A = \sin(\alpha+\beta)\cdot M = \begin{pmatrix} \sin(\alpha + \beta)\,\cos(\beta) \\ \sin(\alpha + \beta)\,\sin(\beta) \end{pmatrix}$$

Then you can compute the direction vector of the line $AB$:

$$B-A=\begin{pmatrix} \cos\gamma - \sin(\alpha+\beta)\,\cos\beta \\ \sin\gamma - \sin(\alpha+\beta)\,\sin\beta \end{pmatrix}$$

One could turn that direction vector into a slope, but you don't want the angle with the horizontal axis, but instead the angle with the line $OM$. Therefore you rotate the vector above by an angle of $\beta$ clockwise. This will take the line $OM$ to the horizontal axis.

$$\begin{pmatrix} \cos\beta & \sin\beta \\ -\sin\beta & \cos\beta \end{pmatrix}\cdot(B-A) = \begin{pmatrix} \cos(\gamma-\beta)-\sin(\alpha+\beta) \\ \sin(\gamma-\beta) \end{pmatrix}$$

From this you can conclude

$$\tan x = \frac{\sin(\gamma-\beta)}{\cos(\gamma-\beta)-\sin(\alpha+\beta)}$$

To solve this for $x$ you'd best use a function like atan2 which can keep track of the appropriate quadrant. If you don't agree with the sign of this solution, feel free to flip it.

As an illustration, here is $x(\gamma)$ for $\alpha=60°,\beta=40°$:

• Thanks @MvG. Good solution, but seems a bit inaccurate yet. See my question fix please. – Alexander Mihailov Oct 7 '13 at 7:23
• @AlexanderMihailov: Not sure I understand all the details of your post correctly, but from your picture it seems to me that you measure $x$ from the noon position $M$, not from the sunrise position $N$. So $-\frac\pi2\le x\le\frac\pi2$ would be day and $\frac\pi2\le\lvert x\rvert\le\pi$ would be night. In my example graph it would be deep winter with very short days, while your graph would represent summer. – MvG Oct 7 '13 at 7:36
• Got it, thank you. There were some inaccuracies with initial formulation of problem. In particular, I wanted to find $NOB$ instead of $MOB$. Also it's better to use $\alpha=ION$ instead of $JON$. After transformations, finite formula is: $$\tan x = \frac{\sin(\gamma-\beta)}{\cos(\gamma-\beta) - \cos(\alpha-\beta)}$$ – Alexander Mihailov Oct 7 '13 at 8:56