nmwsharp / geometry-central

Applied 3D geometry in C++, with a focus on surface meshes.
https://geometry-central.net
MIT License
1.07k stars 149 forks source link

Logarithmic map and geodesic tracing for general polygon meshes #169

Open xprssn2 opened 8 months ago

xprssn2 commented 8 months ago

My use case

Given a manifold polygon mesh

trace a geodesic path between the two points. If it is not the shortest, at least be straightest (Polthier and Schmies [1998]).

I will use such an algorithm to cut up a surface with profile curves (i.e. curves on a surface). In practice, profile curves are polylines with vertices projected onto the polygon mesh. The idea is that these curve polyline segments become new edges on existing faces, splitting them, while preserving the shape of the original mesh. The curve is discretized finely enough such that most polyline segments have both endpoints inside one face, and these are of no concern. The exceptions are the focus of this issue, when segment endpoints do not reside in one face.

Mock up usage (made with Blender)

Polygon mesh is given (quad mesh in this example), plus the highlighted points. The highlighted points are endpoints of the geodesic trace query, and the query results are the edges drawn across the faces, represented as ordered edge intersection points. image image

My current but insufficient workarounds

In the simple case that the endpoints of a segment reside on different faces that share exactly one edge (sometimes, see the last failure case below), I work around the problem by calculating where the curve segment would intersect the shared edge if the adjacent faces were unfolded. The intersection point is used to subdivide both the curve segment and the mesh edge so that the curve conforms to the surface. This workaround calculates a straightest geodesic (see first mockup image), but it does not cover all cases. Specifically, it cannot handle the following cases of segment endpoint locations that I have encountered:

How can I help?

If no one is working on such a solution, how can I do it myself? Off the top of my head, I recognize several changes that must be made to implement the algorithm:

Holdover options

Since this problem is only part of a larger project, I have to choose some other workaround that does not fail in the meantime. I am aware that I can simply triangulate the given mesh, perhaps with constrained Delaunay triangulation, then use the existing computeLogMap and traceGeodesic functions. However, as noted by Fernando de Goes, Andrew Butts, and Mathieu Desbrun. [2020], Figure 2, triangulating a mesh may lead to inaccurate parameterizations, and I would like to avoid that where possible. I am open to suggestions.