Types - TriangleMesh
API reference for ./geometry/triangleMesh 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.
FacetedBrepDocument
type
Faceted B-Rep document built FROM a triangle mesh (planar faces, line edges only). The construction target of brepFromTriangleMesh in @huukhanhnguyen/io — a geometry document, not an io format.
type FacetedBrepDocument
// = {
version: 2;
vertices: {
position: [number, number, number];
tolerance: number;
}[];
edges: {
start: number;
end: number;
curve: {
type: "line";
} & LineCurve;
tolerance: number;
}[];
loops: {
orientedEdges: {
edge: number;
forward: boolean;
}[];
}[];
faces: {
surface: {
type: "plane";
normal: [number, number, number];
d: number;
uvMin: [number, number];
uvMax: [number, number];
};
outerLoop: number;
innerLoops: number[];
reversed: boolean;
uvCurves: never[];
}[];
shells: {
faces: number[];
}[];
}MeshEdge
type
One display edge: a polyline along a topology edge of the mesh.
type MeshEdge
// = {
type: "smooth" | "boundary" | "unset";
/** Flat `[x, y, z, ...]` polyline along the edge. */
positions: number[];
}MeshGroup
type
One material range in the mesh (contiguous indices slice).
type MeshGroup
// = {
start: number;
count: number;
material?: string;
}PrincipalView
type
The six axis-aligned standard views.
type PrincipalView
// = "top" | "front" | "right" | "left" | "back" | "bottom"TriangleMesh
type
The canonical triangle-mesh payload and the ONE definition of an indexed triangulation (law: one mathematical object, one definition) — what Brep.tessellate / Shell.tessellate return (owned JS arrays), what every mesh-producing door speaks, and what projection/section clipping, scan import and the weld passes' shared-vertex intermediate carry.
positions + indices are the mesh; every other channel is optional because the producer decides which it has. Brep.tessellate ALWAYS fills normals, uvs and edges (empty arrays at worst); a clipped or welded triangulation carries positions and indices alone.
Tessellation is a ONE-WAY arrow: the mesh keeps no pointer back to the topology that produced it. The per-face triangle partition and the per-edge topology index were deleted on 2026-08-13 after a census over this repo and parashape found zero production readers of either.
The container is parameterized because it is instantiated two ways: the default plain number[] is the JSON/display form; TriangleMesh<Float64Array> is the packed-wire form whose channels are zero-copy subarray slices of the kernel's Float64Array wire (a number[] fold there would copy a 500k-triangle scan).
type TriangleMesh
// = {
positions: A;
indices: A;
normals?: A;
uvs?: A;
edges?: MeshEdge[];
groups?: MeshGroup[];
}