iMSTK issueshttps://gitlab.kitware.com/iMSTK/iMSTK/-/issues2022-10-09T23:59:46-04:00https://gitlab.kitware.com/iMSTK/iMSTK/-/issues/477CCD Bug when Geometries are Flipped2022-10-09T23:59:46-04:00Andrew WilsonCCD Bug when Geometries are FlippedAt the moment you can do something along the lines of:
```
SphereToCapsuleCD cd;
cd.setInputA(sphere);
cd.setInputB(capsule);
cd.update();
SphereToCapsuleCD cd;
cd.setInputA(capsule);
cd.setInputB(sphere);
cd.update();
```
When flipping...At the moment you can do something along the lines of:
```
SphereToCapsuleCD cd;
cd.setInputA(sphere);
cd.setInputB(capsule);
cd.update();
SphereToCapsuleCD cd;
cd.setInputA(capsule);
cd.setInputB(sphere);
cd.update();
```
When flipping you get the output flipped. This makes it easy for user code to not have to guarantee orders for each CD method. Then the callee can simply ask for outputA and get the relevant output.
The CCD in PbdObjectCollision does this:
```
pbdCCD->updatePreviousTimestepGeometry(pbdCCD->getInput(0), pbdCCD->getInput(1));
```
This does not handle reversible inputs. If SphereToCapsuleCCD where to be created. Input0 would have to be sphere. Input1 would have to be capsule. If reversed failure would occur.
In most instances we use it for self collision, there it's a non-issue. There's a possibility using it for two separate line meshes in the reversed order would fail.https://gitlab.kitware.com/iMSTK/iMSTK/-/issues/473Missing Pbd Rigid Collision Case2022-10-03T23:14:51-04:00Andrew WilsonMissing Pbd Rigid Collision CaseToday I discovered a missing case in pbd rigid collisions.
Mostly we do collisions of rigids vs deformable. In the few instances of rigid vs rigid we mostly have point based contacts which are supported. But in a few cases there are poi...Today I discovered a missing case in pbd rigid collisions.
Mostly we do collisions of rigids vs deformable. In the few instances of rigid vs rigid we mostly have point based contacts which are supported. But in a few cases there are point (rigid) vs edge (rigid). Rigid edge and rigid triangle are not handled at the moment.https://gitlab.kitware.com/iMSTK/iMSTK/-/issues/472Expose LineMeshToLineMeshCCD Thickness parameter2022-10-04T21:50:54-04:00Andrew WilsonExpose LineMeshToLineMeshCCD Thickness parameterThis parameter effects how far (in meters) the line is resolved/rested at after resolution. This allows it to sort of "float" above the other line and avoids any floating point or multi contact errors. The issue being that if a collision...This parameter effects how far (in meters) the line is resolved/rested at after resolution. This allows it to sort of "float" above the other line and avoids any floating point or multi contact errors. The issue being that if a collision is missed even for one frame the line can pop through and never be resolved.
This parameter is very likely to change with space/scale of the simulation. Currently tuned to meters.https://gitlab.kitware.com/iMSTK/iMSTK/-/issues/461Create Benchmark for CCD operations2022-08-09T11:36:53-04:00Harald ScheirichCreate Benchmark for CCD operationshttps://gitlab.kitware.com/iMSTK/iMSTK/-/issues/457CCD On Scene Reset2022-07-28T17:21:31-04:00Andrew WilsonCCD On Scene ResetOn scene reset CCD does not invalidate the previous geometry/clear it/set to nullptr. So if the geometry moves it will see it as a large jump.On scene reset CCD does not invalidate the previous geometry/clear it/set to nullptr. So if the geometry moves it will see it as a large jump.https://gitlab.kitware.com/iMSTK/iMSTK/-/issues/387SurfaceMeshToMeshCD2022-06-01T16:15:39-04:00Andrew WilsonSurfaceMeshToMeshCDWe currently have ClosedSurfaceMeshToMeshCD. This only works for closed surfaces. It is good for deep contacts.
We do not have the more traditional SurrfaceMeshtoMeshCD, which only locally gives resolution. IE: It checks intersection be...We currently have ClosedSurfaceMeshToMeshCD. This only works for closed surfaces. It is good for deep contacts.
We do not have the more traditional SurrfaceMeshtoMeshCD, which only locally gives resolution. IE: It checks intersection between all the elements (triangles or lines). Then computes resolutions of those elements. The hope being that only small overlaps occur at small dts and if deep contacts happen they would eventually resolve (objects could get stuck). The pro of this method is that it is easily spatially partitioned whereas ClosedSurfaceMeshToMeshCD is not as it tries to find global resolution.
This is usually done with a clipping method. Such method can be found in Bullet or ODE.https://gitlab.kitware.com/iMSTK/iMSTK/-/issues/347Remaining Collision Detection Unit Tests2022-06-02T19:38:53-04:00Andrew WilsonRemaining Collision Detection Unit TestsThe following CD methods could use unit tests:
- [x] BidirectionalPlaneToSphereCD
- [ ] ImplicitGeometryToPointSetCCD
- [ ] ImplicitGeometryToPointSetCD
- [x] MeshToMeshBruteForceCD (Manual tests exist in examples BoxBoxTest)
- [x] Point...The following CD methods could use unit tests:
- [x] BidirectionalPlaneToSphereCD
- [ ] ImplicitGeometryToPointSetCCD
- [ ] ImplicitGeometryToPointSetCD
- [x] MeshToMeshBruteForceCD (Manual tests exist in examples BoxBoxTest)
- [x] PointSetToCapsuleCD
- [x] PointSetToPlaneCD
- [x] SphereToCylinderCD
- [x] SurfaceMeshToSphereCD (Manual tests exist in examples TriangleVsSphereTest)
- [ ] SurfaceMeshToSurfaceMeshCD (Manual test exists in examples TriangleVsTriangleTest)
- [x] TetraToLineMeshCD
- [x] TetraToPointSetCD
- [x] UnidirectionalPlaneToSphereCD
One can use/copy the structure of the existing CD unit tests to implement.
Use the following branch: https://gitlab.kitware.com/andrew.wilson/iMSTK/-/tree/CDHRefactorhttps://gitlab.kitware.com/iMSTK/iMSTK/-/issues/346Analytical gradient of SDF2021-07-27T13:41:03-04:00Jianfeng YanAnalytical gradient of SDFCurrently we use finite difference to compute the gradient of signed distance field. Alternatively, it can be computed directly based on the coordinates, by taking the gradient of the basis functions. The benefits include
- subject to n...Currently we use finite difference to compute the gradient of signed distance field. Alternatively, it can be computed directly based on the coordinates, by taking the gradient of the basis functions. The benefits include
- subject to no round-off errors
- efficiency. The gradient is just an explicit linear function of the coordinates.https://gitlab.kitware.com/iMSTK/iMSTK/-/issues/343Inverse SDF Collision Detection2021-07-26T11:52:50-04:00Andrew WilsonInverse SDF Collision DetectionWhilst we have static SDF collision detection rigid SDF collision detection is also relatively easy. Supply the CD with a rigid transform and we can inverse transform back into the SDF for CD. This should be as simple as applying the cur...Whilst we have static SDF collision detection rigid SDF collision detection is also relatively easy. Supply the CD with a rigid transform and we can inverse transform back into the SDF for CD. This should be as simple as applying the currently set geometries transform inverse to every point before sampling in the SDF for ImplicitGeometryToPointSetCD.
We can also do it for tetrahedral meshes by inversing the deformation of the tetrahedron.https://gitlab.kitware.com/iMSTK/iMSTK/-/issues/342Voronoi Based Static Collision Detection2021-07-25T22:22:58-04:00Andrew WilsonVoronoi Based Static Collision DetectionVoronoi's can be computed for static geometry, inversely mapped for rigid, or inverse transformed via tetrahedron deformation.
These can quickly give closest features during collision detection.Voronoi's can be computed for static geometry, inversely mapped for rigid, or inverse transformed via tetrahedron deformation.
These can quickly give closest features during collision detection.https://gitlab.kitware.com/iMSTK/iMSTK/-/issues/341Add Primitive Static Collision Detections2022-09-29T13:09:44-04:00Andrew WilsonAdd Primitive Static Collision Detections - Some of the less useful ones are not listed.
- This only details primitive (cylinder, capsule, sphere, oriented box, plane) collisions.
SurfaceMesh (most useful and difficult):
- [x] SurfaceMeshToSphereCD
- [x] SurfaceMeshToCapsuleC... - Some of the less useful ones are not listed.
- This only details primitive (cylinder, capsule, sphere, oriented box, plane) collisions.
SurfaceMesh (most useful and difficult):
- [x] SurfaceMeshToSphereCD
- [x] SurfaceMeshToCapsuleCD
- Easiest of the surface mesh ones.
- [ ] SurfaceMeshToCylinderCD (involves both curved surface and sharp edges)
- [ ] SurfaceMeshToOrientedBoxCD
LineMesh:
- [x] LineMeshToSphereCD (easy) (do this before capsule)
- [x] LineMeshToCapsuleCD (easy) (useful)
- [ ] LineMeshToCylinderCD
- [ ] LineMeshToOrientedBoxCD
PointSet:
- [x] PointSetToCapsuleCD
- [x] PointSetToOrientedBoxCD
- [x] PointSetToPlaneCD
- [x] PointSetToSphereCD
- [x] PointSetToCylinderCD
- [x] ImplicitGeometryToPointSetCD
- [x] ImplicitGeometryToPointSetCCD
Primitive v Primitive (these tend to be less common in medical scenarios):
- [x] SphereToSphereCD
- [x] SphereToCylinderCD
- [x] BidirectionalPlaneToSphereCD
- [x] UnidirectionalPlaneToSphereCD
- [x] CapsuleToCapsuleCD
- [x] CapsuleToSphereCD (easy, closest point on capsule edge to sphere center)
- [x] CapsuleToPlaneCD (easy, closest point on capsule edge to plane)
- [ ] CylinderToPlaneCD
- [ ] CylinderToOrientedBoxCD
- [ ] CylinderToCylinderCD
... Other Permutations ...
... BidirectionalPlane Permutations ...
These can be added via unit tests (see existing CD unit tests). You don't need to implement them in some fancy simulation or verify against models, just check the CollisionData output. An accompanying example or interactive visual test for those complex ones might be useful. CollisionDataDebugObject may be used to draw contact, see BoxToBoxTest in Examples/CollisionDetection.
Do not add any spatial acceleration. That will be patterned out later for all CDs.
See CollisionUtils.h for a place to put all your collision/intersection functions. There are a number of existing basic ones provided: closest point on two lines. Closest point on triangle.