MULTIBODY SIMULATION SOFTWARE - API documentation

chrono::collision::ChCollisionModel Class Reference

#include <CHcCollisionModel.h>

Inheritance diagram for chrono::collision::ChCollisionModel:

Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual int ClearModel ()=0
virtual int BuildModel ()=0
virtual bool AddSphere (double radius, ChVector<> *pos=0)=0
virtual bool AddEllipsoid (double rx, double ry, double rz, ChVector<> *pos=0, ChMatrix33<> *rot=0)=0
virtual bool AddBox (double hx, double hy, double hz, ChVector<> *pos=0, ChMatrix33<> *rot=0)=0
virtual bool AddCylinder (double rx, double rz, double hy, ChVector<> *pos=0, ChMatrix33<> *rot=0)=0
virtual bool AddTriangleMesh (const geometry::ChTriangleMesh &trimesh, bool is_static, bool is_convex, ChVector<> *pos=0, ChMatrix33<> *rot=0)=0
virtual bool AddBarrel (double Y_low, double Y_high, double R_vert, double R_hor, double R_offset, ChVector<> *pos=0, ChMatrix33<> *rot=0)=0
virtual bool AddCopyOfAnotherModel (ChCollisionModel *another)=0
virtual ChPhysicsItemGetPhysicsItem ()=0
virtual void SyncPosition ()=0
virtual void SetFamily (int mfamily)=0
virtual int GetFamily ()=0
virtual void SetFamilyMaskNoCollisionWithFamily (int mfamily)=0
virtual void SetFamilyMaskDoCollisionWithFamily (int mfamily)=0
virtual bool GetFamilyMaskDoesCollisionWithFamily (int mfamily)=0
virtual void SetSafeMargin (double amargin)
virtual float GetSafeMargin ()
virtual void SetEnvelope (double amargin)
virtual float GetEnvelope ()

Static Public Member Functions

static void SetDefaultSuggestedEnvelope (double menv)
static void SetDefaultSuggestedMargin (double mmargin)
static double GetDefaultSuggestedEnvelope ()
static double GetDefaultSuggestedMargin ()

Protected Member Functions

virtual float GetSuggestedFullMargin ()

Protected Attributes

float model_envelope
float model_safe_margin


Detailed Description

Class containing the geometric model ready for collision detection. Each rigid body will have a ChCollisionModel. A ChCollisionModel will contain all the geometric description(s) of the shape of the rigid body, for collision purposes.

Member Function Documentation

virtual int chrono::collision::ChCollisionModel::ClearModel (  )  [pure virtual]

Deletes all inserted geometries. Also, if you begin the definition of a model, AFTER adding the geometric description, remember to call the ClearModel(). MUST be inherited by child classes! (ex for resetting also BV hierarchies)

Implemented in chrono::collision::ChModelBullet, and chrono::collision::ChModelGPU.

virtual int chrono::collision::ChCollisionModel::BuildModel (  )  [pure virtual]

Builds the BV hierarchy. Call this function AFTER adding the geometric description. MUST be inherited by child classes! (ex for bulding BV hierarchies)

Implemented in chrono::collision::ChModelBullet, and chrono::collision::ChModelGPU.

virtual bool chrono::collision::ChCollisionModel::AddSphere ( double  radius,
ChVector<> *  pos = 0 
) [pure virtual]

Add a sphere shape to this model, for collision purposes.

Parameters:
radius  the radius of the sphere
pos  the position of the sphere in model coordinates

Implemented in chrono::collision::ChModelBullet, and chrono::collision::ChModelGPU.

virtual bool chrono::collision::ChCollisionModel::AddEllipsoid ( double  rx,
double  ry,
double  rz,
ChVector<> *  pos = 0,
ChMatrix33<> *  rot = 0 
) [pure virtual]

Add an ellipsoid shape to this model, for collision purposes.

Parameters:
rx  the rad on x axis
ry  the rad on y axis
rz  the rad on z axis
pos  the position of the ellipsoid
rot  the matrix defining rotation (orthogonal)

Implemented in chrono::collision::ChModelBullet, and chrono::collision::ChModelGPU.

virtual bool chrono::collision::ChCollisionModel::AddBox ( double  hx,
double  hy,
double  hz,
ChVector<> *  pos = 0,
ChMatrix33<> *  rot = 0 
) [pure virtual]

Add a box shape to this model, for collision purposes.

Parameters:
hx  the halfsize on x axis
hy  the halfsize on y axis
hz  the halfsize on z axis
pos  the position of the box COG
rot  the rotation of the box - matrix must be orthogonal

Implemented in chrono::collision::ChModelBullet, and chrono::collision::ChModelGPU.

virtual bool chrono::collision::ChCollisionModel::AddCylinder ( double  rx,
double  rz,
double  hy,
ChVector<> *  pos = 0,
ChMatrix33<> *  rot = 0 
) [pure virtual]

Add a cylinder to this model (default axis on Y direction), for collision purposes.

Implemented in chrono::collision::ChModelBullet, and chrono::collision::ChModelGPU.

virtual bool chrono::collision::ChCollisionModel::AddTriangleMesh ( const geometry::ChTriangleMesh trimesh,
bool  is_static,
bool  is_convex,
ChVector<> *  pos = 0,
ChMatrix33<> *  rot = 0 
) [pure virtual]

Add a triangle mesh to this model, passing a triangle mesh (do not delete the triangle mesh until the collision model, because depending on the implementation of inherited ChCollisionModel classes, maybe the triangle is referenced via a striding interface or just copied) Note: if possible, in sake of high performance, avoid triangle meshes and prefer simplified representations as compounds of convex shapes of boxes/spheres/etc.. type. See functions above.

Parameters:
trimesh  the triangle mesh
is_static  true only if model doesn't move (es.a terrain). May improve performance
is_convex  true if mesh convex hull is used (only for simple mesh). May improve robustness
rot  displacement respect to COG (optional)

Implemented in chrono::collision::ChModelBullet, and chrono::collision::ChModelGPU.

virtual bool chrono::collision::ChCollisionModel::AddBarrel ( double  Y_low,
double  Y_high,
double  R_vert,
double  R_hor,
double  R_offset,
ChVector<> *  pos = 0,
ChMatrix33<> *  rot = 0 
) [pure virtual]

Add a barrel-like shape to this model (main axis on Y direction), for collision purposes. The barrel shape is made by lathing an arc of an ellipse around the vertical Y axis. The center of the ellipse is on Y=0 level, and it is ofsetted by R_offset from the Y axis in radial direction. The two radii of the ellipse are R_vert (for the vertical direction, i.e. the axis parellel to Y) and R_hor (for the axis that is perpendicular to Y). Also, the solid is clamped with two discs on the top and the bottom, at levels Y_low and Y_high.

Implemented in chrono::collision::ChModelBullet, and chrono::collision::ChModelGPU.

virtual bool chrono::collision::ChCollisionModel::AddCopyOfAnotherModel ( ChCollisionModel another  )  [pure virtual]

Add all shapes already contained in another model. If possible, child classes implement this so that underlying shapes are shared (not copied) among the models.

Implemented in chrono::collision::ChModelBullet, and chrono::collision::ChModelGPU.

virtual ChPhysicsItem* chrono::collision::ChCollisionModel::GetPhysicsItem (  )  [pure virtual]

Gets the pointer to the client owner ChPhysicsItem. MUST be implemented by child classes!

Implemented in chrono::collision::ChModelBulletBody, and chrono::collision::ChModelBulletParticle.

virtual void chrono::collision::ChCollisionModel::SyncPosition (  )  [pure virtual]

Sets the position and orientation of the collision model as the rigid body current position. MUST be implemented by child classes!

Implemented in chrono::collision::ChModelBulletBody, chrono::collision::ChModelBulletParticle, and chrono::collision::ChModelGPU.

virtual void chrono::collision::ChCollisionModel::SetFamily ( int  mfamily  )  [pure virtual]

By default, all collsion objects belong to family n.0, but you can set family in range 0..15. This is used when the objects collided with another: the contact is created only if the family is within the 'family mask' of the other, and viceversa. NOTE: these functions have NO effect if used before you add the body to a ChSystem, using AddBody(). Use after AddBody(). MUST be implemented by child classes!

Implemented in chrono::collision::ChModelBullet, and chrono::collision::ChModelGPU.

virtual void chrono::collision::ChCollisionModel::SetFamilyMaskNoCollisionWithFamily ( int  mfamily  )  [pure virtual]

By default, family mask is all turned on, so all families can collide with this object, but you can turn on-off some bytes of this mask so that some families do not collide. When two objects collide, the contact is created only if the family is within the 'family mask' of the other, and viceversa. NOTE: these functions have NO effect if used before you add the body to a ChSystem, using AddBody(). Use after AddBody(). MUST be implemented by child classes!

Implemented in chrono::collision::ChModelBullet, and chrono::collision::ChModelGPU.

virtual bool chrono::collision::ChCollisionModel::GetFamilyMaskDoesCollisionWithFamily ( int  mfamily  )  [pure virtual]

Tells if the family mask of this collision object allows for the collision with another collision object belonging to a given family. NOTE: this function has NO effect if used before you add the body to a ChSystem, using AddBody(). Use after AddBody().

Implemented in chrono::collision::ChModelBullet, and chrono::collision::ChModelGPU.

virtual void chrono::collision::ChCollisionModel::SetSafeMargin ( double  amargin  )  [virtual]

Sets the suggested collision 'inward safe margin' for the shapes to be added from now on, using the AddBox, AddCylinder etc (where, if this margin is too high for some thin or small shapes, it may be clamped).. If dist<0 and interpenetation occurs (ex.for numerical errors) within this 'safe margin' inward range, collision detection is still fast and reliable (beyond this, for deep penetrations, CD still works, but might be slower and less reliable) Side effect: think at the margin as a radius of a 'smoothing' fillet on all corners of the shapes - that's why you cannot exceed with this...

virtual float chrono::collision::ChCollisionModel::GetSafeMargin (  )  [virtual]

Returns the inward safe margin (see SetSafeMargin() ).

virtual void chrono::collision::ChCollisionModel::SetEnvelope ( double  amargin  )  [virtual]

Sets the suggested collision outward 'envelope' (used from shapes added, from now on, to this collision model). This 'envelope' is a surrounding invisible volume which extends outward from the surface, and it is used to detect contacts a bit before shapes come into contact, i.e. when dist>0. However contact points will stay on the true surface of the geometry, not on the external surface of the envelope. Side effect: AABB are 'expanded' outward by this amount, so if you exagerate with this value, CD might be slower and too sensible. On the other hand, if you set this value to 0, contacts are detected only for dist<=0, thus causing unstable simulation.

virtual float chrono::collision::ChCollisionModel::GetEnvelope (  )  [virtual]

Returns the outward safe margin (see SetEnvelope() ).


CHRONO::ENGINE
C++ library for multibody simulation, (C) Alessandro Tasora
This API documentation has been generated on 17 Jul 2009 by Doxygen