views:

61

answers:

1

I'm working on implementing bezier handles into my application. I have points and I need to figure out weather the current direction of the new point is clockwise or counter clockwise. This is because my bezier interpolation algorithm calculates the handles from right to left.

Therefore no matter what it interpolates: P1 P1.righthandle P2 P2.lefthandle to achieve cubic bezier

How can I figure out if the shape is CW or CCW. Thanks

A: 

You have your original angle, the last known angle (since I'm sure you're redrawing the handle as it's being dragged), and the current angle. I'd take a look at the last known handle angle on the last redraw and compare whether the new angle, relative to that is > 180 degrees or < 180 degrees. If it's 0 - 180 degrees, it's moving in a clockwise direction, and if it's 180 - 360 degrees, it's moving in a counterclockwise direction.

umop