How are curve planes determined?

How does the “planarity” component determine the rotation around the normal when it creates a curve plane? I am using it to get planes from a series of section curves, and some are orthogonally oriented and others are randomly rotated. There are no clear differences in the input curves that would seem to cause this. Any ideas?

Edit: what I really care about is that the “handedness” of the planes is not consistent. I’m using these planes for a rotation later in the script and this inconsistency is causing a lot of headaches.

curve plane inconsistency.gh (19.5 KB)

The planes have the direction of the first segment of their corresponding closed polyline as their x-axis, and the start point of this segment as their origin. This means that if you want all planes to be placed at the same vertex of each similar polyline, you have to align their seams. The seam is where the start and end vertex of a polyline meet.
Aligning poyline seams is pretty easy with the AliCrvSeams component from Pufferfish.
However, this still doesn’t guarantee that the planes have the same polyline segment as their x-axis. In your case, one of the polylines has another direction than the remaining two. So you also need to flip the polylines, with one of them as the guide curve, in order to homogenise their directions.

Be aware though that this works for your specific example, but other ones might need an adapted recipe.

curve plane inconsistency 2.gh (21.7 KB)

Thanks for the insight. I’m using the “section” component to generate these curves, so it’s strange that they don’t have a consistent direction, but I suppose it’s an easy enough fix.

curve plane inconsistency pt 2.gh (28.2 KB)