Click or drag to resize

MeshClosestPoint Method (Point3d, Point3d, Vector3d, Double)

Gets the point on the mesh that is closest to a given test point.

Namespace:  Rhino.Geometry
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 5.0
Syntax
public int ClosestPoint(
	Point3d testPoint,
	out Point3d pointOnMesh,
	out Vector3d normalAtPoint,
	double maximumDistance
)

Parameters

testPoint
Type: Rhino.GeometryPoint3d
Point to search for.
pointOnMesh
Type: Rhino.GeometryPoint3d
Point on the mesh closest to testPoint.
normalAtPoint
Type: Rhino.GeometryVector3d
The normal vector of the mesh at the closest point.
maximumDistance
Type: SystemDouble
Optional upper bound on the distance from test point to the mesh. If you are only interested in finding a point Q on the mesh when testPoint.DistanceTo(Q) < maximumDistance, then set maximumDistance to that value. This parameter is ignored if you pass 0.0 for a maximumDistance.

Return Value

Type: Int32
Index of face that the closest point lies on if successful. -1 if not successful; the value of pointOnMesh is undefined.
See Also