mesh.closestPoint

The point of the mesh nearest a query point, with its face and distance.

GeometricSince 0.3.0

Usage

TypeScript
mesh.closestPoint(p: Point3): MeshClosest | null

Parameters

  • pPoint3

    The 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

TypeScript
Mesh.box().value.closestPoint(Point3.of(3, 0, 0)).distance // → 2.5

See also