Hi there,

I know the x,y,z coordinate values of a mesh vertex and I want to find its index. I could not find any method on Rhinocommon to perform this operation.

Any suggestions would help greatly!

Thanks!

Hi there,

I know the x,y,z coordinate values of a mesh vertex and I want to find its index. I could not find any method on Rhinocommon to perform this operation.

Any suggestions would help greatly!

Thanks!

Hi

As what you have are just 3 known numbers, the only way to find the matching vertices is by testing equality of each vertex for the known point. Cast the xyz coordinates into a Rhino.Geometry.Point3d

and you could use this method to test for equality

Note that iirc there can be multiple vertices at the same location

Typically where 2 unwelded mesh faces meet they share the location of 2 vertices hower each face points to 2 different vertices.

HTJ

-Willem

Thanks for your suggestion Willems,

If I understood correctly you are explaining a way to find the coordinates of the mesh based on the known x,y,z points. But what I actually want to find is the vertex Index of a known mesh vertex coordinate.

Thank you for your time

We might be miscommunicating,

Can you describe your desired solution in pseudo code?

My take was:

```
known_point = x,y,z
found_indices = []
for i, vertex in enumerate(MeshVertexList):
if known_point.EpsilonEqualsTo(vertex):
found_indices.append(i)
```

Does that make sense?

2 Likes

See attached as well (and modify it accordingly: for instance by-pass the takePercent etc etc).

NOTE: MTV Indexing is NOT the same as MV Indexing.See inside C# for going from MTV idx to MV Idx (Array of indices in fact (*)… but anyway).

Tip: (*) Use always M.TopologyVertices [i.e. vertices **on a per Mesh** basis] instead of M.Vertices [i.e. **vertices on a per MeshFace** basis].

Tip: ALWAYS use the M.Vertices.CombineIdentical(true, true); Method.

Mesh_Coord_To_MTV_MV_Idx_V1.gh (160.9 KB)