Marine systems simulation
CoRiBoDynamics::CollisionManager Class Reference

#include <CollisionManager.h>

+ Inheritance diagram for CoRiBoDynamics::CollisionManager:
+ Collaboration diagram for CoRiBoDynamics::CollisionManager:

Classes

struct  contact_matrix_index_pair
 
class  ExternalObject
 
class  GeometricObject
 
class  InternalObject
 
struct  MaterialCharacteristic
 enum of different shape types More...
 

Public Types

enum  ShapeType {
  SPHERE =0 , CAPSULE =1 , CHAMFER =2 , BOX =3 ,
  TOROID =4 , PLATE =5
}
 

Public Member Functions

 CollisionManager (ConstraintSolver *solver, double timeConstant)
 
int AddCapsule (double radius, double height, double contactStiffness, double contactDamping, double frictionCoefficient, int index)
 
int AddSphere (double radius, double contactStiffness, double contactDamping, double frictionCoefficient, int index)
 
int AddTorus (double majorRadius, double minorRadius, double contactStiffness, double contactDamping, double frictionCoefficient, int index)
 
int AddChamfer (double majorRadius, double minorRadius, double contactStiffness, double contactDamping, double frictionCoefficient, int index)
 
int AddPlate (double lengthX, double lengthY, double thickness, double contactStiffness, double contactDamping, double frictionCoefficient, int index)
 
int addExternalSphere (double radius, const double *Position, const double *Velocity, const double *Orientation, const double *AngularVelocity, double contactStiffness, double contactDamping, double frictionCoefficient)
 
int addExternalCapsule (double length, double radius, const double *Position, const double *Velocity, const double *Orientation, const double *AngularVelocity, double contactStiffness, double contactDamping, double frictionCoefficient)
 
int addExternalToroid (double majorRadius, double minorRadius, const double *Position, const double *Velocity, const double *Orientation, const double *AngularVelocity, double contactStiffness, double contactDamping, double frictionCoefficient)
 
int addExternalChamfer (double majorRadius, double minorRadius, const double *Position, const double *Velocity, const double *Orientation, const double *AngularVelocity, double contactStiffness, double contactDamping, double frictionCoefficient)
 
int addExternalPlate (double lengthX, double lengthY, double thickness, const double *Position, const double *Velocity, const double *Orientation, const double *AngularVelocity, double contactStiffness, double contactDamping, double frictionCoefficient)
 
void updateExternalElement (int index, const double *Position, const double *Velocity, const double *Orientation, const double *AngularVelocity)
 
vec6 getExternalObjectReactionForce (int index)
 
vec6 getExternalObjectReactionForce (ExternalObject &external_object)
 
vec6 getInternalObjectReactionForce (InternalObject &internal_object)
 
virtual void ComputeConstraints (const double T, const double *const X)
 
void setSpacePartitionOrigo (double x, double y, double z)
 
void setSpacePartitionBlockSize (double length)
 
- Public Member Functions inherited from CoRiBoDynamics::ConstraintSet
 ConstraintSet (ConstraintSolver *solver)
 
virtual void ComputeConstraints (const double T, const double *const X)=0
 

Protected Member Functions

void CollisionTest (InternalObject *objectA, InternalObject *objectB, const double *const X)
 list of all internal objects in this collision manager
 
void CollisionTest (ExternalObject *ExtObj, InternalObject *IntObj, const double *const X)
 
double ObjectDistance (GeometricObject *shapeA, GeometricObject *shapeB, GeometryTools::MinDistanceInfo &result)
 
bool BoundingSphereRejectionTest (GeometricObject *sphereA, GeometricObject *sphereB)
 
bool OBB_BoundingSphereRejectionTest (GeometricObject *box, GeometricObject *sphere)
 
- Protected Member Functions inherited from CoRiBoDynamics::ConstraintSet
const std::vector< RigidElement * > & ElementVector ()
 
void addConstraintResultantForce (int element, const vec6 &Force)
 
const vec3 Acceleration (int element)
 
const vec3 AngularAcceleration (int element)
 
const vec6 SecondDerivatives (int element)
 
void addMatrix (int i, int j, const mat6 &M)
 

Protected Attributes

std::vector< ExternalObject, Eigen::aligned_allocator< ExternalObject > > m_ExternalObjects
 
std::vector< InternalObject, Eigen::aligned_allocator< InternalObject > > m_InternalObjects
 list of all external objects in this collision manager
 
DataStructures::SpacePartitioner m_CollisionPartition
 
ObjectFactoryStack< contact_matrix_index_pairm_external_contact
 
double m_timeConstant
 

Detailed Description

Author
Jorgen Haavind Jensen

Adds collision constraint forces to rigid objects. Add references to the elements you want in the collision model.

Note
[1] Note that the default mode is "everything collides with everything else", and this is usually not what you want. To override the default mode you need to override the ComputeConstraints method in an inherited class.

[2] Currently only a small number of geometric primitives are supported, and not all of them can be pairwise computed for contact forces. The sphere and capsule can collide with all the other primitives, and two plates can collide. Contact between other primitives will not be detected.

[3] The space partition algorithm that is used to speed up the "all vs all" collision detection is optimized for a large number of roughly equally sized objects. If your object size varies by more than 1 order of magnitude the default algorithm may not run efficiently. As a default the object size is set to ~1m.

[4] The size of the space covered by the space partition algorithm is 2^15 (32768) times the block size. Block size and partition origo can be updated.

Revision history:
Q4 2011 JHJ: Initial version. Q3 2014 JHJ: Improved data structure to handle more flexible object configurations

Member Function Documentation

◆ ComputeConstraints()

virtual void CoRiBoDynamics::CollisionManager::ComputeConstraints ( const double  T,
const double *const  X 
)
virtual

Computes and returns the constraint system matrix for the current states (T and X). Adds constraint forces.

Implements CoRiBoDynamics::ConstraintSet.

Reimplemented in CoRiBoDynamics::Structures::SupergridCableCollisionManager, CoRiBoDynamics::Structures::SupergridWinchCableCollisionManager, CoRiBoDynamics::TrawlCableCollisionManager, and ShipContact.


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