Boundary Representation (BREP) is the core data structure used in OpenGeometry to represent geometric entities. It describes 3D objects by defining their boundaries through vertices, edges, and faces.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/OpenGeometry-io/OpenGeometry/llms.txt
Use this file to discover all available pages before exploring further.
What is BREP?
BREP is a method of representing shapes by explicitly defining their boundaries. Instead of storing a solid as a filled volume, BREP stores:- Vertices - Points in 3D space
- Edges - Connections between vertices
- Faces - Surfaces bounded by edges
- Exact - Preserves geometric precision
- Topology-aware - Maintains relationships between elements
- Efficient - Avoids redundant storage of shared vertices/edges
Why BREP?
OpenGeometry uses BREP because it:- Supports complex operations - Boolean operations, offsetting, and extrusion work naturally on boundaries
- Maintains precision - No approximation errors from voxelization or tessellation
- Industry standard - Compatible with CAD file formats like STEP, IGES, and Parasolid
- Flexible - Can represent wireframes, surfaces, and solids with the same structure
BREP Body Types
OpenGeometry can represent different types of geometric bodies:- Solid body - Has volume (e.g., cube, sphere)
- Shell body - Has surface but no volume (e.g., car body)
- Sheet body - Has 2D surface (e.g., flat plate)
- Wireframe body - Has only edges (e.g., line drawing)
- Point body - Single vertex in space
Data Structure
The BREP structure is defined insrc/brep/mod.rs:
Core Components
Vertex
Defined insrc/brep/vertex.rs, a vertex represents a point in 3D space:
Edge
Defined insrc/brep/edge.rs, an edge connects two vertices:
Face
Defined insrc/brep/face.rs, a face is a surface bounded by vertices:
Half-Edge Structure (Planned)
Defined insrc/brep/halfedge.rs, the half-edge data structure is planned for future implementation:
BREP Operations
TheBrep struct provides several utility methods:
Querying Geometry
Handling Holes
Faces can contain holes (e.g., a plate with circular cutouts):Modifying Topology
Example: Building a BREP
Here’s how a simple triangle is represented:Serialization
BREP structures are serializable viaserde:
Topology Validation
While OpenGeometry doesn’t enforce strict manifold constraints, valid BREP structures should maintain:- Vertex references - All edge vertex IDs exist in vertex list
- Face winding - Consistent counter-clockwise ordering (right-hand rule)
- Edge connectivity - Edges properly connect vertices without gaps
References
The BREP implementation is based on:Next Steps
Architecture
Understand how BREP fits in the system architecture
Scene Graph
Learn how BREP bodies are managed in scenes