mesh.closestPoint
The point of the mesh nearest a query point, with its face and distance.
Usage
mesh.closestPoint(p: Point3): MeshClosest | nullParameters
pPoint3The query point. Required. In model.
Returns
The nearest point, its distance and its face as a prim set; null for a mesh without faces.
Guarantees
- distance equals Point3.distance(p, point)
- The same result on every machine.
Example
Mesh.box().value.closestPoint(Point3.of(3, 0, 0)).distance // → 2.5