This project computes and visualizes shortest‑path approximations on 3D meshes using a C++ engine, a Go API server, and a React + Three.js frontend.
- You click Run Dijkstra in the UI.
- The React app sends a POST request to the Go server at /compute.
- The Go server runs the C++ engine binary in main.cpp with arguments: startId, endId, model path.
- The C++ engine loads the OBJ, builds a graph, runs Dijkstra, and writes result.json.
- The React app fetches result.json and renders the path in red.
- You click Run Analytics in the UI.
- The React app sends a POST request to the Go server at /analytics.
- The Go server runs the C++ engine with mode analytics.
- The C++ engine calls the analytic solver in analytics.hpp and writes analytics.json.
- The React app fetches analytics.json and renders the path in yellow.
sequenceDiagram
participant UI as React UI (frontend)
participant API as Go API (backend)
participant CPP as C++ Engine
participant FS as frontend/public/*.json
UI->>API: POST /compute {start,end,model}
API->>CPP: exec ./main start end model
CPP->>FS: write result.json
UI->>FS: fetch result.json
UI->>UI: render Dijkstra path (red)
UI->>API: POST /analytics {start,end,model}
API->>CPP: exec ./main start end model analytics
CPP->>FS: write analytics.json
UI->>FS: fetch analytics.json
UI->>UI: render analytic path (yellow)
We treat mesh vertices as nodes and edges as graph edges. Each edge weight is the Euclidean length between adjacent vertices. The algorithm computes the shortest path along edges only.
Given a graph
The path is then recovered by parent pointers.
Implementation: main.cpp
The analytic solver in analytics.hpp uses closed‑form or ODE solutions for special surfaces:
Geodesic is a straight line:
Geodesic is a great‑circle arc. Let
For torus and saddle, we integrate the geodesic ODE in parameter coordinates
where the Christoffel symbols
Implementation: analytics.hpp
The analytic solver only works for a small set of parametric surfaces. It does not compute geodesics on irregular meshes like the Stanford bunny.
For general triangle meshes, the standard approach is the Heat Method (see [1]).
The idea:
- Solve the heat equation for a short time
$t$ . - Normalize the temperature gradient to get a vector field
$X$ . - Solve a Poisson equation
$\Delta \phi = \nabla\cdot X$ . -
$\phi$ approximates geodesic distance; follow its gradient to extract a path.
This method is fast, robust, and works on any triangle mesh, which is why it’s the right next step for bunny and other irregular models.
- C++ engine: main.cpp
- Analytic solver: analytics.hpp
- Go API server: backend/main.go
- React + Three.js UI: frontend/src/App.tsx
- Renderer: frontend/components/GeodesicMesh.tsx
