Whether the direction of the curve is clockwise or counterclockwise

As the title says, I want to judge whether the direction of the poly curve is clockwise or counterclockwise, and get the result such as [true / false] or [0 / 1] as output, such as clockwise / counterclockwise.
My knowledge of mathematics is low, so I need help from a dynamo power user!

Thank you

If the curve is part of a closed loop, you can use the Line.Direction node, and see if it is clockwise or counterclockwise

I think the Line.Direction node does not accept curves or polycurves.
Can you explain a little more concretely?

Try using Curve.TangentAtParameter to find the curve direction at the midpoint.

We need more information to give you a better answer. Keep in mind that a polycurve may change directions and not be consistently clockwise or counterclockwise.

Certainly the words clockwise or counterclockwise were not appropriate to describe the question.
I want to get the right or left direction from the start point of the polycurve.

1 Like

@jj06jj ?



Try with the Graham Scan method:


This method has worked for me in the past when using closed, planar polycurves. It wont suit open polycurves however, and might have limited applications. I’ve found curve normals typically set to the right for polycurves, but not sure if this is always the case. If it is then this might have use.

detect inside.dyn (23.9 KB)

That’s what I was looking for!
Certainly this procedure seems very simple.

So you are getting the vector from the start point to the end point of the polycurve and determining whether the x value is negative or positive?

I won’t use it this time, but I’m grateful that I knew the algorithm as knowledge!

1 Like