[Math] Find direction of tangent vector based on trajectory along circle

circlestangent linevectors

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.

Best Answer

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.

Related Question