Skip to content
brep-conformancegithub

interference

Queries · api.md § interference · all operations

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}}
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>>