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

SDF internals, ray consensus, improved intersections performance #36

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

clbarnes
Copy link
Owner

Supercedes #34

Also refactors to reduce copies into numpy arrays,
and use vecs of vecs less.
So that it is actually signed.
Also some documentation.
- private method _sdf_intersections, which casts rays and returns the
  distance to a mesh and the dot product of the ray and the face normal
- containment checks now may use signed distance, which is slower in
  real-world meshes but more robust
- ray-based containment checks now may use consensus of a number of rays
- different containment check strategies are benchmarked
switch to pseudonormal containment check is now n_rays=0 rather than
None, due to PyO3/pyo3#3735
@clbarnes
Copy link
Owner Author

Downstream users should note:

  • threads is now a keyword-only argument for the query methods
  • validate should now be a Validation enum rather than a bool
    • we try not to use validation from the trimesh library, instead using the validation built into the underlying rust
    • Validation.min() does the minimum required, Validation.default() == Validation.all() which does all. Validations are intflags which should be combined with |.
  • for Volume.contains:
    • you can now set the number of rays used (<= the number given on instantiation). If None, uses all, if < 1, doesn't use rays at all and does a proper containment check, which is usually slower and depends on a valid mesh.
    • you can now set the number of rays which must hit a backface in order for a point to be considered internal. Previously it was all, now it's by default (None) a simple majority of the rays cast. There are short circuits internally to minimise ray casts where possible.

@clbarnes
Copy link
Owner Author

@schlegelp @ceesem , probably best to pin your ncollpyde usage to <0.20 for now, then that can be bumped when the usage is updated.

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.

1 participant