Types - Curve2d
API reference for ./geometry/curve2d 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.
ArcCurve2d
type
The plane twin of ArcCurve (curve.ts): a circular arc about center.
Same startAngle + sweepAngle as its space twin.
type ArcCurve2d
// = {
center: Point2d;
radius: number;
startAngle: number;
sweepAngle: number;
}CubicBezier2d
type
Cubic Bezier in the plane. Discriminated by control1 (and control2) when untagged. Folded into degree-3 NURBS on Path2d write.
type CubicBezier2d
// = {
start: Point2d;
control1: Point2d;
control2: Point2d;
end: Point2d;
}Curve2d
type
The plane twin of Curve (curve.ts): one of the four 2D curve geometries wearing its type tag. Same tag spelling and flattened fields as the space union — not the nested { type, data } envelope the curve2d wasm door uses internally for Offset/Trimmed wrappers.
Circular arcs are tagged arc (not circle), matching ArcCurve2d.
type Curve2d
// = ({ type: "line"; } & LineCurve2d) | ({ type: "arc"; } & ArcCurve2d) | ({ type: "ellipse"; } & EllipseCurve2d) | ({ type: "nurbs"; } & NurbsCurve2d)EllipseCurve2d
type
The plane twin of EllipseCurve (curve.ts): an elliptical arc. Circular arcs are the equal-radius case of this on the contour wire.
xAxis is a direction, not necessarily unit — the kernel normalizes where it needs to.
type EllipseCurve2d
// = {
center: Point2d;
majorRadius: number;
minorRadius: number;
xAxis: Vector2d;
startAngle: number;
sweepAngle: number;
}LineCurve2d
type
The plane twin of LineCurve (curve.ts): a bounded straight segment in uv / xy.
Untagged on the contour wire, where a segment is discriminated by field presence — this is the fallback, the one with neither control, control1 nor sweepAngle.
type LineCurve2d
// = {
start: Point2d;
end: Point2d;
}NurbsCurve2d
type
The plane twin of NurbsCurve (curve.ts) — the closure in uv, and the exact carrier of a composite uv curve on a face.
type NurbsCurve2d
// = {
degree: number;
knots: number[];
controlPoints: Point2d[];
weights: number[];
}Path2d
type
2D path document — fill/stroke collection of ordered plane chains.
Same stem as the geometry Path2d ops namespace (type/value dual). Each entry of curves is one PolyCurve2d (closed ring or open stroke). Optional transformation is a length-16 4×4 placing the planar document into world space (plane-in-world embed — not Transformation2d (core2d.ts), which is a 6-number in-plane affine). Omitted when identity.
Wire write uses tagged Curve2d segments. The Path2d.addShape wasm door additionally accepts the UNTAGGED segment bag the text kernel's glyph outliner emits, and tags it on the way in; that bag is not a public TypeScript type.
type Path2d
// = {
curves: PolyCurve2d[];
transformation?: Transformation;
}PolyCurve2d
type
Ordered chain of 2D curve segments (endpoint-welded).
Plane twin of PolyCurve (curve.ts). Wire: { segments: Curve2d[] }. One path ring / open stroke is one polycurve; multi-ring fill is Path2d.
type PolyCurve2d
// = {
segments: Curve2d[];
}QuadraticBezier2d
type
Quadratic Bezier in the plane. Discriminated by control when untagged — the shape a glyph outline arrives in from the text kernel. Not a Curve2d kind: Path2d write folds these into degree-2 NURBS.
type QuadraticBezier2d
// = {
start: Point2d;
control: Point2d;
end: Point2d;
}