N
N
Nikolai2022-02-13 00:33:34
Mathematics
Nikolai, 2022-02-13 00:33:34

How to determine the drawing direction of an arc?

There is a circle with radius R.
There is a start point on the circle with coordinates x0, y0 and a finish point with coordinates x1, y1.

How can I determine the direction (clockwise or counter-clockwise) of drawing the shortest arc?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
Wataru, 2022-02-13
Demidovets @Nik_o_lay

Use the cross product of vectors from the center of the circle and two points. It will give you a positive value if you need to go counterclockwise from the first to the second vector and a negative one - vice versa. Zero if the vectors lie on the same line as the center of the circle.
The formula will be (x0 - xr)(y1-yr) - (x1-xr)(y0-yr), where xr, yr is the center of the circle.

A
Alexander Falaleev, 2022-02-13
@suffix_ixbt

We place the circle in the coordinate system so that the center is at the point (0, 0), and the first point is on the X axis.
Then the coordinates of the first point will be (R, 0).
It is obvious and trivial that:
1.
If the second point has y1 > 0 then move counterclockwise from the first point for the shortest arc.
2.
If the second point has y1 < 0, then it is necessary to move from the first point clockwise for the shortest arc
3.
If y1 = 0, then since this point is different from the first one, its coordinates will be (-R, 0) difference clockwise or counterclockwise move because the arcs will be the same.
Draw your own conclusion :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question