iMSTK
Interactive Medical Simulation Toolkit
imstkImplicitGeometryToPointSetCCD.h
1 /*
2 ** This file is part of the Interactive Medical Simulation Toolkit (iMSTK)
3 ** iMSTK is distributed under the Apache License, Version 2.0.
4 ** See accompanying NOTICE for details.
5 */
6 
7 #pragma once
8 
9 #include "imstkCollisionDetectionAlgorithm.h"
10 #include "imstkImplicitFunctionFiniteDifferenceFunctor.h"
11 #include "imstkMacros.h"
12 
13 namespace imstk
14 {
15 template<typename T, int N> class VecDataArray;
16 
17 class ImplicitGeometry;
18 class PointSet;
19 
31 {
32 public:
34  ~ImplicitGeometryToPointSetCCD() override = default;
35 
36  IMSTK_TYPE_NAME(ImplicitGeometryToPointSetCCD)
37 
38 protected:
39  void setupFunctions(std::shared_ptr<ImplicitGeometry> implicitGeom, std::shared_ptr<PointSet> pointSet);
40 
45  std::shared_ptr<Geometry> geomA,
46  std::shared_ptr<Geometry> geomB,
47  std::vector<CollisionElement>& elementsA,
48  std::vector<CollisionElement>& elementsB) override;
49 
54  std::shared_ptr<Geometry> geomA,
55  std::shared_ptr<Geometry> geomB,
56  std::vector<CollisionElement>& elementsA) override;
57 
62  std::shared_ptr<Geometry> geomA,
63  std::shared_ptr<Geometry> geomB,
64  std::vector<CollisionElement>& elementsB) override;
65 
66 private:
67  ImplicitFunctionCentralGradient m_centralGrad;
68 
69  std::shared_ptr<VecDataArray<double, 3>> m_displacementsPtr;
70 
71  std::unordered_map<int, Vec3d> m_prevOuterElement;
72  std::unordered_map<int, int> m_prevOuterElementCounter;
73 
74  // Penetration depths are clamped to this ratio * displacement of the vertex
75  double m_depthRatioLimit = 0.3;
76 };
77 } // namespace imstk
Base class for all geometries represented by discrete points and elements The pointsets follow a pipe...
Definition: imstkPointSet.h:25
Base class for all collision detection classes. CollisionDetection classes produce CollisionData betw...
void computeCollisionDataA(std::shared_ptr< Geometry > geomA, std::shared_ptr< Geometry > geomB, std::vector< CollisionElement > &elementsA) override
Compute collision data for side A.
Compound Geometry.
void computeCollisionDataAB(std::shared_ptr< Geometry > geomA, std::shared_ptr< Geometry > geomB, std::vector< CollisionElement > &elementsA, std::vector< CollisionElement > &elementsB) override
Compute collision data for AB simultaneously.
Simple dynamic array implementation that also supports event posting and viewing/facade.
Gradient given by central finite differences.
ImplicitGeometry to PointSet continous collision detection. This CD method marches along the displace...
void computeCollisionDataB(std::shared_ptr< Geometry > geomA, std::shared_ptr< Geometry > geomB, std::vector< CollisionElement > &elementsB) override
Compute collision data for side B.
Class that can represent the geometry of multiple implicit geometries as boolean functions One may su...