MULTIBODY SIMULATION SOFTWARE - API documentation
Public Member Functions | Protected Attributes
chrono::collision::ChModelBullet Class Reference

#include <CHcModelBullet.h>

Inheritance diagram for chrono::collision::ChModelBullet:
Inheritance graph
[legend]
Collaboration diagram for chrono::collision::ChModelBullet:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual int ClearModel ()
virtual int BuildModel ()
virtual bool AddSphere (double radius, ChVector<> *pos=0)
virtual bool AddEllipsoid (double rx, double ry, double rz, ChVector<> *pos=0, ChMatrix33<> *rot=0)
virtual bool AddBox (double hx, double hy, double hz, ChVector<> *pos=0, ChMatrix33<> *rot=0)
virtual bool AddCylinder (double rx, double rz, double hy, ChVector<> *pos=0, ChMatrix33<> *rot=0)
virtual bool AddConvexHull (std::vector< ChVector< double > > &pointlist, ChVector<> *pos=0, ChMatrix33<> *rot=0)
virtual bool AddTriangleMesh (const geometry::ChTriangleMesh &trimesh, bool is_static, bool is_convex, ChVector<> *pos=0, ChMatrix33<> *rot=0)
virtual bool AddTriangleMeshConcave (const geometry::ChTriangleMesh &trimesh, ChVector<> *pos=0, ChMatrix33<> *rot=0)
virtual bool AddTriangleMeshConcaveDecomposed (ChConvexDecomposition &mydecomposition, ChVector<> *pos=0, ChMatrix33<> *rot=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)
virtual bool AddCopyOfAnotherModel (ChCollisionModel *another)
virtual void SetFamily (int mfamily)
virtual int GetFamily ()
virtual void SetFamilyMaskNoCollisionWithFamily (int mfamily)
virtual void SetFamilyMaskDoCollisionWithFamily (int mfamily)
virtual bool GetFamilyMaskDoesCollisionWithFamily (int mfamily)
virtual void GetAABB (ChVector<> &bbmin, ChVector<> &bbmax) const
virtual void StreamIN (ChStreamInBinary &mstream)
virtual void StreamOUT (ChStreamOutBinary &mstream)
btCollisionObject * GetBulletModel ()
short int GetFamilyGroup ()
short int GetFamilyMask ()

Protected Attributes

btCollisionObject * bt_collision_object
std::vector< smartptrshapesshapes
short int family_group
short int family_mask

Detailed Description

A wrapper to use the Bullet collision detection library


Member Function Documentation

bool chrono::collision::ChModelBullet::AddBarrel ( double  Y_low,
double  Y_high,
double  R_vert,
double  R_hor,
double  R_offset,
ChVector<> *  pos = 0,
ChMatrix33<> *  rot = 0 
) [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.

Implements chrono::collision::ChCollisionModel.

bool chrono::collision::ChModelBullet::AddConvexHull ( std::vector< ChVector< double > > &  pointlist,
ChVector<> *  pos = 0,
ChMatrix33<> *  rot = 0 
) [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.

Implements chrono::collision::ChCollisionModel.

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

Add all shapes already contained in another model. Thank to the adoption of shared pointers, underlying shapes are shared (not copied) among the models; this will save memory when you must simulate thousands of objects with the same collision shape. The 'another' model must be of ChModelBullet subclass.

Implements chrono::collision::ChCollisionModel.

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

Add a triangle mesh to this model.

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.

Parameters:
trimeshthe triangle mesh
is_statictrue only if model doesn't move (es.a terrain). May improve performance
is_convextrue if mesh is used as a convex hull(only for simple mesh), otherwise if false, handle as concave
rotdisplacement respect to COG (optional)

Implements chrono::collision::ChCollisionModel.

bool chrono::collision::ChModelBullet::AddTriangleMeshConcave ( const geometry::ChTriangleMesh trimesh,
ChVector<> *  pos = 0,
ChMatrix33<> *  rot = 0 
) [virtual]

CUSTOM for this class only: add a concave triangle mesh that will be managed by GImpact mesh-mesh algorithm. Note that, despite this can work with arbitrary meshes, there could be issues of robustness and precision, so when possible, prefer simplified representations as compounds of convex shapes of boxes/spheres/etc.. type.

Parameters:
trimeshthe concave triangle mesh
rotdisplacement respect to COG (optional)
bool chrono::collision::ChModelBullet::AddTriangleMeshConcaveDecomposed ( ChConvexDecomposition mydecomposition,
ChVector<> *  pos = 0,
ChMatrix33<> *  rot = 0 
) [virtual]

CUSTOM for this class only: add a concave triangle mesh that will be decomposed into a compound of convex shapes. Decomposition could be more efficient than AddTriangleMeshConcave(), but preprocessing decomposition might take a while, and decomposition result is often approximate. Therefore, despite this can work with arbitrary meshes, there could be issues of robustness and precision, so when possible, prefer simplified representations as compounds of convex shapes of boxes/spheres/etc.. type.

Parameters:
mydecompositionthe concave triangle mesh, already decomposed
rotdisplacement respect to COG (optional)
int chrono::collision::ChModelBullet::BuildModel ( ) [virtual]

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

Implements chrono::collision::ChCollisionModel.

int chrono::collision::ChModelBullet::ClearModel ( ) [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)

Implements chrono::collision::ChCollisionModel.

void chrono::collision::ChModelBullet::GetAABB ( ChVector<> &  bbmin,
ChVector<> &  bbmax 
) const [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.

Implements chrono::collision::ChCollisionModel.

bool chrono::collision::ChModelBullet::GetFamilyMaskDoesCollisionWithFamily ( int  mfamily) [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().

Implements chrono::collision::ChCollisionModel.

void chrono::collision::ChModelBullet::SetFamily ( int  mfamily) [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!

Implements chrono::collision::ChCollisionModel.

void chrono::collision::ChModelBullet::SetFamilyMaskNoCollisionWithFamily ( int  mfamily) [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!

Implements chrono::collision::ChCollisionModel.

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

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

Reimplemented from chrono::collision::ChCollisionModel.

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

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

Reimplemented from chrono::collision::ChCollisionModel.


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