 Hi,

Maybe a dummy question, I didn’t find any similar thread: for a given quad `ON_MeshFace`, are their four vertices `vi` ordered with a given criteria (clockwise or counter-clockwise)? How can I know it?

Thx
Nathan

as far as i remember when counter-clockwise the normal points towards you, and vice versa… this is a general rule and not rhino dependent

I rather refer to the mesh face way of handling data. Imagine that your quad has 4 vertices A, B, C, D and is parameterized like this:

B --------- C
| |
| |
| |
A --------- D

(Edit: I tried to properly draw the quad but here the tab space doesn’t work, hope you get the idea)

Then this face ON_MeshFace has the array of indices vi. How are they stored?

• Like A, B, C, D (clockwise)
• A, D, C, B (counter clockwise)
• or any other random way (like A, C, B, D etc)?

there is no rule: they are stored in the order they where created, e.g. with AddFaces in a mesh, or with the MeshFace constructor.

But their order has effects on other things like the calculation of normals or the validity of the mesh… and this refers to the data layout, not the actual vertex positions; the same vertex positions with different data layouts results in different normal orientations

Not sure if this clears things up for you, but if you explain a bit more what it is you want to do, maybe i can understand your problem better.

I see. What I’m trying to do is basically go through the quad vertices counter-clockwise, to identify a parameterization (i.e. the vertices defining a u direction and the ones defining the v direction which is orthogonal). This is crucial for 2D FEM algorithms.

Do you think I could get this information from the face normal somehow?

Thanks!

if the mesh is a closed solid you can assume all vertices are in ccw order relative to the normal, but I guess that wont be enough as you have to find out where the 0 index is in relation to the face… and its neighbors.
have a look at TopologyVertices and TopologyEdges, also sorted functions like:

``````public int[] ConnectedTopologyVertices(
int topologyVertexIndex,
bool sorted
)``````

You’re right, what I’m looking for is exactly topology data, most probably contained in classes like `ON_MeshTopologyVertex`. How can I retrieve the quad topology from this construct?

I took a look at opennurbs_mesh.h but didn’t really get it… I think the expert on this is @stevebaer , thank you all for any insight.

You can look at the surface parameters on the mesh if it was created from a surface (see m_S on the ON_Mesh). This sounds like what you may be looking for if you are after U/V type information.

Mmm! Then I guess I misunderstood the concept behind `ON_MeshTopology`. Is it topology in the sense of point cloud (info about coincident vertices, edges etc.)?

The topology does give you information about the topological vertices (coincident vertices) as well as edge information. I’m not exactly sure what you need for your process. If you want access to the ON_MeshTopology information you can get it from the ON_Mesh by calling the Topology() function.

This class is great and all I need, thanks @stevebaer. One last question: what is the relationship or map between a vertex v in `m_V` inside `ON_Mesh` and a topological vertex tv in `m_topv` inside `ON_MeshTopology`?

Thx
Nathan

Each ON_MeshTopologyVertex represents one or more vertices in the m_V array. You can look at m_v_count and m_vi on ON_MeshTopologyVertex to figure out which vertices in m_V it represents