Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
SurgSim::Collision::ContactCalculation Class Referenceabstract

Base class responsible for calculating contact data between two objects. More...

#include <SurgSim/Collision/ContactCalculation.h>

Inheritance diagram for SurgSim::Collision::ContactCalculation:
SurgSim::Collision::ShapeShapeContactCalculation< Math::BoxShape, Math::CapsuleShape > SurgSim::Collision::ShapeShapeContactCalculation< Math::BoxShape, Math::DoubleSidedPlaneShape > SurgSim::Collision::ShapeShapeContactCalculation< Math::BoxShape, Math::PlaneShape > SurgSim::Collision::ShapeShapeContactCalculation< Math::BoxShape, Math::SphereShape > SurgSim::Collision::ShapeShapeContactCalculation< Math::CapsuleShape, Math::SphereShape > SurgSim::Collision::ShapeShapeContactCalculation< Math::MeshShape, Math::MeshShape > SurgSim::Collision::ShapeShapeContactCalculation< Math::MeshShape, Math::ParticlesShape > SurgSim::Collision::ShapeShapeContactCalculation< Math::MeshShape, Math::PlaneShape > SurgSim::Collision::ShapeShapeContactCalculation< Math::MeshShape, Math::SurfaceMeshShape > SurgSim::Collision::ShapeShapeContactCalculation< Math::SegmentMeshShape, Math::MeshShape > SurgSim::Collision::ShapeShapeContactCalculation< Math::SegmentMeshShape, Math::SegmentMeshShape > SurgSim::Collision::ShapeShapeContactCalculation< Math::SphereShape, Math::DoubleSidedPlaneShape > SurgSim::Collision::ShapeShapeContactCalculation< Math::SphereShape, Math::PlaneShape > SurgSim::Collision::ShapeShapeContactCalculation< Math::SphereShape, Math::SphereShape > SurgSim::Collision::CompoundShapeContact SurgSim::Collision::DefaultContactCalculation SurgSim::Collision::OctreeContact SurgSim::Collision::ShapeShapeContactCalculation< Shape1, Shape2 >

Public Types

typedef std::array< std::array< std::shared_ptr< ContactCalculation >, Math::SHAPE_TYPE_COUNT >, Math::SHAPE_TYPE_COUNTTableType
 

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 TableTypegetDcdContactTable ()
 
static const TableTypegetCcdContactTable ()
 

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...
 

Detailed Description

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.

See also
Contact

Member Typedef Documentation

◆ TableType

Constructor & Destructor Documentation

◆ ContactCalculation()

SurgSim::Collision::ContactCalculation::ContactCalculation ( )

Constructor.

◆ ~ContactCalculation()

SurgSim::Collision::ContactCalculation::~ContactCalculation ( )
virtual

Destructor.

Member Function Documentation

◆ calculateCcdContact()

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.

Parameters
posedShapeMotion1,posedShapeMotion2The two posed shape motion to calculate ccd contact for
Returns
a list of ccd contacts between the two given shapes
Note
The contact information is related to the end of the time range, so solving these contact will
solve the collision at the end of the time range.

◆ calculateContact()

void SurgSim::Collision::ContactCalculation::calculateContact ( std::shared_ptr< CollisionPair pair)

Calculate the contacts for a given pair.

Parameters
pairA CollisionPair that is under consideration, new contacts will be added to this pair

◆ calculateDcdContact()

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.

Parameters
posedShape1,posedShape2The two posed shape to consider for this dcd contact calculation
Returns
a list of contacts between the two given posed shapes

◆ doCalculateCcdContact()

std::list< std::shared_ptr< Contact > > SurgSim::Collision::ContactCalculation::doCalculateCcdContact ( const Math::PosedShapeMotion< std::shared_ptr< Math::Shape >> &  posedShapeMotion1,
const Math::PosedShapeMotion< std::shared_ptr< Math::Shape >> &  posedShapeMotion2 
)
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.

Parameters
posedShapeMotion1,posedShapeMotion2The two posed shapes motion to calculate ccd contact for
Returns
a list of ccd contacts between the two given posed shapes motion

Reimplemented in SurgSim::Collision::CompoundShapeContact, 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 >, and SurgSim::Collision::DefaultContactCalculation.

◆ doCalculateContact()

void SurgSim::Collision::ContactCalculation::doCalculateContact ( std::shared_ptr< CollisionPair pair)
privatevirtual

Calculate the actual contact between two shapes of the given CollisionPair.

Parameters
pairThe symmetric pair that is under consideration.

Reimplemented in SurgSim::Collision::DefaultContactCalculation.

◆ doCalculateDcdContact()

std::list< std::shared_ptr< Contact > > SurgSim::Collision::ContactCalculation::doCalculateDcdContact ( const Math::PosedShape< std::shared_ptr< Math::Shape >> &  posedShape1,
const Math::PosedShape< std::shared_ptr< Math::Shape >> &  posedShape2 
)
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.

Parameters
posedShape1,posedShape2The two posed shapes to calculate dcd contact for
Returns
a list of dcd contacts between the two given posed shapes

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.

◆ getCcdContactTable()

const ContactCalculation::TableType & SurgSim::Collision::ContactCalculation::getCcdContactTable ( )
static

◆ getDcdContactTable()

const ContactCalculation::TableType & SurgSim::Collision::ContactCalculation::getDcdContactTable ( )
static

◆ getShapeTypes()

virtual std::pair<int, int> SurgSim::Collision::ContactCalculation::getShapeTypes ( )
pure virtual

◆ initializeTables()

void SurgSim::Collision::ContactCalculation::initializeTables ( )
staticprivate

Statically initialize the tables, used via call once.

◆ privateCcdRegister() [1/2]

void SurgSim::Collision::ContactCalculation::privateCcdRegister ( const std::shared_ptr< ContactCalculation > &  calculation)
staticprivate

registration to call at static scope (does not protect the initialization via call_once) Mirroring the public functions

◆ privateCcdRegister() [2/2]

void SurgSim::Collision::ContactCalculation::privateCcdRegister ( const std::shared_ptr< ContactCalculation > &  calculation,
const std::pair< int, int > &  types 
)
staticprivate

registration to call at static scope (does not protect the initialization via call_once) Mirroring the public functions

◆ privateDcdRegister() [1/2]

void SurgSim::Collision::ContactCalculation::privateDcdRegister ( const std::shared_ptr< ContactCalculation > &  calculation)
staticprivate

registration to call at static scope (does not protect the initialization via call_once) Mirroring the public functions

◆ privateDcdRegister() [2/2]

void SurgSim::Collision::ContactCalculation::privateDcdRegister ( const std::shared_ptr< ContactCalculation > &  calculation,
const std::pair< int, int > &  types 
)
staticprivate

registration to call at static scope (does not protect the initialization via call_once) Mirroring the public functions

◆ registerCcdContactCalculation()

void SurgSim::Collision::ContactCalculation::registerCcdContactCalculation ( const std::shared_ptr< ContactCalculation > &  calculation)
static

Register an instance of a contact calculation in the table.

Parameters
calculationThe calculation to be registered

◆ registerDcdContactCalculation()

void SurgSim::Collision::ContactCalculation::registerDcdContactCalculation ( const std::shared_ptr< ContactCalculation > &  calculation)
static

Register an instance of a contact calculation in the table.

Parameters
calculationThe calculation to be registered

Member Data Documentation

◆ m_contactCcdCalculations

ContactCalculation::TableType SurgSim::Collision::ContactCalculation::m_contactCcdCalculations
staticprivate

Static table of Ccd contact calculations.

◆ m_contactDcdCalculations

ContactCalculation::TableType SurgSim::Collision::ContactCalculation::m_contactDcdCalculations
staticprivate

Static table of Dcd contact calculations.

◆ m_initializationFlag

std::once_flag SurgSim::Collision::ContactCalculation::m_initializationFlag
staticprivate

Flag used for initialization.


The documentation for this class was generated from the following files: