How vihantyagi/3dto2d_projection works
Main components
• File Loader / Parser
• Data Model & Math Engine
– Stores 3D object data structures.
– Applies rotation matrices (X, Y) and orthographic projection to yield 2D coordinates (uses NumPy).
• UI Controller / Event Handler
– Captures mouse drag events from Tkinter, decides rotation angles, passes them to Math Engine.
• 2D Renderer / View
• Application Entry Point
– main.py orchestrates initialization: reads files, sets up model/state, starts the Tkinter main loop.
• External Dependencies
– NumPy (matrix operations)
– Tkinter (GUI toolkit)
Relationships and data flows
– Application Entry Point → invokes File Loader
– File Loader → populates Data Model
– UI Controller listens to user events → computes rotation deltas → calls Math Engine
– Math Engine → transforms Data Model → returns updated 2D points
– 2D Renderer ← draws updated 2D points each frame
Architectural/design principles
• Separation of Concerns (MVC-like):
– Model (object data, math)
– View (render)
– Controller (UI events)
• Data Flow is unidirectional per user action: Input → Model → View
• Modularization by functionality (parsing, math, rendering, event handling)
• Use of matrix math to avoid gimbal lock
• Orthographic projection assumes infinite camera distance (no perspective)
• Loader → Model
• Controller → Math Engine → Renderer
• Renderer → Canvas (Tkinter)