HDK
|
#include <RBD_Object.h>
Public Member Functions | |
RBD_Object (const SIM_Solver *solver, SIM_Object *obj) | |
~RBD_Object () override | |
SIM_Object * | getObject () const |
RBD_State * | getState () const |
SIM_Impacts * | getImpacts () |
const SIM_SDF * | getSDF () const |
const SIM_Geometry * | getGeometry () const |
const RBD_SphereTree * | getSphereTree () 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_Object * | getNthGlueSubObject (int i) const |
RBD_Object * | getGlueParent () 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 ×tep) |
Applies impulses from SIM_Impacts data. More... | |
void | integratePosition (const SIM_Time &time, const SIM_Time ×tep) |
Integrate position. Uses current velocity. More... | |
void | integrateVelocity (const SIM_Time &time, const SIM_Time ×tep) |
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 ×tep, 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_Object * | getAffector (int j) const |
const SIM_Collider * | getCollider (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_Solver * | getCreatedBySolver () 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) |
Definition at line 48 of file RBD_Object.h.
RBD_Object::RBD_Object | ( | const SIM_Solver * | solver, |
SIM_Object * | obj | ||
) |
|
override |
|
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 | ( | ) |
|
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.
|
inline |
Definition at line 232 of file RBD_Object.h.
|
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.
|
inline |
Definition at line 251 of file RBD_Object.h.
|
inline |
Definition at line 234 of file RBD_Object.h.
|
inline |
Definition at line 60 of file RBD_Object.h.
|
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.
|
inline |
Definition at line 237 of file RBD_Object.h.
SIM_Impacts* RBD_Object::getImpacts | ( | ) |
RBD_Object* RBD_Object::getNthGlueSubObject | ( | int | i | ) | 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
|
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.
|
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.
|
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.
|
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.
|
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.
Integrate position. Uses current velocity.
Integrate velocity. Finds & applies all forces.
|
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.
|
inline |
Definition at line 224 of file RBD_Object.h.
Definition at line 245 of file RBD_Object.h.
void RBD_Object::stashState | ( | ) |
Stashes the current state internally.
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.
|
mutable |
Definition at line 258 of file RBD_Object.h.