Skip to content
Shapemetry

@huukhanhnguyen/types / geometry/curve

geometry/curve

ArcCurve

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

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.

center

center: Point

normal

normal: Vector

radius

radius: number

startAngle

startAngle: number

sweepAngle

sweepAngle: number

xAxis

xAxis: Vector

yAxis

yAxis: Vector


Curve

Curve = { curves: PolyCurve[]; transformation?: Transformation; }

3D curve document — collection of ordered space chains.

Same stem as the geometry Curve 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.

curves

curves: PolyCurve[]

transformation?

optional transformation?: Transformation

Optional 4×4 placement; omitted when identity. Scene objects put placement on instances instead — do not set this on CurveObject.data.


EllipseCurve

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

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.

center

center: Point

majorRadius

majorRadius: number

minorRadius

minorRadius: number

normal

normal: Vector

startAngle

startAngle: number

sweepAngle

sweepAngle: number

xAxis

xAxis: Vector

yAxis

yAxis: Vector


LineCurve

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

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

Tagged type: "line" in a BRep document.

end

end: Point

start

start: Point


NurbsCurve

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

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.

controlPoints

controlPoints: Point[]

degree

degree: number

knots

knots: number[]

weights

weights: number[]


PointPath

PointPath = { closed: boolean; points: Point[]; }

A polyline of 3D points with an explicit closed flag.

Not Curve: that is a document of PolyCurve chains. This is the sampled-points form consumed by thicken/offset and kernel extrude profiles.

closed

closed: boolean

points

points: Point[]


PolyCurve

PolyCurve = { segments: Segment[]; }

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

An ordered chain only — segments meet end to start, never branch. Closest OCCT idea: CompositeCurve / a polyline of heterogeneous carriers. Wire: { segments: Segment[] }.

This is the geometry CurveData carries. 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 document payloads.

segments

segments: Segment[]


Segment

Segment = { type: "line"; } & LineCurve | { type: "arc"; } & ArcCurve | { type: "ellipse"; } & EllipseCurve | { formAbsent?: boolean; type: "nurbs"; } & NurbsCurve | { parent: Segment; type: "segment"; windowEnd: number; windowStart: number; }

One piece of a 3D chain: one of the four shapes above wearing its tag, or a WINDOW onto another piece. This is the ONE tagged curve union — the BRep document's 3D curve entry (BrepEdge) and a revolve surface's profile both carry it.

Named for what it IS rather than for the family it draws from: a PolyCurve spells its own field segments, and the element type now matches the field. Precedent is WPF's PathSegment / LineSegment / ArcSegment held in a PathFigure.Segments collection — one piece of a curve chain, tagged by kind, called a segment. The name Curve it vacated now belongs to the multi-chain document below.

A segment ARM 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.

A full circle is an arc with sweep 2π. The analytic form is DERIVED on load — unless the entry freezes it absent.

Union Members

{ type: "line"; } & LineCurve


{ type: "arc"; } & ArcCurve


{ type: "ellipse"; } & EllipseCurve


{ formAbsent?: boolean; type: "nurbs"; } & NurbsCurve


Type Literal

{ parent: Segment; type: "segment"; windowEnd: number; windowStart: number; }

Last updated: 📖 5 min readEdit on GitHub