A Python implementation for visualizing and interacting with 3D objects using 2D graphics.
This project implements a 3D wireframe viewer that renders 3D objects as wireframes using only 2D graphics primitives.
vid1.mov
vid2.mov
- 3D Object Parsing: Reads 3D objects from comma-separated text files
- Wireframe Visualization: Displays objects as wireframes with vertices and edges
- Interactive Rotation: Click and drag to rotate objects
- Horizontal movement rotates around Y-axis
- Vertical movement rotates around X-axis
- Diagonal movement combines both rotations
- Normalized Scaling: Objects are automatically scaled to fit optimally in the display window
- Pure 2D Graphics: Implements 3D visualization using only 2D drawing primitives
- Orthographic Projection: Projects 3D coordinates onto a 2D plane assuming infinite viewer distance
- Matrix-Based Rotation: Uses rotation matrices to avoid gimbal lock
The application accepts 3D object files in the following format:
6,8
1,1.0,0.0,0.0
2,0.0,-1.0,0.0
3,0.0,0.0,1.0
...
1,2,3
1,2,6
...
Where:
- First line:
[number_of_vertices],[number_of_faces] - Vertex lines:
[vertex_id],[x],[y],[z] - Face lines:
[vertex_id1],[vertex_id2],[vertex_id3]
python part1.py object.txt # For basic wireframe display- Python 3.x
- NumPy
- Tkinter (usually comes with Python)