Getting an angle

139 Views Asked by At

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$.

enter image description here

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:

enter image description here

EDIT2:

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

enter image description here

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

1

There are 1 best solutions below

3
On BEST ANSWER

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°$: Example plot: alpha=60°, beta=40°