Skip to content

[Feature Request] Optionally return path from trace_geodesic as barycentric points #33

@DescriptiveNachos

Description

@DescriptiveNachos

Feature summary:
Allow GeodesicTracer.trace_geodesic_from_vertex (and GeodesicTracer.trace_geodesic_from_face) to optionally return the resulting path in barycentric or similar form, preserving its relationship to the underlying mesh. For example to use the trace as input to signed distance computation.

First of all, I want to thank you very much for your amazing work and for sharing such a comprehensive code base!

When using trace_geodesic it would be very helpful to maintain the relationship between the resulting polyline and the underlying mesh. One usecase being to be able to pipe its output to a signed distance computation. If I understand correctly, geometry-central internally represents paths using SurfacePoint objects, which store this information, but it seems to be lost in the PyVista wrapper.

I think the relevant logic is here https://github.com/nmwsharp/potpourri3d/blob/master/src/cpp/mesh.cpp#L618-L625

   DenseMatrix<double> trace_geodesic_worker(SurfacePoint start_point, Vector2 start_dir,
                                            size_t max_iters = INVALID_IND) {
    ...
    // Extract the path and store it in the vector
    DenseMatrix<double> out(result.pathPoints.size(), 3);
    for (size_t i = 0; i < result.pathPoints.size(); i++) {
      Vector3 point = result.pathPoints[i].interpolate(geom->vertexPositions);
      for (size_t j = 0; j < 3; j++) {
        out(i, j) = point[j];
      }
    }

It seems this section could be extended (or optionally modified) to either replace or expand the translation of the TraceGeodesicResult.pathPoints into Vector3 points by barycentric points or a similar format. However I'm not yet sure of the up and downstream implications of such a change.
I'd be very happy to hear your thoughts on this request. If you do not have the time to implement the change yourself I could try to implement it myself and provide a PR. In any case, I'd be thankful for an assessment of the feasability of such an adaptation and whether I'm on the right track here.

Thank you very much in advance for your response!!

(I'm not too confident in my understanding of especially the underlying geometry central lib, so please excuse if this is way off track)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions