Skip to content

Shapemetry API


Shapemetry API / Spline2d

Class: Spline2d

Defined in: curve2d/Spline2d.ts:13

Implements

Constructors

Constructor

new Spline2d(points, degree?): Spline2d

Defined in: curve2d/Spline2d.ts:29

Interpolating, non-rational B-spline through points.

degree is honored end-to-end (toNurbsCurve / pointAt / length / splitAt / reverse / transform / clone all carry it). It is clamped down to points.length - 1 when there are too few points to support the requested degree, mirroring NurbsCurve.spline. Default 3 (cubic) preserves the historical behavior for callers that omit the argument.

Note: Spline2dJSON is a bare point array, so toJSON()/fromJSON() only carry the points; degree is reconstructed at its default on fromJSON.

Parameters

points

Point2d[]

degree?

number = 3

Returns

Spline2d

Properties

points

points: Point2d[]

Defined in: curve2d/Spline2d.ts:14


degree

degree: number

Defined in: curve2d/Spline2d.ts:15

Accessors

start

Get Signature

get start(): Point2d

Defined in: curve2d/Spline2d.ts:37

Returns

Point2d

Implementation of

Curve2d.start


end

Get Signature

get end(): Point2d

Defined in: curve2d/Spline2d.ts:38

Returns

Point2d

Implementation of

Curve2d.end


isClosed

Get Signature

get isClosed(): boolean

Defined in: curve2d/Spline2d.ts:39

Returns

boolean

Implementation of

Curve2d.isClosed

Methods

toJSON()

toJSON(): Spline2dJSON

Defined in: curve2d/Spline2d.ts:34

Returns

Spline2dJSON

Implementation of

Curve2d.toJSON


fromJSON()

static fromJSON(d): Spline2d

Defined in: curve2d/Spline2d.ts:35

Parameters

d

Spline2dJSON

Returns

Spline2d


clone()

clone(): Spline2d

Defined in: curve2d/Spline2d.ts:45

Returns

Spline2d

Implementation of

Curve2d.clone


toNurbsCurve()

toNurbsCurve(): NurbsCurve

Defined in: curve2d/Spline2d.ts:47

Returns

NurbsCurve


length()

length(): number

Defined in: curve2d/Spline2d.ts:51

Returns

number

Implementation of

Curve2d.length


pointAt()

pointAt(t): Point2d

Defined in: curve2d/Spline2d.ts:53

Parameters

t

number

Returns

Point2d

Implementation of

Curve2d.pointAt


tangentAt()

tangentAt(t): Vector2d

Defined in: curve2d/Spline2d.ts:58

Parameters

t

number

Returns

Vector2d

Implementation of

Curve2d.tangentAt


axesAtParam()

axesAtParam(t): Axes2d

Defined in: curve2d/Spline2d.ts:64

Parameters

t

number

Returns

Axes2d

Implementation of

Curve2d.axesAtParam


lengthAt()

lengthAt(t): number

Defined in: curve2d/Spline2d.ts:69

Parameters

t

number

Returns

number

Implementation of

Curve2d.lengthAt


paramAtLength()

paramAtLength(s): number

Defined in: curve2d/Spline2d.ts:70

Parameters

s

number

Returns

number

Implementation of

Curve2d.paramAtLength


closestPoint()

closestPoint(p): Point2d

Defined in: curve2d/Spline2d.ts:72

Parameters

p

Point2d

Returns

Point2d

Implementation of

Curve2d.closestPoint


splitAt()

splitAt(t): [Shape2d, Shape2d]

Defined in: curve2d/Spline2d.ts:77

Parameters

t

number

Returns

[Shape2d, Shape2d]

Implementation of

Curve2d.splitAt


toBeziers()

toBeziers(): CubicBezier2d[]

Defined in: curve2d/Spline2d.ts:95

Decompose the canonical NURBS representation into cubic Bezier spans.

This MUST stay consistent with the parametric API (pointAt/length/...), which delegate to toNurbsCurve(). Both derive from the SAME curve, so a point sampled via pointAt lies on these Beziers and on tessellate().

The NURBS spline is non-rational (unit weights) and interpolating; degrees below 3 are elevated to 3 so every span maps to one CubicBezier2d.

Returns

CubicBezier2d[]


tessellate()

tessellate(tol): Point2d[]

Defined in: curve2d/Spline2d.ts:116

Parameters

tol

number

Returns

Point2d[]


boundingBox()

boundingBox(): BoundingBox2d

Defined in: curve2d/Spline2d.ts:121

Returns

BoundingBox2d

Implementation of

Curve2d.boundingBox


reverse()

reverse(): Spline2d

Defined in: curve2d/Spline2d.ts:130

Returns

Spline2d

Implementation of

Curve2d.reverse


transform()

transform(m): Spline2d

Defined in: curve2d/Spline2d.ts:132

Parameters

m

Transformation2d

Returns

Spline2d

Implementation of

Curve2d.transform