Skip to content
Shapemetry

@huukhanhnguyen/model / nodeMethods/solid/helpers

nodeMethods/solid/helpers

asFaces()

asFaces(input): BrepData[]

Collect the brep data documents from a value (single, array, or nested).

Parameters

input

unknown

Returns

BrepData[]


dedupLoop()

dedupLoop(loop): Point[]

Parameters

loop

Point[]

Returns

Point[]


groupLoopsByArea()

groupLoopsByArea(rings): Point[][][]

Group rings into face-with-holes groups: partition by plane FIRST (a profile spanning several planes must never test one ring's containment against another ring's plane — the previous bug, since the depth count below always projected via rings[0]'s frame regardless of which plane a given ring actually lived on), then — per plane, in that plane's OWN frame — a ring nested inside an odd number of others is a hole (even-odd depth, matching Curve2d's own containsPoint/toRegions convention), assigned to its smallest-area containing outer. Works directly off the ORIGINAL 3D rings (2D projection is a throwaway array used only for the area/containment tests) — no reconstruction from tessellated geometry, so a ring's exact points (including deliberate off-plane noise a caller may be testing) survive untouched into the caps built downstream.

Parameters

rings

Point[][]

Returns

Point[][][]


isClosedSolid()

isClosedSolid(faces): boolean

True when a set of brep data documents closes a VOLUME — the canonical watertight predicate, and the one the opening contract is checked against (DataNode's placeComponent 3D branch).

Sews the faces into a Shell and asks the kernel: every edge used by exactly two oriented uses. O(edges), no geometric validation and no mesh promotion — this runs on every placement of a component that declares an opening.

An EMPTY set is not a solid (a caller that means "no cut" checks length first — see the opening branch, where empty is legal and skips the check).

Parameters

faces

BrepData[]

Returns

boolean


loopFaces()

loopFaces(loops, thickness): ExtrudeFace[]

Parameters

loops

Point[][]

thickness

number

Returns

ExtrudeFace[]


pickFrame()

pickFrame(normal): { uAxis: Point; vAxis: Point; }

Parameters

normal

Point

Returns

{ uAxis: Point; vAxis: Point; }

uAxis

uAxis: Point

vAxis

vAxis: Point


profileToRings()

profileToRings(profile, tolerance?): ProfileRing[]

Parameters

profile

unknown

tolerance?

number = DEFAULT_CURVE_TOLERANCE

Returns

ProfileRing[]


project2dP()

project2dP(ring, uAxis, vAxis, origin): [number, number][]

Parameters

ring

Point[]

uAxis

Point

vAxis

Point

origin

Point

Returns

[number, number][]


toDirection()

toDirection(raw): ExpressionPoint

The unit direction of a Float64Array triple the kernel just answered — object form, for the synthesized-predicate door only (selectFaces).

Parameters

raw

ArrayLike<number>

Returns

ExpressionPoint


wallFaces()

wallFaces(rings, thickness): ExtrudeFace[]

Parameters

rings

{ closed: boolean; points: Point[]; }[]

thickness

number

Returns

ExtrudeFace[]

Last updated: 📖 3 min readEdit on GitHub