Skip to content
brep-conformancegithub

display

Queries · api.md § display · all operations

display(s: Solid, tolerance: Length) -> {faces: list<{positions: list<Point3>, normals: list<Vector3>, triangles: list<Index[3]>}>, edges: list<list<Point3>>}

Draws the solid as a viewer shows it: each face meshed on its own, and its edges as polylines.

Each face has its own vertices, so shading is smooth within a face and sharp where two faces meet. Every vertex lies on the face's surface, and normals gives the surface's outward unit normal at each vertex. The triangles are counter-clockwise seen from outside, and no triangle lies farther than tolerance from the face. Together the faces close the solid, as mesh does.

edges holds each edge between two faces, whether they meet at an angle or smoothly, as where a fillet meets the face it rounds into. Each edge is given as a polyline whose every vertex lies on the edge and whose every chord lies within tolerance of the edge. A seam, where a face meets itself, is not drawn, and neither is an edge between two faces on one surface: neither marks a change in the shape.

The suite's runner draws the files it exports with display (formats.md).

Example. Solid 1 is a 10 × 20 × 30 mm box with one corner at the origin. One face and one edge of each are shown.

> {"cmd": "display", "s": 1, "tolerance": 0.1}
< {"ok": {"faces": [{"positions": [[10.0, 20.0, 0.0], [10.0, 0.0, 0.0], [0.0, 0.0, 0.0],
   [0.0, 20.0, 0.0]], "normals": [[-0.0, -0.0, -1.0], [-0.0, -0.0, -1.0], [-0.0, -0.0, -1.0],
   [-0.0, -0.0, -1.0]], "triangles": [[0, 1, 2], [3, 0, 2]]}, … 5 more], "edges": [[[0.0, 0.0, 0.0],
   [10.0, 0.0, 0.0]], … 11 more]}}
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>>