SurgSim::Collision::OctreeContact Class Referenceabstract

Abstract base class to calculate intersections between an Octree and other shapes. More...

`#include <SurgSim/Collision/OctreeContact.h>`

Inheritance diagram for SurgSim::Collision::OctreeContact:

## Classes

class | Vector3dHash
| Enable a Vector3d to be used as a key in an unordered map. More...

## Protected Member Functions

virtual std::list< std::shared_ptr< Contact > > | boxContactCalculation (const SurgSim::Math::BoxShape &boxShape, const SurgSim::Math::RigidTransform3d &boxPose, const SurgSim::Math::Shape &otherShape, const SurgSim::Math::RigidTransform3d &otherPose)=0
| Do the calculation between an octree node (BoxShape) and the other shape. More...

## Private Member Functions

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) override
| 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...
void | calculateContactWithNode (std::shared_ptr< const SurgSim::Math::OctreeShape::NodeType > node, Math::RigidTransform3d octreePose, const std::shared_ptr< Math::Shape > &shape, const Math::RigidTransform3d &shapePose, SurgSim::DataStructures::OctreePath *nodePath, std::list< std::shared_ptr< Contact >> *result)
| Calculate the collision between a specific octree node and a shape This function will check for contact between the node and shape. More...

## Private Attributes

std::unordered_map< SurgSim::Math::Vector3d, std::shared_ptr< SurgSim::Math::BoxShape >, Vector3dHash > | m_shapes
| The shapes used for the contact calculations are cached for performance. More...

## Additional Inherited Members

Public Types inherited from SurgSim::Collision::ContactCalculation
typedef std::array< std::array< std::shared_ptr< ContactCalculation >, Math::SHAPE_TYPE_COUNT >, Math::SHAPE_TYPE_COUNT > | TableType
Public Member Functions inherited from SurgSim::Collision::ContactCalculation
| 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 inherited from SurgSim::Collision::ContactCalculation
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 ()

## Detailed Description

Abstract base class to calculate intersections between an Octree and other shapes.

Derived classes handle the calculation for specific shape types (ie OctreeSphereContact).

## Member Function Documentation

## boxContactCalculation()

virtual std::list<std::shared_ptr<Contact> > SurgSim::Collision::OctreeContact::boxContactCalculation | ( | const SurgSim::Math::BoxShape & | boxShape,
|  | const SurgSim::Math::RigidTransform3d & | boxPose,
|  | const SurgSim::Math::Shape & | otherShape,
|  | const SurgSim::Math::RigidTransform3d & | otherPose
| ) |  |

protected pure virtual

Do the calculation between an octree node (BoxShape) and the other shape.

Parameters

  boxShape | the box shape
  boxPose | the pose of the box
  otherShape | the other shape
  otherPose | the pose of the other shape

Returns
  a list of contacts between the shapes, if any

Implemented in SurgSim::Collision::OctreeCapsuleContact, SurgSim::Collision::OctreeDoubleSidedPlaneContact, SurgSim::Collision::OctreePlaneContact, and SurgSim::Collision::OctreeSphereContact.

## calculateContactWithNode()

void SurgSim::Collision::OctreeContact::calculateContactWithNode | ( | std::shared_ptr< const SurgSim::Math::OctreeShape::NodeType > | node,
|  | Math::RigidTransform3d | octreePose,
|  | const std::shared_ptr< Math::Shape > & | shape,
|  | const Math::RigidTransform3d & | shapePose,
|  | SurgSim::DataStructures::OctreePath * | nodePath,
|  | std::list< std::shared_ptr< Contact >> * | result
| ) |  |

private

Calculate the collision between a specific octree node and a shape This function will check for contact between the node and shape.

If contact is found, this function will be called on each of the node's children. Once a leaf node is reached, contacts are added to the CollisionPair.

Parameters

  node | the octree node to collide with
  octreePose | the pose of the octree shape
  shape | the shape that the octree is colliding with
  shapePose | the pose of the shape
  nodePath | the NodePath of the current octree node
  result | [in,out] all generated contacts are agreggated here
  nodePath | [in,out] the path of the current node

## doCalculateDcdContact()

std::list< std::shared_ptr< Contact > > SurgSim::Collision::OctreeContact::doCalculateDcdContact | ( | const Math::PosedShape< std::shared_ptr< Math::Shape >> & | posedShape1,
|  | const Math::PosedShape< std::shared_ptr< Math::Shape >> & | posedShape2
| ) |  |

override private virtual

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,posedShape2 | The two posed shapes to calculate dcd contact for

Returns
  a list of dcd contacts between the two given posed shapes

Reimplemented from SurgSim::Collision::ContactCalculation.

## Member Data Documentation

## m_shapes

std::unordered_map<SurgSim::Math::Vector3d, std::shared_ptr<SurgSim::Math::BoxShape>, Vector3dHash> SurgSim::Collision::OctreeContact::m_shapes

private

The shapes used for the contact calculations are cached for performance.

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

- SurgSim/Collision/OctreeContact.h
- SurgSim/Collision/OctreeContact.cpp