MULTIBODY SIMULATION SOFTWARE - API documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
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 AddConvexHull (std::vector< ChVector< double > > &pointlist, 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 bool AddConvexHullsFromFile (ChStreamInAscii &mstream, ChVector<> *pos=0, ChMatrix33<> *rot=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 ()
virtual ShapeType GetShapeType ()
virtual void GetAABB (ChVector<> &bbmin, ChVector<> &bbmax) const =0
virtual void StreamIN (ChStreamInBinary &mstream)
virtual void StreamOUT (ChStreamOutBinary &mstream)

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
ShapeType model_type

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

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:
hxthe halfsize on x axis
hythe halfsize on y axis
hzthe halfsize on z axis
posthe position of the box COG
rotthe rotation of the box - matrix must be orthogonal

Implemented in chrono::collision::ChModelBullet.

virtual bool chrono::collision::ChCollisionModel::AddConvexHull ( std::vector< ChVector< double > > &  pointlist,
ChVector<> *  pos = 0,
ChMatrix33<> *  rot = 0 
) [pure virtual]

Add a convex hull to this model. A convex hull is simply a point cloud that describe a convex polytope. Connectivity between the vertexes, as faces/edges in triangle meshes is not necessary. Points are passed as a list, that is instantly copied into the model.

Implemented in chrono::collision::ChModelBullet.

bool chrono::collision::ChCollisionModel::AddConvexHullsFromFile ( ChStreamInAscii mstream,
ChVector<> *  pos = 0,
ChMatrix33<> *  rot = 0 
) [virtual]

Add a cluster of convex hulls by a '.chulls' file description. The file is an ascii text that contains many lines with "[x] [y] [z]" coordinates of the convex hulls. Hulls are separated by lines with "hull". Inherited classes should not need to implement/overload this, because this base implementation basically calls AddConvexHull() n times while parsing the file, that is enough.

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.

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:
rxthe rad on x axis
rythe rad on y axis
rzthe rad on z axis
posthe position of the ellipsoid
rotthe matrix defining rotation (orthogonal)

Implemented in chrono::collision::ChModelBullet.

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

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

Parameters:
radiusthe radius of the sphere
posthe position of the sphere in model coordinates

Implemented in chrono::collision::ChModelBullet.

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:
trimeshthe triangle mesh
is_statictrue only if model doesn't move (es.a terrain). May improve performance
is_convextrue if mesh convex hull is used (only for simple mesh). May improve robustness
rotdisplacement respect to COG (optional)

Implemented in chrono::collision::ChModelBullet.

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.

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.

virtual void chrono::collision::ChCollisionModel::GetAABB ( ChVector<> &  bbmin,
ChVector<> &  bbmax 
) const [pure virtual]

Returns the axis aligned bounding box (AABB) of the collision model, i.e. max-min along the x,y,z world axes. Remember that SyncPosition() should be invoked before calling this. MUST be implemented by child classes!

Implemented in chrono::collision::ChModelBullet.

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.

virtual ChPhysicsItem* chrono::collision::ChCollisionModel::GetPhysicsItem ( ) [pure virtual]
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 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.

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.

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

void chrono::collision::ChCollisionModel::StreamIN ( ChStreamInBinary mstream) [virtual]

Method to allow deserializing a persistent binary archive (ex: a file) into transient data.

Reimplemented in chrono::collision::ChModelBullet.

void chrono::collision::ChCollisionModel::StreamOUT ( ChStreamOutBinary mstream) [virtual]

Method to allow serializing transient data into a persistent binary archive (ex: a file).

Reimplemented in chrono::collision::ChModelBullet.

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::ChModelBulletNode, chrono::collision::ChModelBulletParticle, chrono::collision::ChModelBulletBody, and chrono::collision::ChModelBulletDEM.


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