A particle travels along an arc (in green) from A = $(x_A, y_A)$ to B= $(x_B, y_B)$. The arc is on a circle defined by its center C = $(x_C, y_C)$ and its radius r. The vector u points from C to A and the vector v points from C to B.

The goal is to find the direction vectors at the beginning (point A) and at the end (point B) of the trajectory. It is easy to find the gradient m of the tangent line at point A from the gradient n of the radius from C to A, using the fact that the radius and the tangent line are perpendicular and hence that the product of m and n is equal to -1.

For instance, the equation of the tangent line at point A is $y = m(x - x_A) + y_A$. However, I do not need a line, but rather a vector pointing toward the direction of motion at the beginning of the trajectory. Knowing the equation of the tangent line is not enough to determine the direction of this vector.

The data is from real measurements and hence all possible scenarios are present. The angle $\alpha$ between u and v can be large, as shown in the figure, or on the opposite very small, and in addition, it can run in the clockwise (as in the figure) or in the anti-clockwise direction.

The only information I have is the equation of the circle and the coordinates of the many trajectory points that form the arc along the circle.

Many thanks.

This figure may help understand the problem.

  • $\begingroup$ Fwiw, the equation you give for a tangent line doesn’t cover vertical tangents. $\endgroup$ – amd Mar 7 '18 at 20:46
  • $\begingroup$ @IroncladLunatic Please remember that you can choose an aswer among the given if the OP is solved, more details here meta.stackexchange.com/questions/5234/… $\endgroup$ – gimusi Mar 9 '18 at 23:35

As you say, the tangent vector to a circle is always perpendicular to the radial vector. Since you know the radial vectors at the two points, finding the corresponding direction vectors is a simple matter of rotating the radial vectors 90° in the appropriate direction—the same direction in which you’re measuring the angle of arc.

Assuming the standard mathematical convention of angles measured counterclockwise begin positive, if the radial vector from $C$ to a point has coordinates $(a,b)$, then the direction vector at that point is $(-b,a)$ for a counterclockwise motion along the arc and $(b,-a)$ for a clockwise motion. Adjust the length of this vector as desired.

If you don’t happen to have the direction of motion handy, you can determine it from a pair of points near each other along the path. Let $(x_1,y_1)$ and $(x_2,y_2)$ be the coordinates of the radial vectors from $C$ to these two points, with the latter point being reached later in time. Compute the cross product $$(x_1,y_1,0)\times(x_2,y_2,0) = (0,0,x_1y_2-x_2y_1).$$ By the right-hand rule, the sign of the last coordinate of the result will give you the direction of motion: positive for counterclockwise, negative for clockwise. You want the two points to be near each other so that the direction is computed correctly. If they’re too far apart, the direction computed by the cross product will be the reverse of the actual direction of motion, as would happen if you used the two end points in your illustration.

  • $\begingroup$ Thank you for the detailed explanation. My trajectory was nicely approximated by an arc yet noisy, and consequently the projection of its coordinates on the circle resulted in points that were not monotonically sorted. I used the sum of the sign of the cross-products between consecutive positions to obtain the direction of the rotation between the two radial vectors, and then rotated these radial vectors by 90 degrees clockwise or counter-clockwise to obtain the tangents. It works nicely. $\endgroup$ – Ironclad Lunatic Mar 10 '18 at 11:29
  • $\begingroup$ @IroncladLunatic Glad it worked. If you like, you can avoid an explicit sign test by hiding it inside of a “sign” operator: $\operatorname{sgn}(x_1y_2-x_2y_1)(-b,a)$. $\endgroup$ – amd Mar 10 '18 at 18:41

The parametric equation for a point P on the circle is

  • $\vec {OP}(t)=\vec {OC}+\vec {CP}(t)=\vec {OC}+(R\cos (\alpha(t)) ,R \sin (\alpha(t)))$

by definition the velocity vector is

  • $\frac{d\vec {OP}}{dt}=(-R\alpha'(t)\sin (\alpha(t)), R\alpha'(t)\cos (\alpha(t)))$

and the tangent vector is

  • $\vec T=(-\sin (\alpha(t)) , \cos (\alpha(t)) )$
  • 1
    $\begingroup$ Thank you. I ended up using the method suggested by amd, but your suggestion helped me to understand my problem. $\endgroup$ – Ironclad Lunatic Mar 10 '18 at 11:32
  • $\begingroup$ I’m happy it was useful. You are welcome! Bye $\endgroup$ – gimusi Mar 10 '18 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.