Skip to content
brep-conformancegithub

closest

Queries · api.md § closest · all operations

closest(s: Solid, points: list<Point3>) -> list<Point3>

Finds the point of the solid nearest each point.

Returns, for each point in order, a point of s such that no other point of s is nearer to the given point. Here s is the solid with its inside counted in, as for distance, so a point that s holds is its own nearest point. For a point outside s, the nearest point lies on the boundary of s: on a face, an edge or a vertex. Where several points of s are equally near, as the points round a ring are from a point on a torus's axis, any one of them is a correct answer.

Example. Solid 1 is a 10 × 20 × 30 mm box with one corner at the origin. The first point is inside it.

> {"cmd": "closest", "s": 1, "points": [[5, 10, 15], [20, 10, 15]]}
< {"ok": [[5.0, 10.0, 15.0], [10.0, 10.0, 15.0]]}
FunctionFieldsReturns
volumesVolume
areasArea
classifys, pointslist<"in" or "on" or "out">
closests, pointslist<Point3>
normals, pointslist<Vector3 or null>
curvatures, pointslist<Number[2] or null>
checkslist<string>
centroidsPoint3 or null
inertiasNumber[3][3]
distancea, bLength
interferencea, b{volume: Volume, gap: Length}
bettisCount[3]
section_areas, origin, normalArea
sections, origin, normal, tolerancelist<list<Point3>>
projects, direction, tolerance{visible: list<list<Point2>>, hidden: list<list<Point2>>}
bounding_boxsPoint3[2]
splits, origin, normalSolid[2]
meshs, tolerance{positions: list<Point3>, triangles: list<Index[3]>}
displays, tolerance{faces: list<Face>, edges: list<list<Point3>>}
raycasts, origin, direction; or s, rayslist<Length>; or list<list<Length>>