section
Queries · api.md § section · all operations
definition
section(s: Solid, origin: Point3, normal: Vector3, tolerance: Length) -> list<list<Point3>>
Gives the curves that the plane through origin square to normal cuts from the solid's boundary. The curves come in pieces, in any order. Each piece is a stretch of one curve, given as two or more points along the curve from one end of the stretch to the other. Every point lies on the plane and on the boundary, and every chord between consecutive points lies within tolerance of the curve. tolerance must be positive.
The pieces join end to end into closed curves. Each end of a piece lies within 10·ε of an end of another piece, and a piece that is a whole closed curve ends on its first point. A kernel returns the pieces as it has them: one for each edge of the section, or one for each curve. The client joins the pieces.
Example. Solid 1 is a 10 × 20 × 30 mm box with one corner at the origin.
> {"cmd": "section", "s": 1, "origin": [0, 0, 15], "normal": [0, 0, 1], "tolerance": 0.01}
< {"ok": [[[10.0, -0.0, 15.0], [9.375, -0.0, 15.0], [8.75, -0.0, 15.0], [8.125, -0.0, 15.0],
[7.5, -0.0, 15.0], [6.875, -0.0, 15.0], … 59 more]]}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>> |