Skip to content
Shapemetry

@huukhanhnguyen/geometry / namespaces/NurbsCurve2d

namespaces/NurbsCurve2d

axesAtParam

const axesAtParam: (curve_json, t) => Float64Array = wasm.curve2d_axes_at_param

[originX, originY, tangentX, tangentY, normalX, normalY] — the normal is the LEFT normal, 90 degrees counter-clockwise from the tangent.

Parameters

curve_json

string

t

number

Returns

Float64Array


boundingBox

const boundingBox: (curve_json) => Float64Array = wasm.curve2d_bounding_box

[minX, minY, maxX, maxY].

Parameters

curve_json

string

Returns

Float64Array


closestPoint

const closestPoint: (curve_json, x, y) => Float64Array = wasm.curve2d_closest_point

Parameters

curve_json

string

x

number

y

number

Returns

Float64Array


end

const end: (curve_json) => Float64Array = wasm.curve2d_end

Parameters

curve_json

string

Returns

Float64Array


intersect

const intersect: (a_json, b_json, tolerance) => string = wasm.curve2d_intersect

Exact curve-curve intersection of the four 2D kinds.

a_json / b_json are each a tagged curve: public flat { type: "line"|"arc"|"ellipse"|"nurbs", ... } or the nested curve2d_* envelope. Returns { crossings, overlaps } JSON.

Parameters

a_json

string

b_json

string

tolerance

number

Returns

string


isClosed

const isClosed: (curve_json) => boolean = wasm.curve2d_is_closed

Parameters

curve_json

string

Returns

boolean


length

const length: (curve_json) => number = wasm.curve2d_length

Parameters

curve_json

string

Returns

number


lengthAt

const lengthAt: (curve_json, t) => number = wasm.curve2d_length_at

Parameters

curve_json

string

t

number

Returns

number


paramAtLength

const paramAtLength: (curve_json, s) => number = wasm.curve2d_param_at_length

Parameters

curve_json

string

s

number

Returns

number


pointAt

const pointAt: (curve_json, t) => Float64Array = wasm.curve2d_point_at

Parameters

curve_json

string

t

number

Returns

Float64Array


reverse

const reverse: (curve_json) => string = wasm.curve2d_reverse

Parameters

curve_json

string

Returns

string


signedArea

const signedArea: (curve_json) => number = wasm.curve2d_signed_area

Green's-theorem area contribution of one segment kind. Only the four ContourJson segment kinds carry one; a tagged curve of any other kind is an error rather than a silent zero.

Parameters

curve_json

string

Returns

number


spline

const spline: (points, degree) => string = wasm.curve2d_spline

Fit a NURBS of degree through points (flat [x, y, x, y, …]) and return it as a tagged nurbs curve row.

This is the door that replaces the old spline curve KIND. That kind was never a carrier — every one of its operations already delegated to this same NURBS — it was the only way to hand the kernel a 2D point list. Removing the kind without this factory would have removed the capability, so the construction moved here and the kind went away.

Parameters

points

Float64Array

degree

number

Returns

string


splitAt

const splitAt: (curve_json, t) => string = wasm.curve2d_split_at

Both halves, as a JSON array of two Curve2dJSON.

Parameters

curve_json

string

t

number

Returns

string


start

const start: (curve_json) => Float64Array = wasm.curve2d_start

Parameters

curve_json

string

Returns

Float64Array


tangentAt

const tangentAt: (curve_json, t) => Float64Array = wasm.curve2d_tangent_at

Parameters

curve_json

string

t

number

Returns

Float64Array


toNurbsCurve

const toNurbsCurve: (curve_json) => string = wasm.curve2d_to_nurbs_curve

The z = 0 NurbsCurve delegate every hard operation runs through.

Parameters

curve_json

string

Returns

string


transform

const transform: (curve_json, elements) => string = wasm.curve2d_transform

Parameters

curve_json

string

elements

Float64Array

Returns

string

Last updated: 📖 4 min readEdit on GitHub