Rhino 6 mesh class documentation/description



the mesh class in Rhino 6 has evolved quite a lot from Rhino 5 (well done!).
It would be great if there was an overview document or example files explaining the main concepts behind the revisions.
Things like: What is an ngon? What is their relationship to faces? Can I loop through ngons+faces whilst ignoring faces which are part of ngons? What assumptions (if any) can be made about edge/ngon boundary orientation, retention of component indices etc.

Many thanks!

(Dale Fugier) #2

Hi @dgebreiter,

Yes, there is plenty of new bloat to Rhino’s Mesh class in V6.

An n-gon is an n-sided (5 or more) mesh face. Some mesh formats support these types of faces, not just the traditional 3- or 4-sided faces.

Rhino’s n-gon support is really just an additional layer of bookkeeping on top of the mesh object you already know. A mesh n-gon is a collection of adjacent, co-planar faces and some other booking information. This way, if you don’t want to deal with n-gons, then you can deal with just the traditional 3-and 4-sided faces and vertices just like you always have.

– Dale


Hi Dale,

thanks for your prompt reply. What I was after was a quick overview and explanations on the assumptions I could make (for example, are boundary vertices of an ngon always returned in orrect order? Maybe even, say, topologically anti-clockwise on manifold meshes?).

Here’s a link to openmesh’s manual for an example of he kind of info I was after. Of course their class requires much more attention in the first place.

Alternatively, it would be great if you could supply a good example file for mesh operations once the first wave of post-release Rhino 6 bug fixes dies down!

Many thanks,


(Dale Fugier) #4

Sounds like they are.


– Dale


“Vertices are sorted counterclockwise with respect to the direction of the face.”

yes, I agree, it sounds like they are. But the direction of which face exactly?

It appears the orientation of the ngon is dependent on the orientation of the first face in the ngon FaceIndexList. This probably makes sense but ist not obvious from the documentation.

        A = x.Ngons[0].FaceIndexList(); // 0, 1, 2

        B = x.Ngons.GetNgonBoundary(new List<int>{0}); //3, 4, 0

        MeshFace mf1 = x.Faces[1].Flip(); //flip second face
        x.Faces[1] = mf1; //reinsert seond face

        C = x.Ngons.GetNgonBoundary(new List<int>{0}); //3, 4, 0 - no change

        MeshFace mf0 = x.Faces[0].Flip(); //flip first face
        x.Faces[0] = mf0; //re-inster flipped face

        D = x.Ngons.GetNgonBoundary(new List<int>{0}); //3, 0, 4 - ngon orientation changed

Trying to familiarise myself and implementing some of the classics (the dual graph for instance) I found a few places where second-guessing was required. I eventually managed what I wanted but I still think an overview document about the data structure or a decent example would be helpful.