Computes the line segments where each straddling triangle
crosses the plane, oriented so the resulting boundary
winds counter-clockwise when viewed from the clipped
half-space (camera positioned along +dir). The emitted
cap face normal is therefore +dir, which makes the cap
front-facing under default back-face culling for the
typical sectioning configuration where the viewer looks
at the cut from the side that was cut away.
Stitches the segments into closed loops by matching
endpoints within a mesh-relative stitching tolerance
(see EPS_STITCH_REL). Open polylines (caused
by non-watertight source meshes) are discarded.
Trims each loop against the kept half-space of every
other plane in capPlanes using Sutherland-Hodgman, so
caps from intersecting cut planes don't overlap.
Classifies each surviving loop as an outer ring or a
hole by its signed area in tangent-space 2D (outer rings
wind CCW, holes CW under the cap convention), attaches
each hole to its tightest containing outer, and
triangulates each outer-plus-holes group with earcut.
Cross-sections through hollow members (pipes, walls with
openings) therefore render with their interiors open
rather than filled.
Emits a TrianglesPrimitiveSceneGeometry,
a SceneMaterial carrying the source
material's hatchPattern (if any) on top of the resolved
cap colour, and a SceneMesh bound
to both. One SceneObject is
created per source object that contributed at least one
cap, listing every cap mesh it produced.
Meshes whose primitive isn't triangle-bearing
(LinesPrimitive, PointsPrimitive)
are skipped — they have no triangles to clip. Open shells
tagged as SurfacePrimitive are walked, but
typically produce no caps because their cap segments fail to
stitch into a closed loop (they're counted in
numUnclosedMeshes).
Source and target SceneModels may
live in different Scenes — the function
only reads source geometry and writes target components.
Returns counts via BuildSectionCapsResult on success. On
failure, partial state may have been written to the caller-owned
target; the caller is responsible for tearing it down. When
progressive is enabled, the function awaits a yield every
batchSize source objects so the renderer can paint partial
results; a caller-driven targetModel.destroy() between yields
bails the loop cleanly at the next batch boundary.
Generates section cap geometry where the supplied planes slice through the source model.
For every source SceneMesh whose primitive is triangle-bearing (SolidPrimitive, SurfacePrimitive, or TrianglesPrimitive) and whose triangles straddle any of capPlanes, the extractor:
+dir). The emitted cap face normal is therefore+dir, which makes the cap front-facing under default back-face culling for the typical sectioning configuration where the viewer looks at the cut from the side that was cut away.EPS_STITCH_REL). Open polylines (caused by non-watertight source meshes) are discarded.capPlanesusing Sutherland-Hodgman, so caps from intersecting cut planes don't overlap.earcut. Cross-sections through hollow members (pipes, walls with openings) therefore render with their interiors open rather than filled.TrianglesPrimitiveSceneGeometry, a SceneMaterial carrying the source material'shatchPattern(if any) on top of the resolved cap colour, and a SceneMesh bound to both. One SceneObject is created per source object that contributed at least one cap, listing every cap mesh it produced.Meshes whose primitive isn't triangle-bearing (LinesPrimitive, PointsPrimitive) are skipped — they have no triangles to clip. Open shells tagged as SurfacePrimitive are walked, but typically produce no caps because their cap segments fail to stitch into a closed loop (they're counted in
numUnclosedMeshes).Source and target SceneModels may live in different Scenes — the function only reads source geometry and writes target components.
Returns counts via BuildSectionCapsResult on success. On failure, partial state may have been written to the caller-owned target; the caller is responsible for tearing it down. When
progressiveis enabled, the function awaits a yield everybatchSizesource objects so the renderer can paint partial results; a caller-driventargetModel.destroy()between yields bails the loop cleanly at the next batch boundary.See @xeokit/sdk/studio/systems/sectionCaps for end-to-end usage examples.