Shapemetry API / PolygonMeshJSON
Type Alias: PolygonMeshJSON
PolygonMeshJSON =
object
Defined in: types.ts:211
Plain-data serialization of PolygonMesh (face-with-holes mesh, SketchUp-style).
positions— shared flat XYZ pool[x, y, z, x, y, z, ...].faces[i].loops[0]— outer boundary (CCW), vertex indices intopositions.faces[i].loops[1..]— hole boundaries (CW).faces[i].uvMatrix— per-face 4×4 projective matrix (16 numbers, row-major). Apply to(x, y, z, 1)→(u, v, _, q); divide byqfor projective UV (matches SketchUp's UVQ fromFace.get_UVHelper). Affine planar projection = bottom row(0, 0, 0, 1). One matrix per face is enough because SU materials project linearly across the whole face.faces[i].material—MaterialJSON.idkeyed intomaterialPalette.materialPalette— PBR materials referenced by facematerialid.texturePalette— textures referenced byMaterialJSON.*TextureId. Kept alongside (not inside) the material palette so one image can back many materials without duplication.
Producer dedups vertex sharing across faces (quantize-key); consumer (Mesh.fromPolygonMesh) still runs a tolerance bucket to absorb ULP noise.
Properties
positions
positions:
number[]
Defined in: types.ts:212
faces
faces:
object[]
Defined in: types.ts:213
loops
loops:
number[][]
uvMatrix?
optionaluvMatrix?:number[]
material?
optionalmaterial?:string|null
materialPalette?
optionalmaterialPalette?:MaterialJSON[]
Defined in: types.ts:218
texturePalette?
optionaltexturePalette?:TextureAssetJSON[]
Defined in: types.ts:219