Skip to content

ENH: CD and CH Refactored to Deal With Ambiguities

Andrew Wilson requested to merge andrew.wilson/iMSTK:CDHRefactor into master

This MR solves a couple of longstanding problems and greatly improves collision capabilities. It makes a lot of major paths that the API was meant to allow but did not provide, possible.

1.) CollisionData now has sides and is reversible.

2.) PbdObject vs CollidingObject is now possible.

  • This opens up PbdObject vs Rigid, SPH, FEM, anything that stems off CollidingObject

3.) PbdCollisionConstraints now use pointers and values instead of DataArray's.

  • This allows collision with objects that don't have DataArrays such as primitives and SDFs.

4.) PbdCollisionConstraints may also solve velocity. This is detailed in the original PBD paper where he suggests assigning contact normals per vertex and perpendicular damping velocity for friction, whilst reflecting and scaling for restitution. This solves a nasty jitter bug in PBD collision whilst providing friction and restitution.

5.) CollisionDetection renamed to CollisionDetectionAlgorithm and now inherits GeometryAlgorithm. The inputs are now also reversible.

  • Inputs are swapped before given to subclass so that implementer doesn't have to worry about order.

  • This is also nice for users as they don't have to worry about providing geometries in a certain way.

  • Output data is dependent on input order. If you give it (PointSet, Sphere) it will produce CollisionData with PointSet resolution info on "left" and Sphere resolution info on the "right". If you give it (Sphere, PointSet) you then get it in the other direction. This is ideal.

6.) CollisionHandler base classes accept CD data either way. Users don't have to worry about flipping input collision data to fit their object order.

7.) PbdPointToEdgeConstraint added. PbdPointDirectionConstraint renamed to PbdPointToPointConstraint

  • Mostly for collision with curved surfaces.

8.) Existing CD's fixed:

  • Triangle vs Triangle intersections were only computing EE and VT data. But missed TV case. There is one outstanding edge case it can't handle.

  • PointSetToCylinderCD was fixed. It was previously implemented as an infinite cylinder.

  • MeshToMeshBruteForceCD was replaced with exact intersection computations via angled weighted psuedonormals. This produces contact data to resolve to the nearest element. In the future this nearest element search can be sped up wtih accelerators (various trees, general BVHs, spatial binning/hashing, & various sweeps).

  • NarrowPhaseCD removed, rewrote in CollisionUtils as global math functions.

9.) DebugGeometry removed, replaced with DebugGeometryObject.

10.) CollisionDataDebugObject extends DebugGeometryObject providing quick visualization of collision data.

11.) PbdCollisionHandler and RigidBodyCH virtual add constraint functions. This is useful for many projects that need to add custom constraints/behaviours on contact.

12.) PbdRigidCollision interaction added. This interaction can be added to the scene for collision interaction between a PbdObject and RigidObject. It defines an explicit two-way interaction. Two one-way constraints added to each system upon collision.

13.) Some collisionDetection methods added.

14.) MeshToMeshBruteForceCD rewritten to use angled-weighted pseudonormal's for deep point resolution. Handles EE case as well.

15.) LineMesh cell attributes added.

16.) LineMeshRenderDelegate, SurfaceMeshRenderDelegate, & PointSetRenderDelegate fixes, update for cell attributes. Import/Export fixes.

17.) Many collision based examples and tests added.

Edited by Andrew Wilson

Merge request reports