BREP Model and Classes
Overview
- BREP combines a triangle mesh with per-triangle face labels. Labels map to globally unique IDs in Manifold so selections survive boolean operations.
- During manifoldization, triangle windings are made consistent, outward orientation is enforced, and an optional weld epsilon deduplicates vertices.
- Visualization builds one mesh per face label and edge polylines for label boundaries, enabling semantic selection in the UI and PMI tooling.
Solid
Solidis aTHREE.Groupsubclass that handles authoring, CSG, queries, and export.- Geometry storage uses
_vertProperties(flat positions),_triVerts(triangle indices), and_triIDs(face IDs) plus name-to-ID maps. - Key methods include
addTriangle,setEpsilon,mirrorAcrossPlane,invertNormals,fixTriangleWindingsByAdjacency,removeTinyBoundaryTriangles,getMesh,getFace,getFaces,getFaceNames,getBoundaryEdgePolylines,visualize,union,subtract,intersect,difference,simplify,setTolerance,volume,surfaceArea,toSTL, andwriteSTL. - Full per-method descriptions and examples live in
docs/solid-methods.md.
Face
Faceis aTHREE.Meshrepresenting all triangles that share a label.- Provides
getAverageNormal()andsurfaceArea()helpers for inspection and downstream logic.
Edge
Edgeinstances represent boundary polylines between two face labels and expose metadata describing the adjacent faces.- Use edges for PMI dimension snapping, measurement, and preview visualization.
Additional implementation details can be explored in src/BREP/BetterSolid.js and related helpers.