This project loads Wavefront OBJ meshes, represents their topology with half-edges, and exposes common geometry-processing operations through an OpenGL viewer. The implementation focuses on topology invariants, portable builds, and visible before/after results.
- OBJ loading with automatic twin reconstruction and mesh normalization
- Per-face and per-vertex normal computation
- View-dependent silhouette detection
- Convex and concave polygon triangulation using ear clipping
- Surface-of-revolution mesh generation
- Shortest-edge-collapse simplification
- Catmull-Clark subdivision with boundary handling
- Automated half-edge invariant tests
| Operation | Before | After |
|---|---|---|
| Concave triangulation | ![]() |
![]() |
| Edge-collapse simplification | ![]() |
![]() |
| Catmull-Clark subdivision | ![]() |
![]() |
Additional captures are available in docs/images.
TP1/MeshViewerCMake/
|-- myMesh.* Half-edge ownership and geometry algorithms
|-- myHalfedge.* Directed-edge topology
|-- myFace.* Face adjacency and normal computation
|-- myVertex.* Vertex geometry and incident-edge access
|-- main.cpp OpenGL/GLUT viewer and interaction
`-- test_mesh.cpp Topology and algorithm regression tests
mesh_core contains the geometry implementation without a window-system
dependency. The viewer adds OpenGL, GLEW, GLM, and GLUT on top of that core.
Requirements:
- CMake 3.20 or newer
- A C++17 compiler
- OpenGL, GLEW, GLM, and GLUT/FreeGLUT
Install dependencies:
# Ubuntu / Debian
sudo apt-get install cmake g++ libgl1-mesa-dev libglew-dev libglm-dev freeglut3-dev
# macOS
brew install cmake glew glm
# Windows with vcpkg
vcpkg install glew:x64-windows glm:x64-windows freeglut:x64-windowsConfigure, build, and test:
cmake -S TP1/MeshViewerCMake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
ctest --test-dir build -C Release --output-on-failureOn Windows, also pass the vcpkg toolchain file during configuration:
cmake -S TP1/MeshViewerCMake -B build `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET=x64-windowsLaunch MeshViewer from the build directory. Right-click inside the window to
open the operation menu.
To work only on the geometry core and tests without installing graphics dependencies, disable the viewer:
cmake -S TP1/MeshViewerCMake -B build -DGEOMETRIC_MODELING_BUILD_VIEWER=OFF
cmake --build build --config Release
ctest --test-dir build -C Release --output-on-failureThe regression executable validates loading, twin reciprocity, face-loop consistency, triangulation, simplification, subdivision, and open-boundary behavior. CI builds the project and runs the suite on Linux, macOS, and Windows.
This project was developed as an academic geometric-modeling assignment. AI tools were used for targeted portability troubleshooting and as a learning aid; the implementation choices, integration, and validation remain the author's.
MIT - copyright Allan Seddi.






