Skip to content
Shapemetry

Types - Curve

API reference for ./geometry/curve on @huukhanhnguyen/types.

See the Guide for the package's role.

API reference

Signatures are generated from the live package .d.ts - not hand-written.

ArcCurve

type

A circular arc in the plane (xAxis, yAxis) through center, swept from startAngle over sweepAngle — the one conic whose offset is again a conic.

There is no separate full-circle kind: a full circle is this with a 2π sweep. Tagged type: "arc" in a BRep document.

type ArcCurve
// = {
    center: Point;
    normal: Vector;
    radius: number;
    xAxis: Vector;
    yAxis: Vector;
    startAngle: number;
    sweepAngle: number;
}

Curve

type

A 3D curve carrier: one of the four shapes above wearing its tag, or a WINDOW onto another carrier. This is the ONE tagged curve union — the BRep document's 3D curve row (Edge, UvCurve) and a revolve surface's profile both carry it, so it keeps the wire name Curve (its consumers spell it that way) even though it lives here beside the geometries it tags.

A segment is parent.value(t) restricted to [windowStart, windowEnd], in the PARENT's own parameter, never rescaled; a window running past the parent's range folds back by whole periods. The parent may itself be a segment, and is one in practice — a section carrier that a later split re-trims is a window onto a window. The nesting is carried verbatim because flattening is not sound: each level folds against its OWN parent's range, and composing two folds is not one fold.

There is no formCarrier flag and no separate full-circle kind — a full circle is an arc with sweep 2π. The analytic form is DERIVED on load — unless the row freezes it absent.

type Curve
// = ({ type: "line"; } & LineCurve) | ({ type: "arc"; } & ArcCurve) | ({ type: "ellipse"; } & EllipseCurve) | ({ type: "nurbs"; /** * The curve's form was frozen ABSENT — a NURBS conversion stripped the * analytic identity, or an explicit null seed. Same intent as the * surface arm's flag, and equally not derivable: lazy recovery WOULD * find a form here (a NURBS-converted rim circle recovers as an `arc`), * re-tag the carrier, and the dump would claim an analytic edge the * document no longer carries. */ formAbsent?: boolean; } & NurbsCurve) | { type: "segment"; parent: Curve; windowStart: number; windowEnd: number; }

EllipseCurve

type

An elliptical arc — closed under affine maps, where an arc is not: scale a circle non-uniformly and the result is exactly an ellipse, so the ellipse cannot be folded into ArcCurve.

A full ellipse is this with a 2π sweep. Tagged type: "ellipse" in a BRep document.

type EllipseCurve
// = {
    center: Point;
    normal: Vector;
    majorRadius: number;
    minorRadius: number;
    xAxis: Vector;
    yAxis: Vector;
    startAngle: number;
    sweepAngle: number;
}

LineCurve

type

A bounded straight segment: degree 1, closed under affine maps AND offset.

Tagged type: "line" in a BRep document.

type LineCurve
// = {
    start: Point;
    end: Point;
}

NurbsCurve

type

A rational B-spline curve — the closure of the family: it contains every conic and every Bezier EXACTLY, not as an approximation, which is why the list of kinds stops here.

Tagged type: "nurbs" in a BRep document; carried bare as the payload every NurbsCurve.* wasm door parses.

type NurbsCurve
// = {
    degree: number;
    knots: number[];
    controlPoints: Point[];
    weights: number[];
}

Path

type

3D path document — collection of ordered space chains.

Same stem as the geometry Path ops namespace (type/value dual). Each entry of curves is one PolyCurve (closed ring or open stroke). Optional transformation is a 4×4 placement; omitted when identity.

type Path
// = {
    curves: PolyCurve[];
    transformation?: Transformation;
}

PolyCurve

type

Ordered chain of 3D curve segments (endpoint-welded).

An ordered chain only — not a branching edge graph (Wire, brepWire.ts). Closest OCCT idea: CompositeCurve / a polyline of heterogeneous carriers. Wire: { segments: Curve[] }.

This is the curve-entity geometry. Anything the user draws (one line, one arc, a polyline, a heterogeneous chain) is a PolyCurve — a single segment is a valid one-element chain. Bare NurbsCurve / bare LineCurve are kind carriers inside segments, not entity payloads.

type PolyCurve
// = {
    segments: Curve[];
}
Last updated: 📖 3 min readEdit on GitHub