@huukhanhnguyen/types / geometry/triangleMesh
geometry/triangleMesh
FacetedBrepDocument
FacetedBrepDocument = {
edges: {curve: {type:"line"; } &LineCurve;end:number;start:number;tolerance:number; }[];faces: {innerLoops:number[];outerLoop:number;reversed:boolean;surface: {d:number;normal: [number,number,number];type:"plane";uvMax: [number,number];uvMin: [number,number]; };uvCurves:never[]; }[];loops: {orientedEdges: {edge:number;forward:boolean; }[]; }[];shells: {faces:number[]; }[];vertices: {position: [number,number,number];tolerance:number; }[]; }
Faceted B-Rep document built FROM a triangle mesh (planar faces, line edges only) — a geometry document, not an io format.
edges
edges: {
curve: {type:"line"; } &LineCurve;end:number;start:number;tolerance:number; }[]
curve
curve: {
type:"line"; } &LineCurve
Type Declaration
type
type:
"line"
end
end:
number
start
start:
number
tolerance
tolerance:
number
faces
faces: {
innerLoops:number[];outerLoop:number;reversed:boolean;surface: {d:number;normal: [number,number,number];type:"plane";uvMax: [number,number];uvMin: [number,number]; };uvCurves:never[]; }[]
innerLoops
innerLoops:
number[]
outerLoop
outerLoop:
number
reversed
reversed:
boolean
surface
surface: {
d:number;normal: [number,number,number];type:"plane";uvMax: [number,number];uvMin: [number,number]; }
surface.d
d:
number
surface.normal
normal: [
number,number,number]
surface.type
type:
"plane"
surface.uvMax
uvMax: [
number,number]
surface.uvMin
uvMin: [
number,number]
uvCurves
uvCurves:
never[]
loops
loops: {
orientedEdges: {edge:number;forward:boolean; }[]; }[]
orientedEdges
orientedEdges: {
edge:number;forward:boolean; }[]
shells
shells: {
faces:number[]; }[]
faces
faces:
number[]
vertices
vertices: {
position: [number,number,number];tolerance:number; }[]
position
position: [
number,number,number]
tolerance
tolerance:
number
MeshEdge
MeshEdge = {
positions:number[];type:"smooth"|"boundary"|"unset"; }
One display edge: a polyline along a topology edge of the mesh.
positions
positions:
number[]
Flat [x, y, z, ...] polyline along the edge.
type
type:
"smooth"|"boundary"|"unset"
MeshGroup
MeshGroup = {
count:number;material?:string;start:number; }
One material range in the mesh (contiguous indices slice).
count
count:
number
material?
optionalmaterial?:string
start
start:
number
PrincipalView
PrincipalView =
"top"|"front"|"right"|"left"|"back"|"bottom"
The six axis-aligned standard views.
TriangleMesh
TriangleMesh<
A> = {edges?:MeshEdge[];groups?:MeshGroup[];indices:A;normals?:A;positions:A;uvs?:A; }
The canonical triangle-mesh payload and the ONE definition of an indexed triangulation (law: one mathematical object, one definition) — what BrepData.tessellate / BrepData.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. BrepData.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 Group 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 Parameters
A
A extends Float64Array | number[] = number[]
edges?
optionaledges?:MeshEdge[]
groups?
optionalgroups?:MeshGroup[]
indices
indices:
A
normals?
optionalnormals?:A
positions
positions:
A
uvs?
optionaluvs?:A