Geting the unit vector of a tangent at point x/y on a cricle

98 Views Asked by At

Trying to write an programming algorithm but having a couple issues with the maths.

So I have an object moving in circlular motion in one plane.

The circle is defined with a center co-ordinate and a radius.

But I need to get the unit vector of the tangent at a point defined by x/y coords on the circle (and need a generic formula that I can use to rotate the object correctly in the direction of motion)

My objects position is defined by

x = cx + sin(time)*r;
y = cy + cos(time)*r;

where cx and cy is the center of the circle.

Where do I go next to calculate the direction of the tangent at point x/y?

1

There are 1 best solutions below

3
On BEST ANSWER

The tangent vector's direction is given by the derivative of the $x$ and $y$ coords with respect to time. In short

xp =   cos(time);
yp =  -sin(time);

gives you a unit vector pointing in the direction of motion of your object.