I'm trying to write a function that will determine whether a circular arc travels clockwise or counter-clockwise.
Given the X,Y coordinates for the start point, center point, and end point I first calculate the angle in radians from the center point to the start and end points.
I thought if I subtracted the ending line angle from starting line angle I could determine if the direction of the arc like this:
if (angle1 - angle2 <= 0): # Clockwise else: # Counter-Clockwise
This does work for any cases where the arc doesn't cross the zero-radians line. But if the arc crosses that line the logic doesn't work.
This Illustration shows that the arc S1-C-E1 works but S2-C-E2 doesn't. I'm pretty sure I've got the right idea, I'm just stuck on the logical bit.
I found another question here that seemed to be similar to what I'm trying to do, but its answer involved a matrix which, I'm sad to admit, I've never learned how to work with. I need an answer that I can easily translate into code or enter into a spreadsheet.
Thanks for any and all assistance!