Overview
The projection system converts 3D boundary representations (BReps) to 2D vector drawings with optional hidden line removal. It supports both orthographic and perspective projections with configurable camera parameters.Key Concepts
Projection Modes
- Orthographic: Parallel projection preserving relative dimensions
- Perspective: View with perspective distortion based on distance from camera
Hidden Line Removal
The HLR algorithm determines edge visibility by:- Computing face normals and front-facing determination
- Building edge-to-face adjacency maps
- Analyzing edge creases and silhouettes
- Filtering based on visibility criteria
CameraParameters
Structure
Default Camera
Camera Configuration
position: Camera location in 3D space (meters) target: Point the camera is looking at (meters) up: Vector defining camera’s up direction (typically[0, 1, 0])
near: Near clipping plane distance - geometry closer than this is clipped
projection_mode: "Orthographic" or "Perspective"
Example: Isometric View
Example: Front View
Example: Perspective View
HlrOptions
Structure
Default Options
true, edges obscured by front-facing geometry are removed from the output. When false, all edges are shown (wireframe mode).
Wireframe vs Hidden Line Removal
Scene2D
Structure
Methods
new / with_name
add_path
extend
bounding_box
(min, max) corner points of the scene’s bounding box, or None if empty.
to_lines
Path2D & Segment2D
Path2D Structure
Segment2D
Vec2
Projection Function
project_brep_to_scene
Scene2DLines
Structure
Line2D
Usage
Common Projection Patterns
Standard Engineering Views
Adjusting Detail Level
Implementation Details
Projection Pipeline
- Camera Frame Construction: Build right/up/forward vectors from camera parameters
- World to View Transform: Convert 3D points to camera-relative coordinates
- Near Plane Clipping: Clip segments crossing the near plane
- Projection: Apply orthographic or perspective transform
- Hidden Line Removal: Filter edges based on face visibility
- 2D Scene Assembly: Collect visible segments into paths
Edge Visibility Algorithm
An edge is visible if:- It has no adjacent faces (standalone edge), or
- At least one adjacent face is front-facing, and
- Some adjacent faces are back-facing (silhouette edge), or
- Adjacent front-facing faces have different normals (crease edge)
Crease Detection
Edges between faces with normals differing by more than ~2° (cos θ < 0.9995) are considered creases and remain visible.Performance Considerations
- Projection time scales linearly with edge count
- HLR adds overhead for face normal computation
- Complex scenes (10,000+ edges) project in milliseconds
- Use Scene2DLines for simpler post-processing
Related
- Scene Management - Organizing multiple entities
- PDF Export - Exporting projections to PDF
- BRep - Boundary representation structure