nmwsharp / potpourri3d

An invigorating blend of 3D geometry tools in Python.
MIT License
414 stars 31 forks source link

Geodesic from a predefined path? #2

Closed panangam closed 3 years ago

panangam commented 3 years ago

Thank you so much for making the python binding! I use mainly use python for geometry stuff, so this is extremely helpful.

I'm working on some anthropometry, and trying to extract the rise curve, from the navel down the crotch and up to the lower back. I'm trying to use the edge flip solver for this, but the shorter path it found is around the side of the torso. According to the paper, it seems it should be possible to optimize a path through a different direction. Would that be possible to do with the python binding?

Screen Shot 2021-05-27 at 10 22 20 AM
nmwsharp commented 3 years ago

Hi! Glad this is useful for you!

You're right that this is certainly possible with the flip geodesic method, but previously it was not exposed in the bindings.

I've just added a new function to the bindings called find_geodesic_path_poly() which takes a input a list of vertices, finds an initial path by running Dijkstra between each consecutive vertex, then straightens that path to be a geodesic.

We can use it for your example by passing as input a list of three vertices path = solver.find_geodesic_path_poly([v_start, v_middle, v_end]), where v_start is on the navel, v_middle is near the crotch, and v_end is on the lower back. This gives me the result below.

screenshot_000000

The CI system is currently building a new version of the library with this function added, should be available on pip soon.

panangam commented 3 years ago

This is perfect, thank you! Gonna close then.