[RhinoCommon R6] Wrong N-Gon Orientation, very strange

rhinocommon
mesh
rhino6

#1

I got an open mesh in Rhino6, exhibiting about 1000 triangles and some 5-sided n-gons on the boundary.

The mesh appears to be OK in Rhino, consistent face directions, etc.

However, when drawing each face/ngon’s bounding polyline by the following code, strangely, 6 of my boundary N-Gons are oriented counterclockwise:

foreach (var ngonFace in rhinoNgonMesh.GetNgonAndFacesEnumerable())
        {
            List<Point3d> boundaryVertices = new List<Point3d>();

            //get points for polyline
            foreach (var vidx in ngonFace.BoundaryVertexIndexList())
            {
                boundaryVertices.Add(rhinoNgonMesh.Vertices[(int)vidx]);
            }
            //close polyline
            boundaryVertices.Add(rhinoNgonMesh.Vertices[(int)ngonFace.BoundaryVertexIndexList()[0]]);
            
            doc.Objects.AddPolyline(new Polyline(boundaryVertices));
        }

mesh.UnifyNormals() tells me that there are no face-directions to be changed, consequently, applying this function does nothing.

I suspect that my problem is related to what the MeshNgon.BoundaryVertexIndexList() Method description says:

Get the outer boundary mesh vertex list of the ngon. Vertices are sorted counterclockwise with respect to the direction of the face, although the degree by which vertex normals will respect this might vary.

However, I do not exactly know what to make of this.

Best, Heinz.


(Dale Fugier) #2

Hi @lungenstrudel,

Is there geometry we can look at?

– Dale