@huukhanhnguyen/geometry / namespaces/Brep
namespaces/Brep
analyticSection
constanalyticSection: (json,first_face,second_face,seed_region) =>Float64Array=wasm.brep_analytic_section
The plane x plane closed-form section between two faces of a solid, clipped to seed_region ([minX, minY, minZ, maxX, maxY, maxZ]).
Returns a flat packet: [lineCount, then per line: t0, t1, x0,y0,z0,
x1,y1,z1, u0,v0 on first, u1,v1 on first, u0,v0 on second, u1,v1 on second]. An empty result ([0]) means the planes are parallel or miss the box; the export ERRORS where the TypeScript returns null, since "not a plane pair" is a caller mistake here rather than a dispatch step.
Parameters
json
string
first_face
number
second_face
number
seed_region
Float64Array
Returns
Float64Array
analyzeTolerances
constanalyzeTolerances: (json) =>Float64Array=wasm.brep_analyze_tolerances
[vertexCount, minTolerance, maxTolerance, averageTolerance] over the OUTER shell, which is the shell Solid.analyzeTolerances passes.
Parameters
json
string
Returns
Float64Array
boundingBox
constboundingBox: (json) =>Float64Array=wasm.brep_bounding_box
[minX, minY, minZ, maxX, maxY, maxZ]. An empty face set gives the empty box, which reads back +Infinity mins and -Infinity maxes exactly as BoundingBox.fromPoints([]) does.
Parameters
json
string
Returns
Float64Array
boundingSphere
constboundingSphere: (json) =>Float64Array=wasm.brep_bounding_sphere
[centerX, centerY, centerZ, radius].
Parameters
json
string
Returns
Float64Array
box
constbox: (dx,dy,dz) =>string=wasm.brep_box
Parameters
dx
number
dy
number
dz
number
Returns
string
centerOfMass
constcenterOfMass: (json) =>Float64Array=wasm.brep_center_of_mass
[x, y, z].
Parameters
json
string
Returns
Float64Array
chamfer
constchamfer: (json,edge_indices,distance1,distance2) =>string=wasm.brep_chamfer
Solid.chamfer(distance1, edges?, distance2?) — the chamfered solid, as a fresh handle.
An EMPTY edge_indices is the TypeScript's omitted edges, which selects every edge — and on an origin AABB box with equal distances that is the closed-form all-12-edge path (OCCT MakeChamfer topology: 26 faces, 48 edges, 24 vertices).
Same CONTRACT change as [brep_fillet]: an edge that does not cut is an error naming it, not a silently untouched solid.
Parameters
json
string
edge_indices
Uint32Array
distance1
number
distance2
number
Returns
string
chamferReportJson
constchamferReportJson: (json,edge_indices,distance1,distance2) =>string=wasm.brep_chamfer_report_json
Solid.chamferReport(...) — the counts and the per-edge outcome, as JSON.
Parameters
json
string
edge_indices
Uint32Array
distance1
number
distance2
number
Returns
string
checkBsplineRestrictions
constcheckBsplineRestrictions: (json,max_degree,max_segments,tolerance) =>number=wasm.brep_check_bspline_restrictions
Count nurbs carriers exceeding the degree / segment limits.
Parameters
json
string
max_degree
number
max_segments
number
tolerance
number
Returns
number
circularPattern
constcircularPattern: (json,axis_x,axis_y,axis_z,center_x,center_y,center_z,count) =>string=wasm.brep_circular_pattern
Parameters
json
string
axis_x
number
axis_y
number
axis_z
number
center_x
number
center_y
number
center_z
number
count
number
Returns
string
classifyPoint
constclassifyPoint: (json,x,y,z,tolerance) =>number=wasm.brep_classify_point
0 = inside, 1 = outside, 2 = on-boundary — the ordering of the TypeScript union 'inside' | 'outside' | 'on-boundary'.
Parameters
json
string
x
number
y
number
z
number
tolerance
number
Returns
number
classifyShells
constclassifyShells: (documents) =>string[] =wasm.brep_classify_shells
classifyShellsToBodies — N one-shell BrepJson documents in, one solid-root BrepJson document per body out.
Documents rather than handles, because containment is decided by point tests that cannot cross stores: every shell is read into ONE arena here.
Parameters
documents
string[]
Returns
string[]
clone
constclone: (json) =>string=wasm.brep_clone
Parameters
json
string
Returns
string
collapseCollinearDefaultTolerance
constcollapseCollinearDefaultTolerance: () =>number=wasm.brep_collapse_collinear_default_tolerance
The default collapseCollinearVertices band.
Returns
number
collapseCollinearVertices
constcollapseCollinearVertices: (json,tolerance) =>string=wasm.brep_collapse_collinear_vertices
Collapse runs of collinear boundary vertices. Returns the collapsed count.
Parameters
json
string
tolerance
number
Returns
string
cone
constcone: (bottom_radius,top_radius,height) =>string=wasm.brep_cone
Parameters
bottom_radius
number
top_radius
number
height
number
Returns
string
containsPoint
constcontainsPoint: (json,x,y,z,include_boundary) =>boolean=wasm.brep_contains_point
Parameters
json
string
x
number
y
number
z
number
include_boundary
boolean
Returns
boolean
convertDefaultTolerance
constconvertDefaultTolerance: () =>number=wasm.brep_convert_default_tolerance
The default recognition band both elementary conversions take.
Returns
number
convertEdgesToElementary
constconvertEdgesToElementary: (json,tolerance) =>string=wasm.brep_convert_edges_to_elementary
The same for nurbs EDGE carriers.
Parameters
json
string
tolerance
number
Returns
string
convertToBspline
constconvertToBspline: (json) =>string=wasm.brep_convert_to_bspline
Convert every analytic face and edge carrier to an equivalent nurbs (B-spline) carrier. Returns the count of converted entities.
Parameters
json
string
Returns
string
convertToElementary
constconvertToElementary: (json,tolerance) =>string=wasm.brep_convert_to_elementary
Recognize nurbs FACE carriers that are exactly an analytic primitive and convert them back within tolerance. Returns the count converted.
Parameters
json
string
tolerance
number
Returns
string
cornerChamfer
constcornerChamfer: (json,vertex_index,distance) =>string=wasm.brep_corner_chamfer
Solid.cornerChamfer(vertex, distance) — the corner-cut solid, as a fresh handle. The vertex index is the one [brep_corner_fillet] documents.
Parameters
json
string
vertex_index
number
distance
number
Returns
string
cornerFillet
constcornerFillet: (json,vertex_index,radius,sphere_center_mode) =>string=wasm.brep_corner_fillet
Solid.cornerFillet(vertex, radius, options?) — the corner-rounded solid, as a fresh handle.
The vertex is an INDEX into solid.vertices(), the order brep_vertex_positions flattens, so a caller reads the positions, picks the corner it wants, and hands the index back — the same convention [brep_fillet] uses for edges.
sphere_center_mode is the TypeScript's options.sphereCenter, whose two spellings are its whole domain: 0 = edge-tangent (the TS default), 1 = face-tangent. A string cannot cross the boundary as cheaply as the discriminant, and an unknown value is rejected rather than defaulted.
Parameters
json
string
vertex_index
number
radius
number
sphere_center_mode
number
Returns
string
cornerFilletSetback
constcornerFilletSetback: (json,vertex_index,radius,sphere_center_mode,setback) =>string=wasm.brep_corner_fillet_setback
Solid.cornerFillet with an explicit contact setback smaller than the default radius-derived distance. Same vertex index and sphere-centre mode as [brep_corner_fillet].
Parameters
json
string
vertex_index
number
radius
number
sphere_center_mode
number
setback
number
Returns
string
crossSection
constcrossSection: (json,first_face,second_face,seed_region) =>Float64Array=wasm.brep_cross_section
The six-pair section dispatcher (cross::surface_cross) between two faces of one solid, so the parity suite can drive the whole intersection stack.
Returns a flat packet: [branchCount, contactCount, then per branch: kind,
closed, t0, t1, and eleven sampled 3D points at even fractions of the range,
then per contact: x, y, z]. kind is the CrossLineKind ordinal (0 line, 1 circle, 2 ellipse, 3 parabola, 4 hyperbola, 5 nurbs).
Parameters
json
string
first_face
number
second_face
number
seed_region
Float64Array
Returns
Float64Array
crossSectionCurves
constcrossSectionCurves: (json,first_face,second_face,seed_region) =>string=wasm.brep_cross_section_curves
The three-path section between two faces of a registered solid, as CURVES.
Same dispatcher and same seed region as brep_cross_section; the difference is only what crosses. Returns a JSON array of {kind, closed, curveJson, t0, t1}, one entry per branch, in the intersector's own order. Isolated contact POINTS are not in this array — they are not curves — and brep_cross_section still reports them.
Parameters
json
string
first_face
number
second_face
number
seed_region
Float64Array
Returns
string
cylinder
constcylinder: (radius,height) =>string=wasm.brep_cylinder
Parameters
radius
number
height
number
Returns
string
distanceTo
constdistanceTo: (json,x,y,z) =>Float64Array=wasm.brep_distance_to
[distance, queryX, queryY, queryZ, boundaryX, boundaryY, boundaryZ] — pointOnA is the query itself, pointOnB the closest boundary point.
Parameters
json
string
x
number
y
number
z
number
Returns
Float64Array
divideClosedFaces
constdivideClosedFaces: (json) =>string=wasm.brep_divide_closed_faces
Cut U-periodic faces that belt the period (ShapeUpgrade_ClosedFaceDivide). Returns the divided-face count.
Parameters
json
string
Returns
string
draftFaces
constdraftFaces: (json,face_indices,pull_x,pull_y,pull_z,angle,neutral_x,neutral_y,neutral_z) =>string=wasm.brep_draft_faces
Taper the selected PLANAR faces by angle radians about the neutral plane through neutral_* with normal pull_*. Returns a fresh handle.
Parameters
json
string
face_indices
Uint32Array
pull_x
number
pull_y
number
pull_z
number
angle
number
neutral_x
number
neutral_y
number
neutral_z
number
Returns
string
edgeForms
constedgeForms: (json) =>string=wasm.brep_edge_forms
The analytic form tag of each edge's carrier, in edge order.
Parameters
json
string
Returns
string
edgeFormsJson
constedgeFormsJson: (json) =>string=wasm.brep_edge_forms_json
The exact analytic descriptor of every EDGE carrier, as a JSON array in edge order — one CurveJson row per edge, null where the carrier holds no form (or holds a parabola/hyperbola, which the wire enum does not name).
Parameters
json
string
Returns
string
edgeInteriorPointsJson
constedgeInteriorPointsJson: (json) =>string=wasm.brep_edge_interior_points_json
Parametric midpoint of every edge, as a JSON array of [x, y, z] in edge order. The point an exact-B-Rep writer uses to pick which of the two arcs between an edge's endpoints the edge traces. Whole-solid so that writer never pairs [brep_edge_range] + [brep_edge_value] per edge.
Parameters
json
string
Returns
string
edgeRange
constedgeRange: (json,edge_index) =>Float64Array=wasm.brep_edge_range
curve.range() of one edge.
Parameters
json
string
edge_index
number
Returns
Float64Array
edgeRangesJson
constedgeRangesJson: (json) =>string=wasm.brep_edge_ranges_json
Every edge's curve.range() as a JSON array in edge order — one [t0, t1] per edge. Whole-solid, same shape as [super::forms::brep_edge_forms_json]: a writer that walks every edge must not call [brep_edge_range] inside that loop (each call re-parses the document).
Parameters
json
string
Returns
string
edgeToFaceMap
constedgeToFaceMap: (json) =>Uint32Array=wasm.brep_edge_to_face_map
Run-length packing of Map<Edge, Face[]>: [edgeIndex, faceCount,
faceIndex…] repeated, edges ascending. A two-manifold solid gives a faceCount of 2 for every edge.
Parameters
json
string
Returns
Uint32Array
edgeValue
constedgeValue: (json,edge_index,t) =>Float64Array=wasm.brep_edge_value
curve.value(t) of one edge, indexed in the solid's edge order. t is the carrier's OWN parameter — the knot domain for a form carrier, [0, 1] for a plain nurbs.
Parameters
json
string
edge_index
number
t
number
Returns
Float64Array
entityCounts
constentityCounts: (json) =>Uint32Array=wasm.brep_entity_counts
[vertices, edges, loops, faces, shells] reachable from the solid — the entity counts a parity test compares exactly.
Parameters
json
string
Returns
Uint32Array
eulerCharacteristic
consteulerCharacteristic: (json) =>number=wasm.brep_euler_characteristic
Genus-correct Euler characteristic V − E + F − R.
Parameters
json
string
Returns
number
extrude
constextrude: (outer,holes_json,dx,dy,dz) =>string=wasm.brep_extrude
Extrude a planar profile polygon along a direction vector, whose LENGTH is the extrusion height. Holes in the profile become through-holes.
Parameters
outer
Float64Array
holes_json
string
dx
number
dy
number
dz
number
Returns
string
extrudeProfile
constextrudeProfile: (profile_json,holes_json,dx,dy,dz) =>string=wasm.brep_extrude_profile
Extrude a planar profile bounded by CURVES along a direction vector, whose LENGTH is the extrusion height. Holes in the profile become through-holes.
profile_json is the outer boundary ring — a JSON array of NurbsCurve documents in traversal order, one per boundary edge (a circle is a one-element ring). holes_json is a JSON array of such rings, or empty.
Parameters
profile_json
string
holes_json
string
dx
number
dy
number
dz
number
Returns
string
faceArea
constfaceArea: (json,face_index,eps) =>number=wasm.brep_face_area
Area of ONE face, indexed in the solid's face order (solid.faces(), the order brep_face_value and brep_face_forms already use). Summing this over every face reproduces [brep_surface_area] exactly — it is the same term.
Parameters
json
string
face_index
number
eps
number
Returns
number
faceCentroid
constfaceCentroid: (json,face_index) =>Float64Array=wasm.brep_face_centroid
[x, y, z] — the AREA centroid of one face, (1/A)·∫ x dA over its trimmed domain. Holes subtract, so an annular cap reports the centroid of the material it actually covers.
The tessellation deflection for the one rule that needs a mesh (a face whose uv boundary will not close) is the solid's own [brep_measurement_deflection], not a caller knob: the same face measured through brep_center_of_mass uses that value, and the two must not disagree.
Parameters
json
string
face_index
number
Returns
Float64Array
faceContainsPoint
constfaceContainsPoint: (json,face_index,x,y,z,tolerance,include_boundary) =>boolean=wasm.brep_face_contains_point
True when the point lies on the trimmed face: within tolerance of the face's CARRIER and inside its trim. include_boundary decides the trim boundary itself; the carrier band is always tolerance, since a point off the surface is not on the face under any reading.
Parameters
json
string
face_index
number
x
number
y
number
z
number
tolerance
number
include_boundary
boolean
Returns
boolean
faceDomain
constfaceDomain: (json,face_index) =>Float64Array=wasm.brep_face_domain
[uMin, uMax, vMin, vMax] of one face's carrier — the domain its own value is defined over, which a probe has to stay inside.
Parameters
json
string
face_index
number
Returns
Float64Array
faceForms
constfaceForms: (json) =>string=wasm.brep_face_forms
The analytic form tag of each face's carrier, as a JSON array of names ("plane" / "cylinder" / "cone" / "sphere" / "torus" / "none"), in face order. This is the recognition METADATA, not a dispatch key: evaluation stays generic NURBS eval on both sides.
Parameters
json
string
Returns
string
faceFormsJson
constfaceFormsJson: (json) =>string=wasm.brep_face_forms_json
The exact analytic descriptor of every FACE carrier, as a JSON array in face order — one SurfaceJson row per face, null where the carrier holds no form.
This is what an exact-B-Rep writer needs and does not give: the kind string alone leaves a STEP writer emitting B_SPLINE_SURFACE_WITH_KNOTS for everything, where the descriptor lets it emit CYLINDRICAL_SURFACE with the true axis and radius. Whole-solid rather than per-index, since a writer walks every face anyway.
Parameters
json
string
Returns
string
faceFromLoop
constfaceFromLoop: (points,holes_json,tolerance) =>string=wasm.brep_face_from_loop
Face.fromLoop with INNER LOOPS — the exact constructor, and the only path here that will take holes without touching them.
Face.fromLoop (topo/Face.ts) does two things and no more: it fits the supporting plane from the OUTER loop by Newell, and it hands surface and loop to the Face constructor (topo/Face.ts), which stores innerLoops verbatim. So this export does not clean the rings, does not re-wind them, does not check them coplanar and does not check that a hole nests inside the boundary — the caller's points ARE the loops, and a caller that wants those checks wants [brep_face_planar_with_holes] instead.
It also reproduces Face.fromLoop's FRAME, which is the other half of the difference from the holes path: the plane comes from Store::face_planar, so the uv origin sits at the core Plane's canonical origin (the plane point nearest the world origin) rather than at the first boundary point, and no uv_curves are recorded at all. See [brep_face_planar], which spells out what a caller sampling brep_shell_face_value sees when those two are confused.
holes_json is a JSON array of flat [x, y, z, ...] arrays, the same wire shape every other loop argument here takes.
Parameters
points
Float64Array
holes_json
string
tolerance
number
Returns
string
faceFromSurface
constfaceFromSurface: (surface_json,bounds,reversed,tolerance) =>string=wasm.brep_face_from_surface
Face.fromSurface — a face on a general (nurbs or form-tagged) surface carrier, over its natural bounds.
This is the NATURAL-BOUNDS spelling — the whole of OCCT MakeFace(surface, UMin, UMax, VMin, VMax). For the TypeScript's caller-supplied boundary loops see [brep_face_from_surface_with_loops], which carries them as the points the rest of this boundary already spells a loop in.
bounds is [uMin, uMax, vMin, vMax], or empty for the surface's own domain.
Parameters
surface_json
string
bounds
Float64Array
reversed
boolean
tolerance
number
Returns
string
faceFromSurfaceWithLoops
constfaceFromSurfaceWithLoops: (surface_json,loops_json,reversed,tolerance) =>string=wasm.brep_face_from_surface_with_loops
Face.fromSurface(surface, loops) — a face on a general surface carrier BOUNDED by caller-supplied loops, loops_json being [outer, ...holes] as a JSON array of flat [x, y, z, ...] rings.
That wire shape is the one every loop on this boundary already takes (brep_face_planar_with_holes, both split_by_loops): a loop gets no handle because both of Loop's factories build the same closed chain of straight edges through a point list, so the points ARE the loop. It also collapses the TypeScript's Loop[] | { outer, holes? } union, which is two spellings of one list whose first element is the outer loop.
Every loop vertex must lie on the surface within max(tolerance, 1e-6); make_face_from_surface refuses one that does not, rather than projecting it silently. An EMPTY list is refused here too — that is [brep_face_from_surface]'s construction, and answering it from this export would make one call mean two different faces.
Parameters
surface_json
string
loops_json
string
reversed
boolean
tolerance
number
Returns
string
faceLoopPoints
constfaceLoopPoints: (json) =>string=wasm.brep_face_loop_points
The outer-loop boundary points of every face, as JSON [[[x, y, z], ...], ...] indexed the same way every export in this file selects faces.
Selection is geometric: a caller picks "the four walls" or "the pocket's floor" by measuring, and the existing boundary can only be read one vertex table at a time, which does not say which face a vertex belongs to. This is the smallest reader that makes an index selection derivable, and it is JSON for the reason the rest of the structural summaries are: the shape is ragged (a face has as many boundary points as it has edges) and small.
Parameters
json
string
Returns
string
faceModifyShape
constfaceModifyShape: (json,face_index,constraints_json) =>string=wasm.brep_face_modify_shape
Face.modifyShape — Hu et al. shape modification on a FREEFORM face, under the geometric constraints in constraints_json. Answers a one-face shell handle; the source is not touched.
constraints_json is the ShapeModifyOptions record: { "method": "controlNet" | "energy",
"points": [{ "u": .., "v": .., "target": [x, y, z], "normal": [x, y, z] }],
"isoCurves": [{ "direction": "u" | "v", "parameter": .., "curve": { .. } }],
"energyRegularization": .. }.
DIVERGENCE (an argument that does nothing). The TypeScript option record also carries energySamplesPerSpan, and it is INERT there: assembleEnergyMatrix clamps it, slices the Gauss node and weight tables to that length, and then integrates with the full six-point rule anyway — its own comment says "use all 6 always for accuracy". It is therefore absent from this record rather than accepted and ignored.
Parameters
json
string
face_index
number
constraints_json
string
Returns
string
faceOffset
constfaceOffset: (json,face_index,distance,tolerance) =>string=wasm.brep_face_offset
Face.offset — the face-level surface offset. Answers a one-face shell handle.
Parameters
json
string
face_index
number
distance
number
tolerance
number
Returns
string
faceOutwardNormal
constfaceOutwardNormal: (json,face_index,u,v) =>Float64Array=wasm.brep_face_outward_normal
The face's OUTWARD normal at (u, v) — the surface normal flipped when the face's reversed flag says its intended outward normal opposes the surface's natural one.
Parameters
json
string
face_index
number
u
number
v
number
Returns
Float64Array
facePlanar
constfacePlanar: (points,tolerance) =>string=wasm.brep_face_planar
A planar face on the plane its own boundary fits.
This one export is Face.planar AND Face.fromLoop(Loop.fromPolygon(...)), which the TypeScript defines as each other. The supporting plane is fitted from the boundary by Newell, so the outward normal follows the CALLER'S POINT ORDER — reverse the points and the face faces the other way. That is deliberate and is why brep_shell_from_faces re-orients what it sews.
It is Store::face_planar and NOT make_planar_face, which are two different functions on both sides and disagree about one thing a caller can see: where the carrier's uv ORIGIN sits. Face.planar pins it at the core Plane's own canonical origin (the plane point nearest the world origin), while makePlanarFace — the holes path below — pins it at the first boundary point. They also disagree about a SECOND, bigger thing: this path records NO uv_curves at all (faithful — TS Face.fromLoop adds none, topo/Face.ts), while the holes path records one linear uv_curve per boundary edge. So "self-consistent with the uv_curves they record" is true only vacuously here: a caller reading a uv boundary off a brep_face_planar face gets nothing. A caller sampling brep_shell_face_value also sees the origin difference — routing this export through the holes path once put Face.rectangle(4, 3)'s uv origin 2.5 units off the TypeScript's.
Parameters
points
Float64Array
tolerance
number
Returns
string
facePlanarWithHoles
constfacePlanarWithHoles: (points,holes_json,tolerance) =>string=wasm.brep_face_planar_with_holes
A planar face with hole loops — the makePlanarFace path, whose extra work over [brep_face_planar] is exactly what holes need: the loops are cleaned, checked coplanar, re-wound (outer counter-clockwise about the outward normal, holes clockwise) and checked to nest. holes_json is a JSON array of flat [x, y, z, ...] arrays.
Parameters
points
Float64Array
holes_json
string
tolerance
number
Returns
string
faceProject
constfaceProject: (json,face_index,x,y,z) =>Float64Array=wasm.brep_face_project
surface.project(point) of one face — the carrier's own inverse. Pairs with [brep_face_value] for the round-trip a form tag has to satisfy: a form whose axis points the wrong way describes the same point set with its parameters mirrored, so value and project disagree while every cross-side comparison still passes.
Parameters
json
string
face_index
number
x
number
y
number
z
number
Returns
Float64Array
faceRectangle
constfaceRectangle: (width,height,tolerance) =>string=wasm.brep_face_rectangle
A rectangular planar face on the XY plane centred at the origin, width along x and height along y, outward normal +Z.
Parameters
width
number
height
number
tolerance
number
Returns
string
faceSplitByLoops
constfaceSplitByLoops: (json,loops_json,tolerance) =>string=wasm.brep_face_split_by_loops
Split the ONE face of a shell handle by cutting loops that lie on its surface, returning the pieces as a new shell handle. Closed loops cut regions; open loops running boundary to boundary walk the face into pieces.
Parameters
json
string
loops_json
string
tolerance
number
Returns
string
faceSummary
constfaceSummary: (json) =>Uint32Array=wasm.brep_face_summary
Per-face [reversed, loopCount, edgeCount], flattened in face order.
Parameters
json
string
Returns
Uint32Array
faceThicken
constfaceThicken: (json,face_index,thickness,symmetric) =>string=wasm.brep_face_thicken
Face.thicken — extrude a face along its own outward normal into a slab. Answers a SOLID handle, since the result is a solid.
Parameters
json
string
face_index
number
thickness
number
symmetric
boolean
Returns
string
faceTrim
constfaceTrim: (json,face_index,tool_json,tool_face_index,side) =>string=wasm.brep_face_trim
Face.trim — keep the part of a face inside a co-surface tool face (side == true) or cut the tool out of it (side == false). Both operands are one-face shell handles; the result is a shell of the surviving pieces.
Parameters
json
string
face_index
number
tool_json
string
tool_face_index
number
side
boolean
Returns
string
faceTrimByLoop
constfaceTrimByLoop: (json,face_index,loop_points,side,tolerance) =>string=wasm.brep_face_trim_by_loop
Face.trim with a LOOP tool — the TypeScript's tool instanceof Face test taking its other alternative, where a closed loop lying on the face's own surface becomes the tool face.
DIVERGENCE (spelling). TS carries the two tools as one Face | Loop union argument; a boundary has no union, so each alternative is its own export. loop_points is one flat [x, y, z, ...] ring, the shape brep_face_planar takes, closed implicitly.
The loop is materialized at tolerance and then turned into a tool face at the SUBJECT's own tolerance, which is what trimFace does when it calls loopAsFaceOnSurface(tool, face.surface, face.tolerance).
Parameters
json
string
face_index
number
loop_points
Float64Array
side
boolean
tolerance
number
Returns
string
faceValue
constfaceValue: (json,face_index,u,v) =>Float64Array=wasm.brep_face_value
surface.value(u, v) of one face, indexed in the solid's face order.
Parameters
json
string
face_index
number
u
number
v
number
Returns
Float64Array
fillet
constfillet: (json,edge_indices,law_kind,law_params) =>string=wasm.brep_fillet
Solid.fillet(edges, radius) — the filleted solid, as a fresh handle.
CONTRACT (changed): an edge that does not blend is an ERROR here, and the message names every such edge. It used to come back as the original solid with the reasons in a report this function dropped, so "the fillet did nothing" and "the shape needed no change" were the same answer. Use [brep_fillet_report_json] for the per-edge outcome of a partial run.
Parameters
json
string
edge_indices
Uint32Array
law_kind
number
law_params
Float64Array
Returns
string
filletReportJson
constfilletReportJson: (json,edge_indices,law_kind,law_params) =>string=wasm.brep_fillet_report_json
Solid.filletReport(edges, radius) — the counts and the per-edge outcome, as JSON. The solid itself is NOT registered here; call [brep_fillet] for that.
Parameters
json
string
edge_indices
Uint32Array
law_kind
number
law_params
Float64Array
Returns
string
filterCircularEdges
constfilterCircularEdges: (json) =>Uint32Array=wasm.brep_filter_circular_edges
Edge indices whose carrier is a full circle.
Parameters
json
string
Returns
Uint32Array
filterConcaveEdges
constfilterConcaveEdges: (json) =>Uint32Array=wasm.brep_filter_concave_edges
Manifold edge indices whose oriented dihedral is a concave crease.
Parameters
json
string
Returns
Uint32Array
filterConvexEdges
constfilterConvexEdges: (json) =>Uint32Array=wasm.brep_filter_convex_edges
Manifold edge indices whose oriented dihedral is a convex crease.
Parameters
json
string
Returns
Uint32Array
filterLinearEdges
constfilterLinearEdges: (json) =>Uint32Array=wasm.brep_filter_linear_edges
Edge indices whose carrier is a straight line segment.
Parameters
json
string
Returns
Uint32Array
fix
constfix: (json,config) =>Float64Array=wasm.brep_fix
Run the shape-fix hierarchy in place. config is the JSON of a partial FixConfig ({} for the defaults, {"fixOrientation":"on"} to force one), which is what the TypeScript's Partial<FixConfig> argument is. Returns [status, actionsApplied].
Every advertised On/Auto flag runs the matching OCCT-named repair, or errors. Nine flags default to off. Degenerated / Reversed2d / AddCurve3d / Shifted run as OCCT FixEdgeCurves + FixDegenerated defaults (auto). LoopWire / SplitFace / PeriodicDegenerated default auto (Face::Perform).
Parameters
json
string
config
string
Returns
Float64Array
fixSplitCommonVertex
constfixSplitCommonVertex: (json) =>string=wasm.brep_fix_split_common_vertex
Split vertices shared by non-adjacent edge fans, returning the split count.
Parameters
json
string
Returns
string
fixWireframe
constfixWireframe: (json,tolerance) =>string=wasm.brep_fix_wireframe
Fix wireframe gaps below tolerance, returning the sewn pair count.
Parameters
json
string
tolerance
number
Returns
string
freeEdgeCount
constfreeEdgeCount: (json) =>number=wasm.brep_free_edge_count
Free (singly-bordered) edges of the solid's OUTER shell — the edge-use census Solid.outerShell.manifoldReport().freeEdges reports, and 0 exactly when that shell sews watertight.
The TypeScript callers all read this count through .freeEdges.filter((edge) => !edge.degenerate), and the filter is not repeated here because [crate::brep::topo::arena::Store::shell_manifold_report] already exempts degenerate edges at the source: a pole row or a cone apex is a whole parameter range squeezed onto one point, appears once in its face's loop, and bounds nothing.
Parameters
json
string
Returns
number
gridPattern
constgridPattern: (json,x_axis,y_axis,spacing_x,spacing_y,count_x,count_y) =>string=wasm.brep_grid_pattern
Parameters
json
string
x_axis
Float64Array
y_axis
Float64Array
spacing_x
number
spacing_y
number
count_x
number
count_y
number
Returns
string
helix
consthelix: (outer,holes_json,radius,pitch,turns,clockwise,origin,axis,segments_per_turn) =>string=wasm.brep_helix
Sweep a planar profile polygon along a helix.
Parameters
outer
Float64Array
holes_json
string
radius
number
pitch
number
turns
number
clockwise
boolean
origin
Float64Array
axis
Float64Array
segments_per_turn
number
Returns
string
imprint
constimprint: (json_a,json_b) =>string=wasm.brep_imprint
Imprint B's intersection trace onto A's faces, registering the result under a NEW handle and leaving both inputs valid.
The material is unchanged — same volume, same orientation — and only the face and edge structure is finer, so a caller can select or offset the sub-region B marks out. B is a stencil: it is never split and none of its faces survive. The operands are brought into one arena exactly as [boolean] does.
Parameters
json_a
string
json_b
string
Returns
string
intersect
constintersect: (json_a,json_b) =>string=wasm.brep_boolean_intersect
Intersection (A n B): only the material common to both solids.
Parameters
json_a
string
json_b
string
Returns
string
isClosed
constisClosed: (json) =>boolean=wasm.brep_is_closed
Whether every shell of the document is a closed two-manifold.
Accepts a solid document, a one-shell open document (Unit H face-delete result), or a multi-shell open document (e.g. splitByPlane halves that fail solid role derivation): open sheets report false without requiring solid roles. Multi-shell open docs used to error on the single-shell fallback (Shell.fromJSON expects one shell, this document holds N).
Parameters
json
string
Returns
boolean
isValidCheap
constisValidCheap: (json) =>boolean=wasm.brep_is_valid_cheap
True when every shell of the solid is closed — the O(edges) validity screen Solid.isValidCheap runs before the geometric validate report.
Parameters
json
string
Returns
boolean
linearPattern
constlinearPattern: (json,dx,dy,dz,spacing,count) =>string=wasm.brep_linear_pattern
Parameters
json
string
dx
number
dy
number
dz
number
spacing
number
count
number
Returns
string
loft
constloft: (profiles_json,ruled,closed) =>string=wasm.brep_loft
Loft a stack of planar profile polygons into a solid.
profiles_json is a JSON array of point rings ([[[x, y, z], ...], ...]) — the profiles cross as polygons for the same reason a swept profile does. The bands are typed analytically per pair, so coaxial circular sections come back carrying a cylinder or cone rather than a generic ruled patch.
Parameters
profiles_json
string
ruled
boolean
closed
boolean
Returns
string
loopRegularPolygon
constloopRegularPolygon: (radius,sides) =>Float64Array=wasm.brep_loop_regular_polygon
The points of a regular polygon on the XY plane centred at the origin, first at (radius, 0, 0) and winding counter-clockwise seen from +Z.
A LOOP does not get a handle, because at this boundary it has nothing a handle would carry: both of Loop's factories build the same thing — a closed chain of straight edges through a point list — so the points ARE the loop, and every consumer here (brep_face_planar, the two split_by_loops) takes them as points and materializes the chain in the store it is working in. Loop.fromPolygon is therefore the identity on this side.
Parameters
radius
number
sides
number
Returns
Float64Array
massProperties
constmassProperties: (json,eps) =>Float64Array=wasm.brep_mass_properties
[volume, surfaceArea, comX, comY, comZ, i00, i01, i02, i10, i11, i12, i20,
i21, i22] — the tensor in ROW order, matching the TS [[Ixx, -Ixy, -Ixz], [-Ixy, Iyy, -Iyz], [-Ixz, -Iyz, Izz]] layout.
Parameters
json
string
eps
number
Returns
Float64Array
measurementDefaultEps
constmeasurementDefaultEps: () =>number=wasm.brep_measurement_default_eps
The relative stopping band Solid.volume / surfaceArea use when their caller passes no eps — DEFAULT_MEASUREMENT_EPS.
Returns
number
measurementDeflection
constmeasurementDeflection: (json) =>number=wasm.brep_measurement_deflection
Parameters
json
string
Returns
number
mirror
constmirror: (json,normal_x,normal_y,normal_z,point_x,point_y,point_z) =>string=wasm.brep_mirror
Parameters
json
string
normal_x
number
normal_y
number
normal_z
number
point_x
number
point_y
number
point_z
number
Returns
string
normalizeEdgeParameterFlags
constnormalizeEdgeParameterFlags: (json) =>string=wasm.brep_normalize_edge_parameter_flags
Recompute every edge's degenerate / sameParameter / sameRange flags from the geometry. Returns the number of edges whose flags changed.
Parameters
json
string
Returns
string
offset
constoffset: (json,distance) =>string=wasm.brep_offset
Offset every face by distance — positive outward, negative inward.
Parameters
json
string
distance
number
Returns
string
outerShellDocument
constouterShellDocument: (json) =>string=wasm.brep_outer_shell_document
Hand a registered SOLID's OUTER shell out as its own one-shell version-2 document — the same BrepJson [brep_shell_load] reads.
The role is READ, not re-derived: Solid stores outer_shell separately from void_shells (topo/arena.rs), and classify_shells_to_bodies is what sorted them there by containment and winding.
This is what parashape's explode walk needs to reach a solid's boundary as a Shell handle without going through Shell.fromJSON on the TypeScript side (packages/parametric/src/domains/brepFace.ts).
Parameters
json
string
Returns
string
pipe
constpipe: (outer,holes_json,path_json,guide_json) =>string=wasm.brep_pipe
Pipe a planar profile polygon along a NURBS path, scaling the section by an optional guide rail (an empty guide_json means no guide).
Parameters
outer
Float64Array
holes_json
string
path_json
string
guide_json
string
Returns
string
pullFace
constpullFace: (json,face_index,distance) =>string=wasm.brep_pull_face
Slide the selected face along its own outward normal by distance, sliding each boundary vertex along a foreign incident edge so the neighbourhood stays valid. Returns a fresh handle.
DIVERGENCE (return). The TypeScript mutates the receiver and answers void. Across this boundary the caller's handle names an arena it still owns, so the pull runs on a working COPY and the result is registered — a handle the caller already holds is what "in place" means here, and mutating the registered arena would edit a solid another call may be mid-way through.
Parameters
json
string
face_index
number
distance
number
Returns
string
recognizeHoles
constrecognizeHoles: (json) =>Float64Array=wasm.brep_recognize_holes
Eight doubles per recognized hole: [faceIndex, axisX, axisY, axisZ,
centerX, centerY, centerZ, radius, depth] — nine, and the face index is one because recognizeHoles emits exactly one face per hole.
Parameters
json
string
Returns
Float64Array
removeInternalLoops
constremoveInternalLoops: (json) =>string=wasm.brep_remove_internal_loops
Strip every inner (hole) loop from every face. Returns the removed count.
Parameters
json
string
Returns
string
restrictionDefaultOptions
constrestrictionDefaultOptions: () =>Float64Array=wasm.brep_restriction_default_options
[maxDegree, maxSegments, tolerance].
Returns
Float64Array
reverse
constreverse: (json) =>string=wasm.brep_reverse
Parameters
json
string
Returns
string
revolve
constrevolve: (outer,holes_json,axis_point,axis_direction,angle) =>string=wasm.brep_revolve
Revolve a planar profile polygon about an axis. angle is in radians and must lie in (0, 2pi].
Parameters
outer
Float64Array
holes_json
string
axis_point
Float64Array
axis_direction
Float64Array
angle
number
Returns
string
section
constsection: (json,normal_x,normal_y,normal_z,point_x,point_y,point_z) =>string=wasm.brep_section
The cross-section loops where a cutting plane meets a registered solid, as JSON: one object per loop with its edge count, the form-tag name of each edge's carrier, the loop's vertex positions, and — for a loop the analytic upgrade collapsed to ONE conic edge — that conic's radius or semi-axes.
The conic parameters are the point of reporting more than positions: a perpendicular cylinder cut must come back as an exact circle of the cylinder's own radius, and a chord polyline through the same vertices is indistinguishable from it by position alone.
Parameters
json
string
normal_x
number
normal_y
number
normal_z
number
point_x
number
point_y
number
point_z
number
Returns
string
sew
constsew: (json,tolerance) =>string=wasm.brep_sew_shells
Stitch coincident free-edge pairs of the outer shell. A non-finite tolerance means "not supplied", so the band defaults to the shell's own tolerance reach — which is what sewShells(undefined) does in TypeScript.
Parameters
json
string
tolerance
number
Returns
string
signedVolume
constsignedVolume: (json,eps) =>number=wasm.brep_signed_volume
Parameters
json
string
eps
number
Returns
number
solidEntityCounts
constsolidEntityCounts: (json) =>Uint32Array=wasm.brep_solid_entity_counts
[faces, edges, vertices].
Parameters
json
string
Returns
Uint32Array
sphere
constsphere: (radius) =>string=wasm.brep_sphere
Parameters
radius
number
Returns
string
splitByPlane
constsplitByPlane: (json,normal_x,normal_y,normal_z,point_x,point_y,point_z) =>string=wasm.brep_split_by_plane
Split a registered solid by a cutting plane, returning [aboveHandle,
belowHandle] where a 0 means that half is empty — the plane missed the solid entirely and the whole solid is on the other side.
The TypeScript's splitByPlane wrapper additionally packages the cut boundaries into a Path2d in the plane's own frame. That is a repackaging of the section loops [brep_section] already returns, in a 2D type the registry has no handle for, so the boundary exposes the geometric operation and leaves the packaging to the caller.
Parameters
json
string
normal_x
number
normal_y
number
normal_z
number
point_x
number
point_y
number
point_z
number
Returns
string
splitC0BsplineEdges
constsplitC0BsplineEdges: (json) =>string=wasm.brep_split_c0_bspline_edges
Split C0 NURBS edges at full-multiplicity interior knots (ShapeUpgrade::C0BSplineToSequenceOfC1BSplineCurve). Returns the split count.
Parameters
json
string
Returns
string
splitSelfIntersectingInnerLoops
constsplitSelfIntersectingInnerLoops: (json) =>string=wasm.brep_split_self_intersecting_inner_loops
Partition figure-eight inner loops into simple sub-cycles. Returns the number of inner loops replaced.
Parameters
json
string
Returns
string
subtract
constsubtract: (json_a,json_b) =>string=wasm.brep_boolean_subtract
Difference (A - B): the material of A with B's material carved away.
Parameters
json_a
string
json_b
string
Returns
string
surfaceArea
constsurfaceArea: (json,eps) =>number=wasm.brep_surface_area
Parameters
json
string
eps
number
Returns
number
surfaceCross
constsurfaceCross: (first_json,second_json,seed_region) =>string=wasm.brep_surface_cross
Intersect two surfaces, returning every section branch with its 3D carrier and its uv image on each operand.
This is the whole taxonomy in one call — plane x plane's closed form, the plane x anything scalar reduction, and the general SSI core — because the dispatch between them is the intersector's own and not a caller's choice.
unsupportedReasons is reported rather than thrown: a pair the core declines has an ANSWER (usually no branches, sometimes some), and turning that into an exception would hide the branches it did find.
Parameters
first_json
string
second_json
string
seed_region
Float64Array
Returns
string
surfaceCrossCurves
constsurfaceCrossCurves: (first_json,second_json,seed_region) =>string=wasm.brep_surface_cross_curves
The standalone surface pair as CURVES — brep_surface_cross without a solid to hold, and without the uv_curves a caller building topology needs.
Parameters
first_json
string
second_json
string
seed_region
Float64Array
Returns
string
sweep
constsweep: (outer,holes_json,path_json,ruled,segments) =>string=wasm.brep_sweep
Sweep a planar profile polygon along a NURBS path.
ruled skins the walls with flat quads; clearing it gives one interpolated NURBS surface per profile edge. segments of 0 lets the path's own curvature pick the station count.
Parameters
outer
Float64Array
holes_json
string
path_json
string
ruled
boolean
segments
number
Returns
string
sweepProfile
constsweepProfile: (profile_json,holes_json,path_json,ruled,segments) =>string=wasm.brep_sweep_profile
Sweep a planar profile bounded by CURVES along a NURBS path.
Rings are described exactly as [brep_extrude_profile] takes them; ruled and segments mean what they do on .
Parameters
profile_json
string
holes_json
string
path_json
string
ruled
boolean
segments
number
Returns
string
thickOffset
constthickOffset: (json,distance,excluded_face_indices) =>string=wasm.brep_thick_offset
Hollow the solid. Negative distance offsets inward (a cup); positive offsets outward (a jacket around the original). Selected faces stay where they are so the opening goes through them.
Parameters
json
string
distance
number
excluded_face_indices
Uint32Array
Returns
string
torus
consttorus: (major_radius,minor_radius) =>string=wasm.brep_torus
Parameters
major_radius
number
minor_radius
number
Returns
string
transform
consttransform: (json,matrix) =>string=wasm.brep_transform
Apply an affine 4x4 (column-major, Transformation.elements order) to a registered solid, returning a NEW handle. Solid.transform mutates in place and returns this; a handle boundary has no "this" to return, so the caller gets a fresh handle and frees the old one when it is done with it.
Parameters
json
string
matrix
Float64Array
Returns
string
translate
consttranslate: (json,dx,dy,dz) =>string=wasm.brep_translate
Parameters
json
string
dx
number
dy
number
dz
number
Returns
string
unifyDefaultOptions
constunifyDefaultOptions: () =>Float64Array=wasm.brep_unify_default_options
The UnifyOptions defaults, as [unifyFaces, unifyEdges, linearTolerance,
angularTolerance] with the two flags as 0/1.
Returns
Float64Array
unifySameDomain
constunifySameDomain: (json,unify_faces,unify_edges,linear_tolerance,angular_tolerance) =>string=wasm.brep_unify_same_domain
Merge adjacent same-surface faces (and, when unify_edges, fuse the collinear runs the merge leaves). Returns the merged count.
Parameters
json
string
unify_faces
boolean
unify_edges
boolean
linear_tolerance
number
angular_tolerance
number
Returns
string
union
constunion: (json_a,json_b) =>string=wasm.brep_boolean_union
Union/// Union (A u B): all material in either solid, with the overlap counted once.
Parameters
json_a
string
json_b
string
Returns
string
validate
constvalidate: (json,tolerance_scale,disabled) =>string=wasm.brep_validate
The full validation report, as JSON.
This is the ONE export in the module that is not flat scalars, and the reason is that a report is genuinely nested and genuinely small: an issue carries a check name, a severity, the entity it points at, a human description and an optional deviation, and a valid solid produces none of them. Packing that into a typed array would need a string table for the descriptions, which is a JSON encoder with extra steps.
disabled is a comma-separated list of CheckId NAMES (the same strings CheckId.name() reports and the TypeScript union spells), so a caller disables checks with the vocabulary it already reads back.
Shape: {"isValid":bool,"eulerCharacteristic":int,"issues":[{"checkId":str,
"severity":str,"entity":{"type":str,"index":int},"description":str,
"deviation":number?}]} — deviation omitted where the check reports none.
Parameters
json
string
tolerance_scale
number
disabled
string
Returns
string
validateOuterShell
constvalidateOuterShell: (json,tolerance_scale,disabled) =>string=wasm.brep_validate_outer_shell
The same report over the solid's OUTER shell alone — the shell-level battery without the four solid-level checks.
Parameters
json
string
tolerance_scale
number
disabled
string
Returns
string
vertexPositions
constvertexPositions: (json) =>Float64Array=wasm.brep_vertex_positions
Every vertex position of the solid, flattened [x, y, z, ...] in vertex order.
Parameters
json
string
Returns
Float64Array
voidShellDocuments
constvoidShellDocuments: (json) =>string=wasm.brep_void_shell_documents
Every VOID (cavity) shell of a registered solid, each as its own one-shell document, in the solid's own void_shells order. A solid with no cavity answers [] — an empty array, not an error, because "no voids" is an answer.
A void shell's faces are wound so their normals point INTO the cavity (topo/classify_shells.rs), and the copy carries that winding, so a reloaded void document probes exactly like the cavity it came from.
Parameters
json
string
Returns
string
volume
constvolume: (json,eps) =>number=wasm.brep_volume
Parameters
json
string
eps
number
Returns
number