Skip to content

Shapemetry API


Shapemetry API / Wire

Class: Wire

Defined in: nurbsBrep/topo/Wire.ts:38

An ordered, closed chain of oriented edges bounding a region of a face. The end vertex of each oriented edge meets the start vertex of the next, and the last meets the first.

Constructors

Constructor

new Wire(orientedEdges): Wire

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

Parameters

orientedEdges

OrientedEdge[]

Returns

Wire

Properties

index

readonly index: number

Defined in: nurbsBrep/topo/Wire.ts:39


orientedEdges

orientedEdges: OrientedEdge[]

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

Methods

equals()

equals(other): boolean

Defined in: nurbsBrep/topo/Wire.ts:51

Identity comparison: two references denote the same wire.

Parameters

other

Wire

Returns

boolean


fromPolygon()

static fromPolygon(points, tolerance?): Wire

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

Build a closed wire from an ordered loop of points (a polygon). Consecutive points are joined by straight (line) edges, with the last point joined back to the first. Needs at least three points. Matches brep Wire.fromPolygon.

Parameters

points

Point[]

tolerance?

number = 1e-7

Returns

Wire


regularPolygon()

static regularPolygon(radius, sides, tolerance?): Wire

Defined in: nurbsBrep/topo/Wire.ts:75

Build a closed regular-polygon wire on the XY plane centred at the origin. The first vertex sits at (radius, 0, 0) and the loop winds counter-clockwise viewed from +Z. Matches brep Wire.regularPolygon(radius, sides, tolerance).

Parameters

radius

number

sides

number

tolerance?

number = 1e-7

Returns

Wire


edges()

edges(): Edge[]

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

Distinct edges referenced by this wire, in traversal order.

Returns

Edge[]


vertices()

vertices(): Vertex[]

Defined in: nurbsBrep/topo/Wire.ts:100

Distinct vertices visited while walking the loop, in traversal order.

Returns

Vertex[]


validateClosed()

validateClosed(): void

Defined in: nurbsBrep/topo/Wire.ts:117

Verify that consecutive oriented edges share a vertex and that the loop closes back on itself. Throws with the offending index on failure.

Returns

void