![]() |
Base class responsible for calculating contact data between two objects. More...
#include <SurgSim/Collision/ContactCalculation.h>
Public Types | |
typedef std::array< std::array< std::shared_ptr< ContactCalculation >, Math::SHAPE_TYPE_COUNT >, Math::SHAPE_TYPE_COUNT > | TableType |
Public Member Functions | |
ContactCalculation () | |
Constructor. More... | |
virtual | ~ContactCalculation () |
Destructor. More... | |
void | calculateContact (std::shared_ptr< CollisionPair > pair) |
Calculate the contacts for a given pair. More... | |
std::list< std::shared_ptr< Contact > > | calculateDcdContact (const Math::PosedShape< std::shared_ptr< Math::Shape >> posedShape1, const Math::PosedShape< std::shared_ptr< Math::Shape >> posedShape2) |
Calculate the dcd contacts between two posed/transformed shapes. More... | |
std::list< std::shared_ptr< Contact > > | calculateCcdContact (const Math::PosedShapeMotion< std::shared_ptr< Math::Shape >> posedShapeMotion1, const Math::PosedShapeMotion< std::shared_ptr< Math::Shape >> posedShapeMotion2) |
Calculate the ccd contacts between two posed/transformed shapes. More... | |
virtual std::pair< int, int > | getShapeTypes ()=0 |
Virtual function that returns the shapes that this ContactCalculation class handles. More... | |
Static Public Member Functions | |
static void | registerDcdContactCalculation (const std::shared_ptr< ContactCalculation > &calculation) |
Register an instance of a contact calculation in the table. More... | |
static void | registerCcdContactCalculation (const std::shared_ptr< ContactCalculation > &calculation) |
Register an instance of a contact calculation in the table. More... | |
static const TableType & | getDcdContactTable () |
static const TableType & | getCcdContactTable () |
Private Member Functions | |
virtual void | doCalculateContact (std::shared_ptr< CollisionPair > pair) |
Calculate the actual contact between two shapes of the given CollisionPair. More... | |
virtual std::list< std::shared_ptr< Contact > > | doCalculateDcdContact (const Math::PosedShape< std::shared_ptr< Math::Shape >> &posedShape1, const Math::PosedShape< std::shared_ptr< Math::Shape >> &posedShape2) |
Virtual function receives the call from the public interface, usually will type the shapes statically to their known types and then execute a specific contact calculation between the two shapes. More... | |
virtual std::list< std::shared_ptr< Contact > > | doCalculateCcdContact (const Math::PosedShapeMotion< std::shared_ptr< Math::Shape >> &posedShapeMotion1, const Math::PosedShapeMotion< std::shared_ptr< Math::Shape >> &posedShapeMotion2) |
Virtual function receives the call from the public interface, usually will type the shapes statically to their known types and then execute a specific contact calculation between the two shapes. More... | |
Static Private Member Functions | |
static void | initializeTables () |
Statically initialize the tables, used via call once. More... | |
static void | privateDcdRegister (const std::shared_ptr< ContactCalculation > &calculation, const std::pair< int, int > &types) |
static void | privateDcdRegister (const std::shared_ptr< ContactCalculation > &calculation) |
static void | privateCcdRegister (const std::shared_ptr< ContactCalculation > &calculation, const std::pair< int, int > &types) |
static void | privateCcdRegister (const std::shared_ptr< ContactCalculation > &calculation) |
Static Private Attributes | |
static TableType | m_contactDcdCalculations |
Static table of Dcd contact calculations. More... | |
static TableType | m_contactCcdCalculations |
Static table of Ccd contact calculations. More... | |
static std::once_flag | m_initializationFlag |
Flag used for initialization. More... | |
Base class responsible for calculating contact data between two objects.
It is used for determining whether two objects intersect. If there is contact, new Contacts are calculated.
typedef std::array<std::array<std::shared_ptr<ContactCalculation>, Math::SHAPE_TYPE_COUNT>, Math::SHAPE_TYPE_COUNT> SurgSim::Collision::ContactCalculation::TableType |
SurgSim::Collision::ContactCalculation::ContactCalculation | ( | ) |
Constructor.
|
virtual |
Destructor.
std::list< std::shared_ptr< SurgSim::Collision::Contact > > SurgSim::Collision::ContactCalculation::calculateCcdContact | ( | const Math::PosedShapeMotion< std::shared_ptr< Math::Shape >> | posedShapeMotion1, |
const Math::PosedShapeMotion< std::shared_ptr< Math::Shape >> | posedShapeMotion2 | ||
) |
Calculate the ccd contacts between two posed/transformed shapes.
posedShapeMotion1,posedShapeMotion2 | The two posed shape motion to calculate ccd contact for |
void SurgSim::Collision::ContactCalculation::calculateContact | ( | std::shared_ptr< CollisionPair > | pair | ) |
Calculate the contacts for a given pair.
pair | A CollisionPair that is under consideration, new contacts will be added to this pair |
std::list< std::shared_ptr< Contact > > SurgSim::Collision::ContactCalculation::calculateDcdContact | ( | const Math::PosedShape< std::shared_ptr< Math::Shape >> | posedShape1, |
const Math::PosedShape< std::shared_ptr< Math::Shape >> | posedShape2 | ||
) |
Calculate the dcd contacts between two posed/transformed shapes.
posedShape1,posedShape2 | The two posed shape to consider for this dcd contact calculation |
|
privatevirtual |
Virtual function receives the call from the public interface, usually will type the shapes statically to their known types and then execute a specific contact calculation between the two shapes.
posedShapeMotion1,posedShapeMotion2 | The two posed shapes motion to calculate ccd contact for |
Reimplemented in SurgSim::Collision::ShapeShapeContactCalculation< Shape1, Shape2 >, SurgSim::Collision::ShapeShapeContactCalculation< Math::MeshShape, Math::PlaneShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::MeshShape, Math::MeshShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::SegmentMeshShape, Math::SegmentMeshShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::BoxShape, Math::DoubleSidedPlaneShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::BoxShape, Math::CapsuleShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::MeshShape, Math::ParticlesShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::SegmentMeshShape, Math::MeshShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::SphereShape, Math::SphereShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::SphereShape, Math::PlaneShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::MeshShape, Math::SurfaceMeshShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::CapsuleShape, Math::SphereShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::SphereShape, Math::DoubleSidedPlaneShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::BoxShape, Math::PlaneShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::BoxShape, Math::SphereShape >, SurgSim::Collision::DefaultContactCalculation, and SurgSim::Collision::CompoundShapeContact.
|
privatevirtual |
Calculate the actual contact between two shapes of the given CollisionPair.
pair | The symmetric pair that is under consideration. |
Reimplemented in SurgSim::Collision::DefaultContactCalculation.
|
privatevirtual |
Virtual function receives the call from the public interface, usually will type the shapes statically to their known types and then execute a specific contact calculation between the two shapes.
posedShape1,posedShape2 | The two posed shapes to calculate dcd contact for |
Reimplemented in SurgSim::Collision::ShapeShapeContactCalculation< Shape1, Shape2 >, SurgSim::Collision::ShapeShapeContactCalculation< Math::MeshShape, Math::PlaneShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::MeshShape, Math::MeshShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::SegmentMeshShape, Math::SegmentMeshShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::BoxShape, Math::DoubleSidedPlaneShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::BoxShape, Math::CapsuleShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::MeshShape, Math::ParticlesShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::SegmentMeshShape, Math::MeshShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::SphereShape, Math::SphereShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::SphereShape, Math::PlaneShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::MeshShape, Math::SurfaceMeshShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::CapsuleShape, Math::SphereShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::SphereShape, Math::DoubleSidedPlaneShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::BoxShape, Math::PlaneShape >, SurgSim::Collision::ShapeShapeContactCalculation< Math::BoxShape, Math::SphereShape >, SurgSim::Collision::OctreeContact, SurgSim::Collision::DefaultContactCalculation, and SurgSim::Collision::CompoundShapeContact.
|
static |
|
static |
|
pure virtual |
Virtual function that returns the shapes that this ContactCalculation class handles.
Implemented in SurgSim::Collision::SegmentSelfContact, SurgSim::Collision::BoxSphereContact, SurgSim::Collision::BoxPlaneContact, SurgSim::Collision::TriangleMeshParticlesContact, SurgSim::Collision::TriangleMeshSurfaceMeshContact, SurgSim::Collision::BoxDoubleSidedPlaneContact, SurgSim::Collision::SphereDoubleSidedPlaneContact, SurgSim::Collision::TriangleMeshTriangleMeshContact, SurgSim::Collision::CapsuleSphereContact, SurgSim::Collision::SpherePlaneContact, SurgSim::Collision::BoxCapsuleContact, SurgSim::Collision::DefaultContactCalculation, SurgSim::Collision::SphereSphereContact, SurgSim::Collision::TriangleMeshPlaneContact, SurgSim::Collision::SegmentMeshTriangleMeshContact, SurgSim::Collision::CompoundShapeContact, SurgSim::Collision::OctreeCapsuleContact, SurgSim::Collision::OctreeDoubleSidedPlaneContact, SurgSim::Collision::OctreePlaneContact, and SurgSim::Collision::OctreeSphereContact.
|
staticprivate |
Statically initialize the tables, used via call once.
|
staticprivate |
registration to call at static scope (does not protect the initialization via call_once) Mirroring the public functions
|
staticprivate |
registration to call at static scope (does not protect the initialization via call_once) Mirroring the public functions
|
staticprivate |
registration to call at static scope (does not protect the initialization via call_once) Mirroring the public functions
|
staticprivate |
registration to call at static scope (does not protect the initialization via call_once) Mirroring the public functions
|
static |
Register an instance of a contact calculation in the table.
calculation | The calculation to be registered |
|
static |
Register an instance of a contact calculation in the table.
calculation | The calculation to be registered |
|
staticprivate |
Static table of Ccd contact calculations.
|
staticprivate |
Static table of Dcd contact calculations.
|
staticprivate |
Flag used for initialization.