Skip to content

SDF internals, ray consensus, improved intersections performance#36

Open
clbarnes wants to merge 17 commits into
masterfrom
signed-dist
Open

SDF internals, ray consensus, improved intersections performance#36
clbarnes wants to merge 17 commits into
masterfrom
signed-dist

Conversation

@clbarnes

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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