Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8550

Plane orientation

$
0
0

@Petras_Vestartas wrote:

I have question about plane orientation.

Assuming I have multiple polylines that are planar and winding in the same orientation.
I would like to compute normal vector of such polyline.

If I use Plane Fit method plane normal is sometimes flipped.
If I take the Mesh.FromClosedPolyline method to get mesh and then extract one mesh normal I get good orientation:

Is there any mathematical method how to compute polygon normal for polyline coordinates?


Question.gh (5.7 KB)

//Fit polyline points to plane results in incorrect plane orientation
Plane plane0;
Plane.FitPlaneToPoints(polyline, out plane0);


//Mesh from closed polyline takes into account polyline orientation and results in good result
Mesh mesh = Mesh.CreateFromClosedPolyline(polyline);

//output
A = polyline.CenterPoint();
B = plane0.ZAxis * 100;
C = mesh.FaceNormals[0] * 100;

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 8550

Trending Articles