interference
Queries · api.md § interference · all operations
definition
interference(a: Solid, b: Solid) -> {volume: Volume, gap: Length}
Says how two solids meet, as they stand. It returns the volume they share and the gap between them, which is the least distance from a point of one to a point of the other. Two solids that overlap have a volume above 0 and a gap of 0. Two that only touch have 0 for both. Two that are apart have a volume of 0 and the gap between them. A solid held whole inside the other shares its own volume.
The function answers one pair. A client checking an assembly makes or moves each part to where it stands and asks for the pairs it cannot rule out itself.
Example. Solid 1 is a 10 × 20 × 30 mm box with one corner at the origin. Solid 2 is a cylinder of radius 5 and height 20 on the z axis.
> {"cmd": "interference", "a": 1, "b": 2}
< {"ok": {"gap": 0.0, "volume": 392.699081699}}common to queries
| Function | Fields | Returns |
|---|---|---|
volume | s | Volume |
area | s | Area |
classify | s, points | list<"in" or "on" or "out"> |
closest | s, points | list<Point3> |
normal | s, points | list<Vector3 or null> |
curvature | s, points | list<Number[2] or null> |
check | s | list<string> |
centroid | s | Point3 or null |
inertia | s | Number[3][3] |
distance | a, b | Length |
interference | a, b | {volume: Volume, gap: Length} |
betti | s | Count[3] |
section_area | s, origin, normal | Area |
section | s, origin, normal, tolerance | list<list<Point3>> |
project | s, direction, tolerance | {visible: list<list<Point2>>, hidden: list<list<Point2>>} |
bounding_box | s | Point3[2] |
split | s, origin, normal | Solid[2] |
mesh | s, tolerance | {positions: list<Point3>, triangles: list<Index[3]>} |
display | s, tolerance | {faces: list<Face>, edges: list<list<Point3>>} |
raycast | s, origin, direction; or s, rays | list<Length>; or list<list<Length>> |