Skip to content
brep-conformancegithub

project

Queries · api.md § project · all operations

project(s: Solid, direction: Vector3, tolerance: Length) -> {visible: list<list<Point2>>, hidden: list<list<Point2>>}

Makes a hidden-line drawing of the solid seen looking along direction. The drawing shows the solid's edges, and its outlines where the line of sight grazes a curved face. Each edge and each outline is cut into the stretches the viewer sees and the stretches the solid hides. A point is hidden when the ray from that point toward the viewer passes through the solid. An edge between faces that meet smoothly is not drawn, and neither is a face's seam.

Each stretch is returned as a polyline in the view plane. Every vertex of the polyline lies on the stretch, and every chord lies within tolerance of the stretch. tolerance must be positive. The plane has two axes. The axis across is u = d × z, made unit, or d × x when d runs along z. The axis up is v = −d × u. A point p draws at (p·u, p·v).

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

> {"cmd": "project", "s": 1, "direction": [0, 0, -1], "tolerance": 0.01}
< {"ok": {"hidden": [], "visible": [[[0.0, 0.0], [0.0, 0.625], [0.0, 1.25], [0.0, 1.875],
   [0.0, 2.5], [0.0, 3.125], … 11 more], [[0.0, 0.0], [0.0, 0.625], [0.0, 1.25], [0.0, 1.875],
   [0.0, 2.5], [0.0, 3.125], … 11 more], [[0.0, 10.0], [-1.25, 10.0], [-2.5, 10.0], [-3.75, 10.0],
   [-5.0, 10.0], [-6.25, 10.0], … 11 more], [[0.0, 10.0], [-1.25, 10.0], [-2.5, 10.0],
   [-3.75, 10.0], [-5.0, 10.0], [-6.25, 10.0], … 11 more], [[-20.0, 10.0], [-20.0, 9.375],
   [-20.0, 8.75], [-20.0, 8.125], [-20.0, 7.5], [-20.0, 6.875], … 11 more], [[-20.0, 10.0],
   [-20.0, 9.375], [-20.0, 8.75], [-20.0, 8.125], [-20.0, 7.5], [-20.0, 6.875], … 11 more],
   … 6 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>>