16 #ifndef SURGSIM_COLLISION_ELEMENTCONTACTFILTER_H 17 #define SURGSIM_COLLISION_ELEMENTCONTACTFILTER_H 28 class PhysicsManagerState;
37 SURGSIM_STATIC_REGISTRATION(ElementContactFilter);
48 bool doInitialize()
override;
50 bool doWakeUp()
override;
56 void setFilter(
const std::shared_ptr<Framework::Component>& other,
const std::vector<size_t>& indices);
61 const std::vector<size_t>& getFilter(
const std::shared_ptr<Framework::Component>& other)
const;
65 void setRepresentation(
const std::shared_ptr<SurgSim::Framework::Component>& val);
68 std::shared_ptr<SurgSim::Collision::Representation> getRepresentation()
const;
72 typedef std::vector<std::pair<std::shared_ptr<SurgSim::Framework::Component>, std::vector<size_t>>>
FilterMapType;
74 void setFilterElements(
const FilterMapType& filterElements);
76 FilterMapType getFilterElements();
78 void doFilterContacts(
79 const std::shared_ptr<Physics::PhysicsManagerState>& state,
80 const std::shared_ptr<CollisionPair>& pair)
override;
83 void doUpdate(
double dt)
override;
87 std::shared_ptr<SurgSim::Framework::Logger>
m_logger;
93 std::unordered_map<Framework::Component*, std::vector<size_t>>
m_writeBuffer;
95 std::unordered_map<Framework::Component*, std::vector<size_t>>
m_filters;
102 const std::shared_ptr<CollisionPair>& pair,
104 const std::vector<size_t>& filter);
114 const T&
pairAt(
const std::pair<T, T>& p,
size_t i)
116 SURGSIM_ASSERT(i == 0 || i == 1) <<
"Index for pair must be 0 or 1.";
117 return (i == 0) ? p.first : p.second;
129 SURGSIM_ASSERT(i == 0 || i == 1) <<
"Index for pair must be 0 or 1.";
130 return (i == 0) ? p.first : p.second;
Definition: CompoundShapeToGraphics.cpp:29
T & pairAt(std::pair< T, T > &p, size_t i)
Get member of pair data via indexed access, the members of the pair have to have the same type non-co...
Definition: ElementContactFilter.h:127
#define SURGSIM_ASSERT(condition)
Assert that condition is true.
Definition: Assert.h:77
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21