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

[Collision.Detection] Give current intersection methods as parameter to intersection functions #4583

Merged
merged 9 commits into from Mar 28, 2024

Conversation

fredroy
Copy link
Contributor

@fredroy fredroy commented Mar 12, 2024

The design of Intersection/Intersector is really "special" in the sense that:

  • Intersection class is the BaseObject in the graph doing stuff
  • Intersector is container of functions for canIntersect/intersect method between different primitives.

And it was made such as one could add more intersect() method for new primitives for an existing "Intersection", e.g MinProximityIntersection and MeshMinProximityIntersection, which add triangles, etc methods to MinProximityIntersection. Note that even if it is called "Intersection" it is not a "Intersection" 🤪
There is kind of mechanism with a IntersectorCreator/IntersectorFactory which does the "plugin" automatically.
The problem is that the intersector gets a pointer to its intersection at the load-time (when the dll is loaded).
The intersector needs the intersection to get alarm/contact distance (defined for all Intersection) or custom parameters (useSurfaceNormal for MinProximityIntersection)

Consequence: if there are multiple simulation (in multiple thread) in the same time, a different thread will get a pointer to an other Intersection while doing its intersect code.

In the end, this PR modifies all the intersect/canIntersect functions to get the intersection method (as if they were static functions in reality) and avoid race conditions. The pipeline needs also to be modified.

[The first version of this branch was using a IntersectionParameters storing alarm, contact distance and given as const ref, but it could not handle custom parameters]

Still need to be done:

  • compat/warnings, etc
  • all broad/narrow phases to be modified (further PR)

By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@fredroy fredroy added pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request pr: dev meeting topic PR to be discussed in sofa-dev meeting labels Mar 12, 2024
@fredroy fredroy marked this pull request as draft March 12, 2024 14:21
@fredroy
Copy link
Contributor Author

fredroy commented Mar 15, 2024

[ci-build][with-all-tests]

@fredroy fredroy force-pushed the intersections_as_param branch 3 times, most recently from fdf45e6 to 0ddc251 Compare March 19, 2024 00:56
@fredroy
Copy link
Contributor Author

fredroy commented Mar 19, 2024

[ci-build][with-all-tests]

@fredroy
Copy link
Contributor Author

fredroy commented Mar 20, 2024

[ci-build][with-all-tests][force-full-build]

@fredroy fredroy marked this pull request as ready for review March 27, 2024 04:04
@fredroy fredroy removed the pr: dev meeting topic PR to be discussed in sofa-dev meeting label Mar 27, 2024
@hugtalbot hugtalbot added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Mar 27, 2024
@hugtalbot hugtalbot merged commit 53f37a8 into sofa-framework:master Mar 28, 2024
11 checks passed
@hugtalbot hugtalbot deleted the intersections_as_param branch March 28, 2024 09:15
bakpaul pushed a commit to bakpaul/sofa that referenced this pull request Apr 8, 2024
…to intersection functions (sofa-framework#4583)

* give current intersection methods as parameter to intersection functions

* test compat method

* add deprecation messages

* more deprecations (stored pointer to intersection) and remove warnings

* Fix SFINAE tests

* fix typos and compat

* fix infinite loop

* add more info for depreciation

---------

Co-authored-by: Hugo <hugo.talbot@sofa-framework.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: fix Fix a bug pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants