Skip to content

Shapemetry API


Shapemetry API / Face

Class: Face

Defined in: nurbsBrep/topo/Face.ts:40

A topological face: a bounded patch of a Surface. The boundary is one outer wire plus any number of inner wires that cut holes. reversed records whether the face's intended outward normal opposes the surface's natural normal, so a single surface can carry either orientation.

Each boundary edge may have an associated parameter-space (uv) curve, owned by the face because a pcurve is meaningless without the surface it lives on. The same Edge appearing on two faces gets two independent pcurves.

Constructors

Constructor

new Face(surface, outerWire, innerWires?, reversed?, naturalBounds?, tolerance?): Face

Defined in: nurbsBrep/topo/Face.ts:89

Parameters

surface

Surface

outerWire

Wire

innerWires?

Wire[] = []

reversed?

boolean = false

naturalBounds?

NaturalBounds

tolerance?

number = 1e-7

Returns

Face

Properties

index

readonly index: number

Defined in: nurbsBrep/topo/Face.ts:41


surface

surface: Surface

Defined in: nurbsBrep/topo/Face.ts:42


outerWire

outerWire: Wire

Defined in: nurbsBrep/topo/Face.ts:43


innerWires

innerWires: Wire[]

Defined in: nurbsBrep/topo/Face.ts:44


reversed

reversed: boolean

Defined in: nurbsBrep/topo/Face.ts:45


pcurves

pcurves: Map<Edge, ParameterCurve>

Defined in: nurbsBrep/topo/Face.ts:46


reversedUsePcurves

reversedUsePcurves: Map<Edge, ParameterCurve>

Defined in: nurbsBrep/topo/Face.ts:52

Second uv image for a closed-surface SEAM edge used twice in one wire (once per u-column): the pcurve its REVERSED use reads. Empty for every ordinary edge. The role of OCCT's second pcurve on a curve-on-closed-surface edge.


tolerance

tolerance: number

Defined in: nurbsBrep/topo/Face.ts:60

The face's own surface-fit tolerance: how far the trimmed surface may sit from the true boundary it represents. Mirrors OCCT's BRep_TFace::myTolerance and is the top of the tolerance nesting face ≥ edge ≥ vertex — a sewing / containment band sized at the face level should never be tighter than any of its edges or vertices. See toleranceReach.


naturalBounds?

optional naturalBounds?: NaturalBounds

Defined in: nurbsBrep/topo/Face.ts:68

Natural parametric restriction for an UNTRIMMED full face (the whole periodic/closed surface domain). Primitive factories set it so the tessellator can grid the full domain directly; faces produced by trimming/boolean leave it undefined and are tessellated from their boundary wires.


tessFromPcurves?

optional tessFromPcurves?: boolean

Defined in: nurbsBrep/topo/Face.ts:78

Set by the boolean's periodic crossing/band arrangement on a sub-face that reuses a closed SECTION circle in its boundary (sphere − two crossing bores). The generic wire tessellator re-projects that closed circle and scrambles its u-row past one period; this flag tells the tessellator to lift the boundary from the face's own seam-windowed pcurves instead. Untouched on every other face, so the normal tessellation paths are unaffected.


tessTorusUBand?

optional tessTorusUBand?: boolean

Defined in: nurbsBrep/topo/Face.ts:87

Set by the boolean on a TORUS u-band (a torus sliced by a tilted plane into bands that wrap the full v-period between two v-wrapping section loops). Such a band has wobbly u-sides (the loops) and wraps v, so neither the natural grid nor the generic CDT meshes it; the tessellator grids it as v × [loopLeft.u(v), loopRight.u(v)] — the u↔v transpose of the u-periodic band path.

Methods

equals()

equals(other): boolean

Defined in: nurbsBrep/topo/Face.ts:109

Identity comparison: two references denote the same face.

Parameters

other

Face

Returns

boolean


toleranceReach()

toleranceReach(): number

Defined in: nurbsBrep/topo/Face.ts:120

The effective tolerance of the face under OCCT's nesting rule face ≥ edge ≥ vertex: the largest of the face's own tolerance and the tolerances of every bounding edge and vertex. Sewing and point-membership bands derive their default width from this so they are never tighter than the loosest entity on the boundary.

Returns

number


fromWire()

static fromWire(wire): Face

Defined in: nurbsBrep/topo/Face.ts:138

Build a planar face bounded by a closed wire. The supporting plane is fitted from the wire's boundary points by Newell's method, and the plane's outward normal points along that fitted normal. Matches brep Face.fromWire.

Parameters

wire

Wire

Returns

Face


planar()

static planar(points, tolerance?): Face

Defined in: nurbsBrep/topo/Face.ts:149

Build a planar face directly from an ordered loop of points (a polygon boundary). Equivalent to Face.fromWire(Wire.fromPolygon(points)). Matches brep Face.planar.

Parameters

points

Point[]

tolerance?

number = 1e-7

Returns

Face


rectangle()

static rectangle(width, height, tolerance?): Face

Defined in: nurbsBrep/topo/Face.ts:158

Build a rectangular planar face on the XY plane centred at the origin, with the given width along x and height along y and an outward normal of +Z. Matches brep Face.rectangle(width, height, tolerance).

Parameters

width

number

height

number

tolerance?

number = 1e-7

Returns

Face


wires()

wires(): Wire[]

Defined in: nurbsBrep/topo/Face.ts:174

Outer wire followed by every inner (hole) wire.

Returns

Wire[]


edges()

edges(): Edge[]

Defined in: nurbsBrep/topo/Face.ts:179

Distinct edges across all boundary wires.

Returns

Edge[]


vertices()

vertices(): Vertex[]

Defined in: nurbsBrep/topo/Face.ts:194

Distinct vertices across all boundary wires.

Returns

Vertex[]


pcurveOn()

pcurveOn(edge): ParameterCurve | undefined

Defined in: nurbsBrep/topo/Face.ts:209

The pcurve recorded for an edge on this face, if any.

Parameters

edge

Edge

Returns

ParameterCurve | undefined


setPcurve()

setPcurve(edge, pcurve): void

Defined in: nurbsBrep/topo/Face.ts:214

Record (or replace) the pcurve of an edge on this face.

Parameters

edge

Edge

pcurve

ParameterCurve

Returns

void


pcurveOnUse()

pcurveOnUse(edge, forward): ParameterCurve | undefined

Defined in: nurbsBrep/topo/Face.ts:227

The pcurve for one ORIENTED USE of an edge on this face. A seam edge of a closed (periodic) surface appears twice in one face wire — once forward at one u-column, once reversed at the column a period away — so it carries TWO uv images (the role of OCCT's second pcurve on a closed-surface edge). The forward use reads the primary pcurve; the reversed use reads the dedicated reversed-use pcurve when one was recorded, else falls back to the primary (every non-seam edge has just the one image).

Parameters

edge

Edge

forward

boolean

Returns

ParameterCurve | undefined


setPcurveForReversedUse()

setPcurveForReversedUse(edge, pcurve): void

Defined in: nurbsBrep/topo/Face.ts:236

Record the pcurve a REVERSED use of a seam edge reads on this face.

Parameters

edge

Edge

pcurve

ParameterCurve

Returns

void


outwardNormalAt()

outwardNormalAt(u, v): Vector

Defined in: nurbsBrep/topo/Face.ts:244

Outward unit normal at a uv pair, flipped when the face orientation opposes the surface's natural normal.

Parameters

u

number

v

number

Returns

Vector


effectivePlaneNormal()

effectivePlaneNormal(): Vector | null

Defined in: nurbsBrep/topo/Face.ts:255

The face's outward normal when it lies on a plane, or null for any curved carrier. The returned vector accounts for reversed, so it points the way the face faces outward. Matches brep Face.effectivePlaneNormal: callers use it to select planar faces by orientation (e.g. the +Z top face of a box).

Returns

Vector | null


thicken()

thicken(thickness, symmetric?): Solid

Defined in: nurbsBrep/topo/Face.ts:267

Thicken this face into a solid slab by extruding it along its own outward normal. A positive thickness extrudes in the normal direction, a negative one in the anti-normal direction; symmetric extrudes by half (the caller combines the two halves). Matches brep Face.thicken.

Parameters

thickness

number

symmetric?

boolean

Returns

Solid


tessellate()

tessellate(deflection?): TriangleMesh

Defined in: nurbsBrep/topo/Face.ts:287

Triangulate just this face to within deflection, returning GPU-friendly flat arrays (positions / indices / normals). Matches brep Face.tessellate. Delegates to the free function tessellateFace.

Parameters

deflection?

number = 0.1

Returns

TriangleMesh


parameterSample()

parameterSample(): [number, number]

Defined in: nurbsBrep/topo/Face.ts:296

A parameter pair safely inside the face's domain, used to sample the normal. Planar faces have a constant normal, so the centre of the natural bounds (or the origin for an untrimmed plane) is sufficient.

Returns

[number, number]