Python 3 + Tkinter interactive graphics system for INE5420 - Computer Graphics (UFSC).
| Name | Student ID |
|---|---|
| Felipe Thaddeu Gassen | 23100481 |
| Augusto Schweitzer | 23100475 |
| Davi Ludvig Longen Machado | 23100473 |
| Task | What was built |
|---|---|
| 1.1 | 2D display file, viewport transform, pan, zoom, canvas click capture |
| 1.2 | 3x3 matrix transforms (translate, scale, rotate), color, composite queue |
| 1.3 | SCN pipeline, window rotation, rotation-aware navigation, Wavefront .obj I/O |
| 1.4 | Clipping (point, Cohen-Sutherland, Liang-Barsky, Sutherland-Hodgman), filled polygons, viewport border, .obj color/filled round-trip |
| 1.5 | Bézier curves (Curve2D) via matrix form with blending functions, multi-segment C1/G1 continuity, per-segment polyline clipping, .obj round-trip |
| 1.6 | B-Spline curves via uniform cubic forward differences, multi-segment rendering, .obj round-trip with curve_kind bspline tag |
| 1.7 | 4×4 homogeneous transforms for 3D objects (translate, scale, rotate X/Y/Z, around-point); Object3D uses Matrix4 pipeline; geometric_center_3d; transform dialog detects 3D and exposes dz, sz, axis selector |
| 1.8 | 3D projection pipeline with parallel and perspective modes, configurable COP/focal distance, near-plane clipping before perspective divide |
| 1.9 | Bicubic surface meshes from sets of 3 matrices 4×4 (Gx, Gy, Gz), sampled with Hermite or B-Spline characteristic matrices and rendered through the 3D wireframe/projection pipeline |
| 1.10 | Bicubic surface mesh sampling via forward differences: C = M·G·Mᵀ, DD = E(ds)·C·E(dt)ᵀ, rendering both surface curve families |
| 1.11 | Pixel Shading — software rasterization pipeline with Z-buffer (wireframe/solid/Phong modes) and per-fragment Phong shading with interpolated normals |
Linux / macOS
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
python -m sgiWindows (PowerShell)
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -e .
python -m sgiLinux: install
python3-tkfrom the system package manager if Tkinter is missing (sudo apt install python3-tkon Debian/Ubuntu).
Install Pillow to enable the fast display path (~5 ms/frame instead of ~20 ms):
pip install -e ".[rasterizer]"Without Pillow the rasterizer still works via a PPM temp-file fallback, just slightly slower.
objects/penger.obj: Penger penguin model converted to SGIObject3Dwireframe from Max-Kawula/penger-obj, licensed under the Penger Public License.
src/sgi/
├── core/
│ ├── bezier.py # Bézier matrix eval, C1 segmentation, polyline
│ ├── bspline.py # B-Spline forward differences
│ ├── clipping.py # Point, line (C-S, L-B), polygon (S-H), curve polyline
│ ├── display_file.py # Object storage
│ ├── geometry.py # Point2D, Point3D
│ ├── obj_io.py # Wavefront .obj read/write (2D + 3D round-trip)
│ ├── objects.py # GraphicObject, Object3D, ObjectType
│ ├── parsing.py # Coordinate parsing
│ ├── projection.py # Parallel/perspective projection and near-plane clipping
│ ├── rasterizer.py # Framebuffer, Z-buffer, Phong shading (software renderer)
│ ├── surface.py # Bicubic surface patch evaluation and mesh sampling
│ ├── transforms.py # 3x3 (2D) and 4x4 (3D) homogeneous matrices
│ └── window_viewport.py # Window, Viewport, SCN pipeline
├── ui/
│ ├── canvas_renderer.py # Drawing + viewport border (Tkinter path)
│ ├── dev_tools.py # Debug/test popup menu (3D spin, rasterizer tests, …)
│ ├── main_window.py # Tkinter shell and canvas/footer orchestration
│ ├── main_window_form.py # New-object form and coordinate capture
│ ├── main_window_sidebar.py # Display-file sidebar, navigation, file/render actions
│ ├── raster_renderer.py # Bridge: mapped_objects → Framebuffer (wireframe/solid/Phong)
│ └── transform_dialog.py # Transform/rename dialog (2D and 3D modes)
└── app.py # Application controller
Tests are grouped by layer:
tests/
├── core/ # Geometry, clipping, transforms, parsing, OBJ and surfaces
├── integration/ # Application/projection pipelines with fake or real UI shells
└── ui/ # Tk widgets, renderer and dialog behavior