Determine the direction of rotation / k / variable point in a circle

This center of the circle: vectorA and another vector around the perimeter of the circle: vectorB, how can you define a shorter route for vectorB to move to another point on the perimeter of the circle, which is a variable: vectorC? Will the shorter route rotate clockwise or counterclockwise?

If it helps to think about the watch. If time is a random point on the perimeter of a watch, for example. 6, and the position of the minute hand is known, for example. 4. Do I need to rotate the knob around the center point of the clock clockwise or counterclockwise to reach a random point (6)?

See also:
Vec1 = center of circle, Vec2 = mousepos, find the point on the circle between Vec1, Vec2

0
source share
1 answer

Just calculate the winding direction of triangle ABC

circle point dir

therefore, if you calculate normal n=(B-A)x(C-B), where xis the transverse product, then the sign n.zdetermines the direction.

n.z = ((B.x-A.x)*(C.y-B.y)) - ((B.y-A.y)*(C.x-B.x))
if (n.z<0.0) dir=CW else dir=CCW;

that's all you need ( CW means clockwise and CCW counterclockwise) rude, if your coordinate system is different, then rotation can be denied

[Note]

if (n.z==0), then the points B,Care either opposite or identical, so the direction does not matter, since both ways the angular distance is the same

+2
source

All Articles