How to check the direction of a Bezier curve
The direction of a Bezier curve, visually indicated by its normals slope, can be checked by the indices of its points.
The Bezier curve points indices always ascending in the curve direction.
So, having two points on the curve we can get the direction through their indices:
1 2 3 4 5 6 7 8 |
bezier_spline = bpy.context.object.data.splines[0] p0 = bezier_spline.bezier_points[0] p1 = bezier_spline.bezier_points[1] p0_index = next(iter([point[0] for point in bezier_spline.bezier_points.items() if point[1] == p0]), None) p1_index = next(iter([point[0] for point in bezier_spline.bezier_points.items() if point[1] == p1]), None) direction = 'p0 to p1' if p0_index < p1_index else 'p1 to p0' print(direction) # p0 to p1 |