Skip to content
Shapemetry

Geometry types

API reference for TypeScript types owned by @huukhanhnguyen/geometry (operation knobs, validation reports, tessellation wire documents).

Shared algebra and wire shapes (Point, TriangleMesh, Path2d, …) are declared in @huukhanhnguyen/types — this page does not re-list them.

API reference

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

ClipEdgeTest

type

Sutherland–Hodgman edge test for rectangle window clipping (catalog/projection.ts's clipPolygonToWindow).

type ClipEdgeTest
// = {
    inside: (p: Point2d) => boolean;
    intersect: (a: Point2d, b: Point2d) => Point2d;
}

Hsl

type

HSL channels (h in degrees, s/l 0..1) — internal to the Color.* math.

type Hsl
// = {
    h: number;
    s: number;
    l: number;
}

LineFit

type

Ordinary least-squares linear regression result.

type LineFit
// = {
    slope: number;
    intercept: number;
    r2: number;
}

OffsetEndType

type

Offset line cap — how the open ends of an offset chain are closed.

type OffsetEndType
// = "round" | "square" | "butt"

OffsetJoinType

type

Offset join — how the joins between offset segments are resolved.

type OffsetJoinType
// = "round" | "miter" | "square"

Rgb

type

RGB channels 0..255 — internal to the Color.* math, never on a wire.

type Rgb
// = {
    r: number;
    g: number;
    b: number;
}

TriangleMesh

const

const TriangleMesh: { … }

Members: boundingBox, chainCutLoops, clipToPlane, containsPoint, deform, displace, faceNormal, flatten, fromPoints, intersect, isSolid, loopSubdivide, planarize, reverse, simplify, solidify, splitByPlane, subtract, surfaceArea, transform, union, uvMatrixAt, volume, weld

TriangleMeshDocument

type

Wire shape of the one-shot tess_solid / tess_shell / tess_face / mesh_tessellate_json JSON document (Rust TriangleMesh serde, camelCase). Optional fields mirror serde defaults — catalog/mesh.ts's meshFromJson parses then normalizes into TriangleMesh; that is the only decode point.

type TriangleMeshDocument
// = {
    positions?: number[];
    normals?: number[];
    uvs?: number[];
    indices?: number[];
    edges?: Array<{
        edgeIndex?: number | null;
        type?: string | null;
        positions?: number[];
    }>;
    faces?: Array<{
        start?: number;
        count?: number;
        faceIndex?: number | null;
    }>;
}

ValidationIssue

interface

The one-shot Brep.validate report (Rust brep_validate JSON — the authority is crates/geometry/src/brep/heal_check/wasm.rs, whose doc spells this exact shape).

interface ValidationIssue

ValidationReport

interface

interface ValidationReport

ViewTriangle

type

type ViewTriangle
// = {
    world: [Point, Point, Point];
    projected: [Point2d, Point2d, Point2d];
}
Last updated: 📖 1 min readEdit on GitHub