REPOSITORY CODING · MEDIUM
Accumulate path lengths during Dijkstra relaxation
A multi-edge route costs the sum of all traversed edge lengths. Preserve the current shortest distance when relaxing a neighbor rather than comparing only its final edge.
Mesh topology and geometryTriangle mesh laboratory
Work through a real codebase.
Choose an environment, investigate the existing implementation and use the tests to check your change. Sign in to open a workspace; execution and Ono usage follow your plan’s allowances.
Task requirements and environments
C++ · 55 minute session
- Analyze up to 20 integer 3D vertices and 30 indexed triangular faces. Coordinates lie in -1000..1000; indices are strict integers. Reject repeated/duplicate/degenerate faces, edges incident to more than two faces and branching non-manifold boundaries. Unused vertices and meshes without faces are supported.
- Build unique undirected edges and connected face components. Orient each component consistently by preserving its first input face and propagating opposite shared-edge directions. Reject contradictory non-orientable constraints. Return repaired faces, unnormalized face normals and area-weighted vertex normal sums.
- Compute Euler characteristic from used vertices, unique edges and faces. Return boundary edge count and directed loops, each starting at its smallest vertex without a duplicate closing vertex. Loops retain the repaired face winding and are sorted lexically.
- Compute total surface area rounded to six decimal places and signed volume multiplied by six using the repaired orientations and exact integer triple products. Open surfaces may have origin-dependent signed volume; no closed-volume claim is made for them.
- Answer up to 16 shortest-path queries along mesh edges using Euclidean edge lengths and accumulated Dijkstra distances. Return six-decimal distances, zero for identical vertices and null for disconnected vertices. Native C++ HTTP and grading paths use the same geometry modules.