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

Half space-Convex intersection leads to silent seg fault #468

Closed
SeanCurtis-TRI opened this issue Apr 30, 2020 · 1 comment · Fixed by #469
Closed

Half space-Convex intersection leads to silent seg fault #468

SeanCurtis-TRI opened this issue Apr 30, 2020 · 1 comment · Fixed by #469
Assignees

Comments

@SeanCurtis-TRI
Copy link
Contributor

Problem

Creating a scenario where the two geometries are half space and convex shape leads to a seg fault. No warning, no explanation. Just explosion.

Diagnosis

There is no support for half space in the gjk_libccd-inl.h. There is no specialization of GJKInitializer for Halfspace. So, when calling GJKInitializer<Halfspace> its gjk object representation, support function, and center functions are all nullptr. These nullptr's aren't checked, passed to libccd which leads to attempting to dereference the nullptr function pointer. Boom!

Solution

Option 1:

It is may be practical to include a specialization of GJKInitializer for Halfspace. To do so requires the implementation of three methods:

  • createGJKObject()
    • it is not immediately clear what the requirements for this object are.
  • getCenterFunction()
    • Defining a center point of an infinite volume is not well defined.
  • getSupportFunction()
    • This is likewise ill defined. The support point on a half space is infinitely far away in any direction except the normal direction (outward pointing). And in that direction, it is any point on the boundary of the half space.
      These issues are most likely the reason this option hasn't been pursued. It's conceivable that some finite approximation can be introduced that is consistent with libccd, but it's probably not worth it.

Option 2:

Introduce a bespoke collision function between Halfspace and Convex. There are already multiple functions for other shapes (e.g., Sphere, Ellipsoid, etc.). Convex is conspicuously absent.

More particularly, there is an implementation for Halfspace and Convex; it's just not enabled.

This should be enabled, tested, and released to the wild.

@SeanCurtis-TRI
Copy link
Contributor Author

Note: The reason it hasn't been wrapped is that it has the wrong API for that mechanism. It should take an optional std::vector<ContactPoint>* as parameter and not individual Vector3<S>*, S*, and Vector3<S>* for contact points, depth, and normal respectively.

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

Successfully merging a pull request may close this issue.

1 participant