How to quickly know index of meshpoint?

Could anyone help me? I have a problem…

The following is my code…and how to quickly know the index of mpt in s2 mesh-vertices?

Dim mpt As Rhino.Geometry.MeshPoint
Dim s2 As Rhino.Geometry.Mesh
Dim ptoo As Rhino.Geometry.Point3d
Dim g_dist as double

mpt = s2.ClosestMeshPoint(pt, g_dist)

sorry…I think that I already got it…

Dim test_pt As Rhino.Geometry.Point3d
Dim mesh_pt As Rhino.Geometry.Point3d
Dim vec As Rhino.Geometry.Vector3d
Dim g_dist As Double
Dim index_ss As Integer
test_pt.X = -32.91032
test_pt.Y = 3.8698
test_pt.Z = 0
index_ss = s2.ClosestPoint(test_pt, mesh_pt, vec, g_dist)


note that Rhino.Geometry.Mesh.ClosestPoint(Point3d) returns a Point3d on the mesh and not a vertex index.

If you use Rhino.Geometry.Mesh.ClosestPoint(Point3d, Point3d, Vector3d, Double) the return value is an index of the mesh face that the closest point lies on, or -1 in case of no successs. At least this is what the helpfile states.

I guess you might just create a Rhino.Collections.Point3dList from the mesh vertices and use Point3dList.ClosestIndexInList by providing your test point to get a vertex index.