Is 2D Arc curve drawn clockwise or counter clockwise based on a vector direction

144 Views Asked by At

I am extracting 2D curve data out from a CAD system but I am struggling with arc curves because I need to know if they are drawn clockwise or counter clockwise. I have x,y coordinates for the center of the arc and also for the start and end points of it. I also have the radius of the arc. On top of this I also have a direction vector at the start point with known value so with all this data it must be possible to find out if the arc is drawn clockwise or counter clockwise around its center point. The vector is perpendicular to the arc centerpoint. Arc sample

I have read some basics about vectors on internet but I haven't gathered enough knowledge to solve this problem. I think I could find a trigonometric solution to it but I guess there must be a smarter "vector approach" possible or?
Thank you in advance for helping me out!

1

There are 1 best solutions below

0
On

Let the circular arc $\gamma$ have initial point $A=(a_1,a_2)$, endpoint $B=(b_1,b_2)$, and center $M=(m_1,m_2)$. Furthermore the initial speed $v=(v_1,v_2)$ (attached at the point $A$) is available. Now look at the vector $$r:=\vec{MA}=a-m\ .$$ This vector is orthogonal to $v$, so that $r\cdot v=(a_1-m_1)v_1+(a_2-m_2)v_2=0$.

Whether $\gamma$ is clockwise or counterclockwise can be decided as follows: If $v$ goes leftward when you are looking from $m$ to $a$ along $r$ then $\gamma$ is counterclockwise, and if $v$ goes rightward when you are looking from $m$ to $a$ then $\gamma$ is clockwise. Algebraically this is decided by the sign of the exterior product $$r\wedge v:=r_1v_2-r_2v_1=(a_1-m_1) v_2-(a_2-m_2)v_1\ .$$ If $r\wedge v>0$ then $\gamma$ is counterclockwise, if $r\wedge v<0$ then $\gamma$ is clockwise.