HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RBD_Object Class Reference

#include <RBD_Object.h>

+ Inheritance diagram for RBD_Object:

Public Member Functions

 RBD_Object (const SIM_Solver *solver, SIM_Object *obj)
 
 ~RBD_Object () override
 
SIM_ObjectgetObject () const
 
RBD_StategetState () const
 
SIM_ImpactsgetImpacts ()
 
const SIM_SDFgetSDF () const
 
const SIM_GeometrygetGeometry () const
 
const RBD_SphereTreegetSphereTree () const
 
fpreal getRadius () const
 
bool isInfiniteExtent () const
 
void getBBox (UT_BoundingBox &bbox) const
 
void accumulatePointVelocity (UT_Vector3Array &pos, UT_Vector3Array &vel) const
 
void stashState ()
 Stashes the current state internally. More...
 
void reloadImpacts (SIM_Collider::SIM_ImpactApplyType impactaplytype)
 
void preserveImpacts (SIM_Engine *engine)
 
void restoreStatePos ()
 Restores the position of the state using changePosition. More...
 
void restoreStateVel ()
 Restores the velocity of the state using changeVelocity. More...
 
void restoreState ()
 Restores the full state. More...
 
void getGlueSubObjects (RBD_ObjectArray &objlist) const
 This returns a list of all the objects that are frozen to us. More...
 
int getNumGlueSubObjects () const
 
RBD_ObjectgetNthGlueSubObject (int i) const
 
RBD_ObjectgetGlueParent () const
 Returns our parent object, null if not glued. More...
 
bool hasGlueSubObjects () const
 This returns true if we have any frozen sub objects. More...
 
void addGlueSubObject (RBD_Object *obj)
 Marks that obj is glued to this. More...
 
void removeGlueSubObject (RBD_Object *obj)
 Removes that object as being glued to this. More...
 
bool hasAsGlueChild (RBD_Object *obj)
 Returns true if the given object is one of our glue children. More...
 
bool isGlued () const
 Return if this object is glued to somewhere else. More...
 
void buildImpulseModel (UT_DMatrix3 &k, const UT_Vector3 &f, const UT_Vector3 &p) const
 
void buildImpulseModelForA (UT_DMatrix3 &k, const UT_Vector3 &f, const UT_Vector3 &p, RBD_Object *A) const
 
void buildConstraints (const RBD_Solver *solver, const SIM_Time &time, const SIM_Time &endtime)
 
void removeConstraints ()
 
void applyImpulse (const UT_Vector3 &pos, fpreal impulse, const UT_Vector3 &normal)
 
void applyImpacts (const SIM_Impacts *impacts, const SIM_Time &time, const SIM_Time &timestep)
 Applies impulses from SIM_Impacts data. More...
 
void integratePosition (const SIM_Time &time, const SIM_Time &timestep)
 Integrate position. Uses current velocity. More...
 
void integrateVelocity (const SIM_Time &time, const SIM_Time &timestep)
 Integrate velocity. Finds & applies all forces. More...
 
void initSDF ()
 
void initFromGeometry ()
 Updates the state from geometry, unless already calculated. More...
 
void initRadius ()
 Calculates the radius, unless already calculated. More...
 
void initBBox (bool useSDF)
 Calculates the bounding box. More...
 
void gatherBuilderRequests (UT_Array< GU_SDFDelayedBuilder > &buildrequests)
 Gathers all of our builder requests. More...
 
void initForCollisions ()
 Initialize for collisions. More...
 
fpreal getPropertyAtPosition (const SIM_Property &property, const UT_Vector3 &pos) const
 Calculates the property value at the given world position. More...
 
void rebuildAffectorList (const RBD_Solver *solver, SIM_Engine &engine, const SIM_Time &time, const SIM_Time &timestep, RBD_SharedAffectorListArray &affectorlists, UT_TokenString::Map< RBD_SharedAffectorList * > &affectorhash)
 
void getStashedTransform (UT_DMatrix4 &xform) const
 Gets the transform matrix from self to world from stashed state. More...
 
void findOverlapIdx (const RBD_Solver *solver, UT_IntArray &overlap)
 
void setAffectorTreeDirty ()
 
int getNumAffectors () const
 
RBD_ObjectgetAffector (int j) const
 
const SIM_CollidergetCollider (int j, const char *defaultlabel) const
 
SIM_Collider::SIM_ImpactApplyType getImpactApplyType (int j) const
 
int getArrayIndex () const
 
void setArrayIndex (int index)
 
bool hasNailConstraints () const
 
UT_ValArray
< SIM_ColliderCacheData * > & 
getCollideCache ()
 
void clearCollideCache ()
 
void cachePhysicalValues ()
 
void restorePhysicalValues ()
 
- Public Member Functions inherited from SIM_ObjectSolveInfo
 SIM_ObjectSolveInfo (const SIM_Solver *createdbysolver, const SIM_Object *object)
 
virtual ~SIM_ObjectSolveInfo ()
 
const SIM_SolvergetCreatedBySolver () const
 

Public Attributes

bool myPinProcessFlag
 
RBD_ObjectArray myPinObjects
 
UT_Vector3Array myPinAnchorPos
 
UT_Vector3Array myPinAnchorGoalPos
 

Protected Member Functions

void accumulateConstraints (const RBD_Solver *solver, RBD_Object *piece, UT_Vector3Array &hard_objpos, UT_Vector3Array &hard_goalpos, UT_Matrix3 &hard_spatialfilter, UT_Matrix3 &hard_rotationalfilter, const SIM_Time &time, const SIM_Time &endtime)
 

Additional Inherited Members

- Static Public Member Functions inherited from SIM_ObjectSolveInfo
static void clearAllSolveInfo (const SIM_Engine *engine)
 

Detailed Description

Definition at line 48 of file RBD_Object.h.

Constructor & Destructor Documentation

RBD_Object::RBD_Object ( const SIM_Solver solver,
SIM_Object obj 
)
RBD_Object::~RBD_Object ( )
override

Member Function Documentation

void RBD_Object::accumulateConstraints ( const RBD_Solver solver,
RBD_Object piece,
UT_Vector3Array hard_objpos,
UT_Vector3Array hard_goalpos,
UT_Matrix3 hard_spatialfilter,
UT_Matrix3 hard_rotationalfilter,
const SIM_Time time,
const SIM_Time endtime 
)
protected
void RBD_Object::accumulatePointVelocity ( UT_Vector3Array pos,
UT_Vector3Array vel 
) const

Accumulates into the given arrays all of our point's positions and velocities. Both are given in world space.

void RBD_Object::addGlueSubObject ( RBD_Object obj)

Marks that obj is glued to this.

void RBD_Object::applyImpacts ( const SIM_Impacts impacts,
const SIM_Time time,
const SIM_Time timestep 
)

Applies impulses from SIM_Impacts data.

void RBD_Object::applyImpulse ( const UT_Vector3 pos,
fpreal  impulse,
const UT_Vector3 normal 
)

Applies an impulse to this object. This results in an instantaneous change in velocity and angular velocity.

void RBD_Object::buildConstraints ( const RBD_Solver solver,
const SIM_Time time,
const SIM_Time endtime 
)

Determines what hard constraints are present at this time step and updates its internal model to reflect theses. We need the end time to be able to acquire non-interpolated objects to handle live pin constraints.

void RBD_Object::buildImpulseModel ( UT_DMatrix3 k,
const UT_Vector3 f,
const UT_Vector3 p 
) const

Builds the impulse model matrix for the given world space coordinate. This matrix when multiplied by an impulse will give the change in velocity at that point caused by the impulse.

This takes hard constraints into consideration. Builds the impulse model matrix describing the velocity change at point p given a force at point f. This is Mfp-1 in my naming scheme.

void RBD_Object::buildImpulseModelForA ( UT_DMatrix3 k,
const UT_Vector3 f,
const UT_Vector3 p,
RBD_Object A 
) const

Builds the impulse model matrix describing motion of P on *this given an a force at f on *this. This is Mzfp-1(A) in my naming scheme, where this is Z.

void RBD_Object::cachePhysicalValues ( )
void RBD_Object::clearCollideCache ( )
void RBD_Object::findOverlapIdx ( const RBD_Solver solver,
UT_IntArray overlap 
)
inline

Definition at line 216 of file RBD_Object.h.

void RBD_Object::gatherBuilderRequests ( UT_Array< GU_SDFDelayedBuilder > &  buildrequests)

Gathers all of our builder requests.

RBD_Object* RBD_Object::getAffector ( int  j) const
inline

Definition at line 232 of file RBD_Object.h.

int RBD_Object::getArrayIndex ( ) const
inline

Definition at line 243 of file RBD_Object.h.

void RBD_Object::getBBox ( UT_BoundingBox bbox) const

This returns the bounding box of the object inside it's own frame. This must be transformed by the orientation to get the world bounding box.

UT_ValArray<SIM_ColliderCacheData *>& RBD_Object::getCollideCache ( )
inline

Definition at line 251 of file RBD_Object.h.

const SIM_Collider* RBD_Object::getCollider ( int  j,
const char *  defaultlabel 
) const
inline

Definition at line 234 of file RBD_Object.h.

const SIM_Geometry* RBD_Object::getGeometry ( ) const
inline

Definition at line 60 of file RBD_Object.h.

RBD_Object* RBD_Object::getGlueParent ( ) const
inline

Returns our parent object, null if not glued.

Definition at line 111 of file RBD_Object.h.

void RBD_Object::getGlueSubObjects ( RBD_ObjectArray objlist) const

This returns a list of all the objects that are frozen to us.

SIM_Collider::SIM_ImpactApplyType RBD_Object::getImpactApplyType ( int  j) const
inline

Definition at line 237 of file RBD_Object.h.

SIM_Impacts* RBD_Object::getImpacts ( )
RBD_Object* RBD_Object::getNthGlueSubObject ( int  i) const
int RBD_Object::getNumAffectors ( ) const
inline

Definition at line 228 of file RBD_Object.h.

int RBD_Object::getNumGlueSubObjects ( ) const

Discover the number of glued subobjects and retrieve a specific one

SIM_Object* RBD_Object::getObject ( ) const
inline

These cache the common RBD structures so we don't have to look them up every time we fetch them.

Definition at line 56 of file RBD_Object.h.

fpreal RBD_Object::getPropertyAtPosition ( const SIM_Property property,
const UT_Vector3 pos 
) const

Calculates the property value at the given world position.

fpreal RBD_Object::getRadius ( ) const
inline

This is the radius of this object from the pivot position. It is thus orientation independent.

Definition at line 66 of file RBD_Object.h.

const SIM_SDF* RBD_Object::getSDF ( ) const
inline

Definition at line 59 of file RBD_Object.h.

const RBD_SphereTree* RBD_Object::getSphereTree ( ) const
void RBD_Object::getStashedTransform ( UT_DMatrix4 xform) const

Gets the transform matrix from self to world from stashed state.

RBD_State* RBD_Object::getState ( ) const
inline

Definition at line 57 of file RBD_Object.h.

bool RBD_Object::hasAsGlueChild ( RBD_Object obj)

Returns true if the given object is one of our glue children.

bool RBD_Object::hasGlueSubObjects ( ) const

This returns true if we have any frozen sub objects.

bool RBD_Object::hasNailConstraints ( ) const
inline

Definition at line 248 of file RBD_Object.h.

void RBD_Object::initBBox ( bool  useSDF)

Calculates the bounding box.

void RBD_Object::initForCollisions ( )

Initialize for collisions.

void RBD_Object::initFromGeometry ( )

Updates the state from geometry, unless already calculated.

void RBD_Object::initRadius ( )

Calculates the radius, unless already calculated.

void RBD_Object::initSDF ( )

Builds the SDF and updates the state from the sdf, unless sdf is already built.

void RBD_Object::integratePosition ( const SIM_Time time,
const SIM_Time timestep 
)

Integrate position. Uses current velocity.

void RBD_Object::integrateVelocity ( const SIM_Time time,
const SIM_Time timestep 
)

Integrate velocity. Finds & applies all forces.

bool RBD_Object::isGlued ( ) const
inline

Return if this object is glued to somewhere else.

Definition at line 126 of file RBD_Object.h.

bool RBD_Object::isInfiniteExtent ( ) const

Returns true if this object can intersect anywhere in space Used for things like implicit planes.

void RBD_Object::preserveImpacts ( SIM_Engine engine)

Copies our NewImpact data into Impacts. This is a pass through to SIM_Object, but ensures our cached impact structure is cleared.

void RBD_Object::rebuildAffectorList ( const RBD_Solver solver,
SIM_Engine engine,
const SIM_Time time,
const SIM_Time timestep,
RBD_SharedAffectorListArray affectorlists,
UT_TokenString::Map< RBD_SharedAffectorList * > &  affectorhash 
)

Rebuilds the list of affectors for this object. Interpolates the affectors for the given time.

void RBD_Object::reloadImpacts ( SIM_Collider::SIM_ImpactApplyType  impactaplytype)

Reloads our impact data structure from the SIM_Object. This must be done whenever preserveImpacts is called.

void RBD_Object::removeConstraints ( )

Removes the constraints added. This restores stuff like the pivot to its original value.

void RBD_Object::removeGlueSubObject ( RBD_Object obj)

Removes that object as being glued to this.

void RBD_Object::restorePhysicalValues ( )
void RBD_Object::restoreState ( )

Restores the full state.

void RBD_Object::restoreStatePos ( )

Restores the position of the state using changePosition.

void RBD_Object::restoreStateVel ( )

Restores the velocity of the state using changeVelocity.

void RBD_Object::setAffectorTreeDirty ( )
inline

Definition at line 224 of file RBD_Object.h.

void RBD_Object::setArrayIndex ( int  index)
inline

Definition at line 245 of file RBD_Object.h.

void RBD_Object::stashState ( )

Stashes the current state internally.

Member Data Documentation

UT_Vector3Array RBD_Object::myPinAnchorGoalPos

Definition at line 265 of file RBD_Object.h.

UT_Vector3Array RBD_Object::myPinAnchorPos

Definition at line 264 of file RBD_Object.h.

RBD_ObjectArray RBD_Object::myPinObjects

Definition at line 259 of file RBD_Object.h.

bool RBD_Object::myPinProcessFlag
mutable

Definition at line 258 of file RBD_Object.h.


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