Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hertel-Mehlhorn algorithm #63

Merged
merged 2 commits into from
Nov 1, 2021

Conversation

EmbersArc
Copy link
Contributor

Closes #62.

Again, I'm not sure how to make this accessible to the user. I've added it as a method to TriMesh for now, but maybe adding it as CompoundShape::from_trimesh() makes more sense.

Copy link
Member

@sebcrozet sebcrozet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR, this is fantastic!

I suggest the following, to keep it coherent with some other parts of the crate (like convex_hull2):

  • Rename the hertel_mehlhorn function to hertel_mehlhorn_idx.
  • Add a new hertel_mehlhorn function to the hertel_mehlhorn.rs file. This new function returns a Vec<Vec<Point<Real>> (it just calls hertel_mehlhorn_idx and replaces all the indices by the corresponding points).
  • Re-export both hertel_mehlhorn and hertel_mehlhorn_idx from the transformation_module.
  • Like you suggested, I think it is better to add a CompoundShape::from_trimesh() instead of adding the method to TriMesh. I’m not sure about the naming though. from_trimesh may suggest that we are converting each triangle to it’s own shape in the compound. Maybe we should call it something like CompoundShape::decompose_trimesh.

@EmbersArc
Copy link
Contributor Author

Thanks for the review @sebcrozet! I've applied the suggestions in 7d9026b.

@sebcrozet sebcrozet merged commit d913a2f into dimforge:master Nov 1, 2021
@sebcrozet
Copy link
Member

Perfect, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create compound shape from 2D trimesh (Hertel-Mehlhorn algorithm)
2 participants