how to calculate point coordinates on a circle and direction in degrees

1.1k Views Asked by At

In the image below, how can I calculate new point coordinate and direction which are marked in red text. The distance=$1$, radius=$2$ and angle=$30$ degrees. I tried to use the formula $r\sin\theta$ and $r\cos\theta$ but the answer does not match. The answer should be for the new coordinates: $(0.24, 0.96)$ and the direction should be $28.65$ degrees. Please help me to find out how can I do it.

enter image description here

1

There are 1 best solutions below

0
On

You’re missing some crucial information here, but it should be possible to reverse-engineer what you mean from the expected result that you’ve given in your question.

First, we need to agree on how bearing (travel direction) is measured, since it doesn’t appear to follow the usual mathematical convention of a zero angle meaning the positive $x$-direction (right or east) and increasing angles going counterclockwise. Here, the fragment of the compass rosette in your illustration suggests that 0° is in the direction of the positive $y$-axis (up or north) and from the expected results, angles increase clockwise.

Next, you need to compute the angle of arc $\Delta\theta$ subtended by the rover’s path. Importantly, this is not the steering angle, which evidently only determines the turn radius. Denoting the distance traveled by $d$, the angle in radians is simply $d/r$. This angle also represents the change in the rover’s heading. Here, $d=1$ and $r=2$, so $\Delta\theta = 1/2$, which is approximately 28.65°. This angle is also equal to the change in heading, and the rover is making a right turn, so the final heading is approximately 28.65° in agreement with your expected results.

With the correct angle in hand, you can then compute the new location. Since the rover starts at $(0,0)$ heading north and is making a right turn, its path ends at $(2-2\cos{\Delta\theta}, 2\sin{\Delta\theta}) \approx (0.24,0.96)$, as expected.

More generally, if the rover starts at point $P_0 = (x_0,y_0)$, its new location is $$\begin{align} \begin{bmatrix}x\\y\end{bmatrix} &= C+\begin{bmatrix}\cos{\Delta\theta}&\sin{\Delta\theta}\\-\sin{\Delta\theta}&\cos{\Delta\theta}\end{bmatrix}(P_0-C) \\ &= \begin{bmatrix}x_c+(x_0-x_c)\cos{\Delta\theta}+(y_0-y_c)\sin{\Delta\theta} \\ y_c - (x_0-x_c)\sin{\Delta\theta}+(y_0-y_c)\cos{\Delta\theta}\end{bmatrix},\end{align}$$ where $\Delta\theta = d/r$ for a right turn and $-d/r$ for a left turn, and $C=(x_c,y_c)$ is the center of the turn. If the initial heading is $\alpha$, then the new heading is, of course, $\alpha+\Delta\theta$.

The center $C$ lies at a distance $r$ from $P$ in a direction perpendicular to the rover’s current facing: $$x_c = x_0 \pm r\cos\alpha \\ y_c = y_0 \mp r\sin\alpha$$ with the signs chosen based on whether it is a right or left turn, respectively.