SIM_ColliderBFA Class Reference

A single potential-collision event involving a pair of primitives. More...

#include <SIM_ColliderBFA.h>

Inheritance diagram for SIM_ColliderBFA:

SIM_Collider SIM_Data SIM_OptionsUser RBD_ColliderBFA

List of all members.

Public Member Functions

void getCollisionsDeformable (SIM_IsectArray &collisions, SIM_Object &object, SIM_Object &affector, fpreal tolerance, const SIM_Time &startTime, const SIM_Time &endTime, bool doRepulsion) const
void getCollisionsRigid (SIM_IsectArray &collisions, SIM_Object &object, SIM_Object &affector, fpreal tolerance, const SIM_Time &startTime, const SIM_Time &endTime, const UT_DMatrix4 &startXformA, const UT_DMatrix4 &startXformB, const UT_DMatrix4 &endXformA, const UT_DMatrix4 &endXformB) const
 simDetail (int objectId, const GU_Detail &gdp, const SIM_TriangulatedGeometry *tgeo, const UT_DMatrix4 &startXform, const UT_DMatrix4 &endXform, const SIM_Time &startTime, const SIM_Time &endTime)
int getObjectId () const
const GU_DetailgetGdp () const
bool operator== (const simDetail &rhs) const
const SIM_TimegetStartTime () const
const SIM_TimegetEndTime () const
const SIM_Time getTimestep () const
int getTriPointId (int fid, int vid) const
 Get point id of vertex on a given face. Optimized for triangles.
int getPrimPointId (int fid, int vid) const
 Unoptimized version of getTriPointId for arbitrary primitives.
bool hasTriEdgeIds () const
int getTriEdgeId (int fid, int vid) const
int getFusePointId (int pid) const
bool hasFusePointIds () const
UT_Vector3 getDetailPointPos (int pid) const
const UT_Vector3getPointVel (int pid) const
float getPointMass (int pid) const
const UT_Vector3getPointStartPos (int pid) const
const UT_Vector3getPointEndPos (int pid) const
UT_Vector3 getPointPos (int pid, const SIM_Time &time) const
UT_Vector3 getTriBaryPos (int primId, const UT_Vector3 &baryV3, const SIM_Time &time) const
UT_Vector3 getTriBaryVel (int primId, const UT_Vector3 &baryV3) const
fpreal getTriBaryMass (int primId, const UT_Vector3 &baryV3) const
UT_Vector3 getTriEdgePos (int primId, int eid, fpreal bary, const SIM_Time &time) const
 Get a position of a point somewhere on the edge of a triangle.
UT_Vector3 getPrimEdgePos (int primId, int eid, fpreal bary, const SIM_Time &time) const
 Optimized variant of getTriEdgePos for non-triangular primitives.
UT_Vector3 getTriStartBaryCenter (int primId) const
bool setPointChecked (int primIdA, const simDetail &sdpB, int pidB)
bool setEdgeChecked (int eidA, const simDetail &sdpB, int eidB)
 simPrimPairEvent (int primId0, int primId1, int edgeId0, int edgeId1, fpreal radius0, fpreal radius1, int &adjacent)

Public Attributes

int myPrimId [2]
int myEdgeId [2]
fpreal myRadii [2]
int & myAdjacent
UT_RefArray< simEdgeEdgeEventmyEdgeEdgeEvents
UT_RefArray< simFaceVertexEventmyFaceVertexEvents
UT_RefArray< SIM_IsectmyTriTriEvents

Protected Member Functions

 SIM_ColliderBFA (const SIM_DataFactory *factory)
virtual ~SIM_ColliderBFA ()
virtual SIM_BVTree::simBVTreeType getBVTreeType () const
virtual BV_LeafIteratorcreateLeafIt (const SIM_Object &object, const SIM_Time &timestep, bool startPosOnly) const =0
virtual void convertLeafToPrim (const BV_LeafIterator &leafIt, int leafId, int &outPrimId, int &outEdgeId) const =0
virtual fpreal getLeafRadius (const BV_LeafIterator &leafIt, int leafId) const =0
virtual bool getEventsAtSurface () const
void retrieveGeometry (const SIM_Object &object, GU_ConstDetailHandle &outGdh, const GU_Detail *&outGdp, UT_DMatrix4 *outEndTransform, const SIM_TriangulatedGeometry **tgeo) const
bool testFaceSharesPoint (const simDetail &sdpF, int pidF0, int pidF1, int pidF2, const simDetail &sdpV, int pidV) const
bool testEdgesSharePoint (const simDetail &sdpA, int pidA0, int pidA1, const simDetail &sdpB, int pidB0, int pidB1) const
virtual bool doCheckTangle () const
virtual void intersectPrims (simPrimPairEvent &event, simDetail &sdpA, simDetail &sdpB, fpreal tolerance, bool doRepulsion, bool selfCollision) const

Protected Attributes

GB_AttributeRef myAttMass

Friends

class simBVCallback


Detailed Description

A single potential-collision event involving a pair of primitives.

This class implements a cloth-cloth collider based on Bridson's 2002 paper (BriFedAnd02). We use it for several types of deformable collisions: cloth-cloth, cloth-hair and hair-hair. We also use it for thin plate rigid body collisions. This class can only be used for collision detection. The cloth subclass does the Bridson/Fedkiw/Anderson collision response.

For deformable objects, the input objects should be updated to the end-of-step positions and velocities. This collider will proposes changes to that end-of-step velocity which can then be used to obtain a new end-of-step position. The start-of-step position is calculated by assuming that explicit integration was used - i.e., by computing x - dt*v.

This class does both self-collision and object/object collision. It supports "point fusing," where two points in the same object (or one point in each of the two objects) are fused together into a single virtual point. (Typically, the user sets that up using a hard DOPs constraint.) For collision purposes, those points are treated as a single point - so, if two edges collide, but they share a virtual point as an endpoint, the collision will be ignored.

Definition at line 150 of file SIM_ColliderBFA.h.


Constructor & Destructor Documentation

SIM_ColliderBFA::SIM_ColliderBFA ( const SIM_DataFactory factory  )  [explicit, protected]

virtual SIM_ColliderBFA::~SIM_ColliderBFA (  )  [protected, virtual]


Member Function Documentation

virtual void SIM_ColliderBFA::convertLeafToPrim ( const BV_LeafIterator leafIt,
int  leafId,
int &  outPrimId,
int &  outEdgeId 
) const [protected, pure virtual]

Given a leaf iterator and the id of a leaf, convert the leaf id to a primitive id and (optionally) an edge id.

Implemented in RBD_ColliderBFA.

virtual BV_LeafIterator* SIM_ColliderBFA::createLeafIt ( const SIM_Object object,
const SIM_Time timestep,
bool  startPosOnly 
) const [protected, pure virtual]

This method should create a BV_LeafIterator class. This class will iterate over the individual geometric entities to be used for OBB intersection - in most cases, each leaf will contain a single primitive from the geometry. The time used to retrieve the geometry is determined by the startPosOnly flag: true: return the position at the start of the timestep - i.e., position at object - vel*timestep false: return the positions at both the start and end of the timestep. The leaf iterator should return points in simulation (world) space, not local object space.

Implemented in RBD_ColliderBFA.

virtual bool SIM_ColliderBFA::doCheckTangle (  )  const [inline, protected, virtual]

returns true iff tangling triangles should not be processed for collision detection The RBD collision detection uses this to allow objects that are tangled at the start of the timestep to untangle without the attempt to disentangle triggering a collision.

Reimplemented in RBD_ColliderBFA.

Definition at line 270 of file SIM_ColliderBFA.h.

virtual SIM_BVTree::simBVTreeType SIM_ColliderBFA::getBVTreeType (  )  const [protected, virtual]

void SIM_ColliderBFA::getCollisionsDeformable ( SIM_IsectArray collisions,
SIM_Object object,
SIM_Object affector,
fpreal  tolerance,
const SIM_Time startTime,
const SIM_Time endTime,
bool  doRepulsion 
) const [inline]

Collision detection for deformable bodies. These bodies: 1) define velocity via a point attribute 2) need their bounding volume trees updated every step.

Definition at line 159 of file SIM_ColliderBFA.h.

void SIM_ColliderBFA::getCollisionsRigid ( SIM_IsectArray collisions,
SIM_Object object,
SIM_Object affector,
fpreal  tolerance,
const SIM_Time startTime,
const SIM_Time endTime,
const UT_DMatrix4 startXformA,
const UT_DMatrix4 startXformB,
const UT_DMatrix4 endXformA,
const UT_DMatrix4 endXformB 
) const [inline]

Collision detection for rigid bodies. These bodies: 1) define velocity via start/end transforms 2) never need to update their bounding volume trees. 3) need proxy triangulated geometry, since the source geometry may not be triangles.

Definition at line 178 of file SIM_ColliderBFA.h.

UT_Vector3 SIM_ColliderBFA::getDetailPointPos ( int  pid  )  const

const SIM_Time& SIM_ColliderBFA::getEndTime (  )  const [inline]

Definition at line 370 of file SIM_ColliderBFA.h.

virtual bool SIM_ColliderBFA::getEventsAtSurface (  )  const [protected, virtual]

Test if this class generates events located at the *centre* of the triangles/edges or at the *surface*. This choice usually depends on the model of collision response.

int SIM_ColliderBFA::getFusePointId ( int  pid  )  const [inline]

Retrieve the "simulation" point id (or "equation number") associated with the given point. This allows for testing if points from two different gdps are "fused" into a single point within the simulation. It is stored as an attribute on the GU_Detail. Collisions between fused points are ignored. If the attribute is absent, fusing is disabled.

Definition at line 401 of file SIM_ColliderBFA.h.

const GU_Detail& SIM_ColliderBFA::getGdp (  )  const [inline]

Definition at line 363 of file SIM_ColliderBFA.h.

virtual fpreal SIM_ColliderBFA::getLeafRadius ( const BV_LeafIterator leafIt,
int  leafId 
) const [protected, pure virtual]

This method returns a radius to expand the leaf's geometry for collision detection. For example, if the leaf's geometry is a line segment, the expanded geometry used for collision detection will be a cylinder with hemisphere caps.

Implemented in RBD_ColliderBFA.

int SIM_ColliderBFA::getObjectId (  )  const [inline]

Definition at line 361 of file SIM_ColliderBFA.h.

const UT_Vector3& SIM_ColliderBFA::getPointEndPos ( int  pid  )  const [inline]

Definition at line 417 of file SIM_ColliderBFA.h.

float SIM_ColliderBFA::getPointMass ( int  pid  )  const

UT_Vector3 SIM_ColliderBFA::getPointPos ( int  pid,
const SIM_Time time 
) const

const UT_Vector3& SIM_ColliderBFA::getPointStartPos ( int  pid  )  const [inline]

Definition at line 415 of file SIM_ColliderBFA.h.

const UT_Vector3& SIM_ColliderBFA::getPointVel ( int  pid  )  const [inline]

Definition at line 412 of file SIM_ColliderBFA.h.

UT_Vector3 SIM_ColliderBFA::getPrimEdgePos ( int  primId,
int  eid,
fpreal  bary,
const SIM_Time time 
) const

Optimized variant of getTriEdgePos for non-triangular primitives.

int SIM_ColliderBFA::getPrimPointId ( int  fid,
int  vid 
) const

Unoptimized version of getTriPointId for arbitrary primitives.

const SIM_Time& SIM_ColliderBFA::getStartTime (  )  const [inline]

Definition at line 368 of file SIM_ColliderBFA.h.

const SIM_Time SIM_ColliderBFA::getTimestep (  )  const [inline]

Definition at line 373 of file SIM_ColliderBFA.h.

fpreal SIM_ColliderBFA::getTriBaryMass ( int  primId,
const UT_Vector3 baryV3 
) const

UT_Vector3 SIM_ColliderBFA::getTriBaryPos ( int  primId,
const UT_Vector3 baryV3,
const SIM_Time time 
) const

UT_Vector3 SIM_ColliderBFA::getTriBaryVel ( int  primId,
const UT_Vector3 baryV3 
) const

int SIM_ColliderBFA::getTriEdgeId ( int  fid,
int  vid 
) const [inline]

Definition at line 389 of file SIM_ColliderBFA.h.

UT_Vector3 SIM_ColliderBFA::getTriEdgePos ( int  primId,
int  eid,
fpreal  bary,
const SIM_Time time 
) const

Get a position of a point somewhere on the edge of a triangle.

int SIM_ColliderBFA::getTriPointId ( int  fid,
int  vid 
) const [inline]

Get point id of vertex on a given face. Optimized for triangles.

Definition at line 377 of file SIM_ColliderBFA.h.

UT_Vector3 SIM_ColliderBFA::getTriStartBaryCenter ( int  primId  )  const

bool SIM_ColliderBFA::hasFusePointIds (  )  const [inline]

Definition at line 405 of file SIM_ColliderBFA.h.

bool SIM_ColliderBFA::hasTriEdgeIds (  )  const [inline]

Definition at line 385 of file SIM_ColliderBFA.h.

virtual void SIM_ColliderBFA::intersectPrims ( simPrimPairEvent &  event,
simDetail &  sdpA,
simDetail &  sdpB,
fpreal  tolerance,
bool  doRepulsion,
bool  selfCollision 
) const [protected, virtual]

bool SIM_ColliderBFA::operator== ( const simDetail &  rhs  )  const [inline]

Definition at line 365 of file SIM_ColliderBFA.h.

void SIM_ColliderBFA::retrieveGeometry ( const SIM_Object object,
GU_ConstDetailHandle outGdh,
const GU_Detail *&  outGdp,
UT_DMatrix4 outEndTransform,
const SIM_TriangulatedGeometry **  tgeo 
) const [protected]

bool SIM_ColliderBFA::setEdgeChecked ( int  eidA,
const simDetail &  sdpB,
int  eidB 
)

Flag that edge (pidA0,pidA1) of this detail has been tested against edge (pidB0,pidB1) of sdpB. Returns true if it had already been tested before.

bool SIM_ColliderBFA::setPointChecked ( int  primIdA,
const simDetail &  sdpB,
int  pidB 
)

Flag that point pidB of sdpB has been tested against primIdA from this simDetail. Returns true if it had already been tested before.

SIM_ColliderBFA::simDetail ( int  objectId,
const GU_Detail gdp,
const SIM_TriangulatedGeometry tgeo,
const UT_DMatrix4 startXform,
const UT_DMatrix4 endXform,
const SIM_Time startTime,
const SIM_Time endTime 
)

The difference between rigid/deformable is the presence/absence of tgeo data.

SIM_ColliderBFA::simPrimPairEvent ( int  primId0,
int  primId1,
int  edgeId0,
int  edgeId1,
fpreal  radius0,
fpreal  radius1,
int &  adjacent 
)

bool SIM_ColliderBFA::testEdgesSharePoint ( const simDetail &  sdpA,
int  pidA0,
int  pidA1,
const simDetail &  sdpB,
int  pidB0,
int  pidB1 
) const [protected]

Return true if the two edges (defined by their endpoint ids) share an endpoint. If the "fuse mapping" point attribute is present on both GU_Details, it is used to determine if two points are fused; If absent, sharing is only possible if the face and point belong to the same GU_Detail - i.e., self-collision.

bool SIM_ColliderBFA::testFaceSharesPoint ( const simDetail &  sdpF,
int  pidF0,
int  pidF1,
int  pidF2,
const simDetail &  sdpV,
int  pidV 
) const [protected]

Return true if a face and point share a point. If the "fuse mapping" point attribute is present on both GU_Details, it is used to determine if two points are fused; If absent, sharing is only possible if the face and point belong to the same GU_Detail - i.e., self-collision.


Friends And Related Function Documentation

friend class simBVCallback [friend]

Definition at line 345 of file SIM_ColliderBFA.h.


Member Data Documentation

A flag to indicate that the two primitives are adjacent (i.e., share one or more vertices)

Definition at line 497 of file SIM_ColliderBFA.h.

If mass attribute is missing (e.g., solid object), infinity is assumed. TODO: change this?

Definition at line 447 of file SIM_ColliderBFA.h.

Definition at line 498 of file SIM_ColliderBFA.h.

Definition at line 493 of file SIM_ColliderBFA.h.

Definition at line 499 of file SIM_ColliderBFA.h.

Definition at line 492 of file SIM_ColliderBFA.h.

Definition at line 494 of file SIM_ColliderBFA.h.

Definition at line 500 of file SIM_ColliderBFA.h.


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

Generated on Mon Jan 28 00:29:52 2013 for HDK by  doxygen 1.5.9