Skip to content
brep-conformancegithub

betti

Queries · api.md § betti · all operations

betti(s: Solid) -> Count[3]

Counts the solid's separate pieces, the tunnels that run through it and the voids it encloses.

Returns the solid set's Betti numbers b0, b1, b2. A box is [1, 0, 0], a ring is [1, 1, 0], a plate with n holes is [1, n, 0], and a box with a ball removed from inside it is [1, 0, 1]. Pieces that only touch count as one piece here, because the point set is connected.

Example. Solid 1 is a 10 × 20 × 30 mm box with one corner at the origin.

> {"cmd": "betti", "s": 1}
< {"ok": [1, 0, 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>>