16 #ifndef SURGSIM_COLLISION_REPRESENTATION_H 17 #define SURGSIM_COLLISION_REPRESENTATION_H 19 #include <boost/thread/mutex.hpp> 22 #include <unordered_map> 23 #include <unordered_set> 25 #include "SurgSim/DataStructures/BufferedValue.h" 27 #include "SurgSim/Framework/Representation.h" 28 #include "SurgSim/Math/Aabb.h" 29 #include "SurgSim/Math/Shape.h" 49 typedef std::unordered_map<std::shared_ptr<SurgSim::Collision::Representation>,
50 std::list<std::shared_ptr<SurgSim::Collision::Contact>>> ContactMapType;
53 enum CollisionDetectionType : SURGSIM_ENUM_TYPE;
72 virtual int getShapeType()
const = 0;
76 virtual void setCollisionDetectionType(CollisionDetectionType type);
80 CollisionDetectionType getCollisionDetectionType()
const;
84 virtual void setSelfCollisionDetectionType(CollisionDetectionType type);
88 CollisionDetectionType getSelfCollisionDetectionType()
const;
92 virtual std::shared_ptr<SurgSim::Math::Shape> getShape()
const = 0;
110 void addContact(
const std::shared_ptr<Representation>& other,
111 const std::shared_ptr<SurgSim::Collision::Contact>& contact);
116 bool collidedWith(
const std::shared_ptr<Representation>& other);
120 virtual void update(
const double& dt);
123 virtual void updateShapeData();
126 virtual void updateDcdData();
131 virtual void updateCcdData(
double timeOfImpact);
137 bool ignore(
const std::string& fullName);
143 bool ignore(
const std::shared_ptr<Representation>& representation);
150 void setIgnoring(
const std::vector<std::string>& fullNames);
155 bool isIgnoring(
const std::string& fullName)
const;
160 bool isIgnoring(
const std::shared_ptr<Representation>& representation)
const;
170 bool allow(
const std::string& fullName);
180 bool allow(
const std::shared_ptr<Representation>& representation);
187 void setAllowing(
const std::vector<std::string>& fullNames);
192 bool isAllowing(
const std::string& fullName)
const;
197 bool isAllowing(
const std::shared_ptr<Representation>& representation)
const;
200 virtual Math::Aabbd getBoundingBox()
const;
204 void invalidatePosedShapeMotion();
208 std::vector<std::string> getIgnoring()
const;
212 std::vector<std::string> getAllowing()
const;
214 void doRetire()
override;
219 std::shared_ptr<Framework::Logger> m_logger;
224 double m_aabbThreshold;
231 CollisionDetectionType m_collisionDetectionType;
234 CollisionDetectionType m_selfCollisionDetectionType;
242 boost::mutex m_collisionsMutex;
248 mutable boost::shared_mutex m_posedShapeMotionMutex;
251 std::unordered_set<std::string> m_ignoring;
254 std::unordered_set<std::string> m_allowing;
260 SURGSIM_SERIALIZABLE_ENUM(SurgSim::Collision::CollisionDetectionType,
261 (COLLISION_DETECTION_TYPE_NONE)
262 (COLLISION_DETECTION_TYPE_DISCRETE)
263 (COLLISION_DETECTION_TYPE_CONTINUOUS)
264 (MAX_COLLISION_DETECTION_TYPES))
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
The convenience header that provides the entirety of the logging API.
double m_oldVolume
Definition: Representation.h:223
PosedShape is a transformed shape with a record of the pose used to transform it. ...
Definition: Shape.h:128
The type of collision detection.
Definition: Representation.h:60
PosedShapeMotion is embedding the motion of a PosedShape, providing a posed shape at 2 different inst...
Definition: Shape.h:156
Representations are manifestations of a SceneElement.
Definition: Representation.h:33