#include <SIM_Impacts.h>

Public Member Functions | |
| int | getNumImpacts () const |
| Get the number of contacts. | |
| const UT_Vector3 & | getPosition (int index) const |
| const UT_Vector3 & | getNormal (int index) const |
| fpreal | getImpulse (int index) const |
| Get the collision impulse. | |
| void | setImpulse (int index, fpreal impulse) |
| Set the collision impulse. | |
| void | removeLastImpact () |
| Remove the last impact. | |
| int | getFlags (int index) const |
| Get flags associated with the impact. | |
| int | getPointNumber (int index) const |
| int | getPrimitiveNumber (int index) const |
| fpreal | getPrimitiveU (int index) const |
| Get the u coordinate of the primitive where the impact occurred. | |
| fpreal | getPrimitiveV (int index) const |
| Get the v coordinate of the primitive where the impact occurred. | |
| int | getOtherObjId (int index) const |
| Get the unique id of the other object involved in a contact. | |
| int | getOtherObjPointNumber (int index) const |
| int | getOtherObjPrimitiveNumber (int index) const |
| fpreal | getOtherObjPrimitiveU (int index) const |
| fpreal | getOtherObjPrimitiveV (int index) const |
| SIM_Time | getTime (int index) const |
| Get the estimated time of the collision. | |
| void | addPositionImpact (const UT_Vector3 &pos, const UT_Vector3 &normal, fpreal impulse, int otherobjid, int otherobjptnum, int otherobjprimnum, fpreal otherobjprimu, fpreal otherobjprimv, const SIM_Time &time, int flags=0) |
| This function adds a new impact at a position in space. | |
| void | addPointImpact (const UT_Vector3 &pos, const UT_Vector3 &normal, fpreal impulse, int ptnum, int otherobjid, int otherobjptnum, int otherobjprimnum, fpreal otherobjprimu, fpreal otherobjprimv, const SIM_Time &time, int flags=0) |
| void | addPrimitiveImpact (const UT_Vector3 &pos, const UT_Vector3 &normal, fpreal impulse, int primnum, fpreal primu, fpreal primv, int otherobjid, int otherobjptnum, int otherobjprimnum, fpreal otherobjprimu, fpreal otherobjprimv, const SIM_Time &time, int flags=0) |
| void | mergeImpacts (const SIM_Impacts &src) |
| Merge the impacts from another SIM_Impacts data into this one. | |
| void | mergeImpactsInTimeRange (const SIM_Impacts &src, const SIM_Time &startTime, const SIM_Time &endTime) |
| void | keepOnlyImpactsForAffectors (const SIM_ObjectArray &affectors, int thisobjectid, int startindex) |
Static Public Member Functions | |
| static UT_Vector3 | getRequiredImpulse (const UT_Vector3 &worldspacepos, const UT_Vector3 &nml, const SIM_Object *obja, int ptnuma, bool objainfinitemass, const SIM_Object *objb, int ptnumb, bool objbinfinitemass, fpreal bounce, fpreal friction, fpreal dynamicfrictionmultiplier, bool usesdfvelocitya=false, bool usepointvelocitya=true, bool usesdfvelocityb=false, bool usepointvelocityb=true) |
| static UT_Vector3 | getRequiredImpulse (const UT_DMatrix3 &Ka, const UT_Vector3 &vela, const UT_Vector3 &worldspacepos, const UT_Vector3 &nml, const SIM_Object *objb, int ptnumb, bool objbinfinitemass, fpreal bounce, fpreal friction, fpreal dynamicfrictionmultiplier, bool usesdfvelocityb=false, bool usepointvelocityb=true) |
| static UT_Vector3 | getRequiredImpulse (const UT_Vector3 &desiredrelvel, const UT_DMatrix3 &Ka, const UT_Vector3 &vela, const UT_DMatrix3 &Kb, const UT_Vector3 &velb, const UT_Vector3 &worldspacepos, const UT_Vector3 &nml, fpreal friction, fpreal dynamicfrictionmultiplier) |
| static void | splitImpulse (const UT_Vector3 &impulse, const UT_Vector3 &normal, fpreal &normalImpulseLength, UT_Vector3 &tangentImpulse) |
| Split an impulse into normal and tangential (friction) components. | |
Protected Member Functions | |
| SIM_Impacts (const SIM_DataFactory *factory) | |
| The SIM_Impacts constructor. | |
| virtual | ~SIM_Impacts () |
| The SIM_Impacts destructor. | |
| virtual void | initializeSubclass () |
| Clears out all contact information. | |
| virtual void | makeEqualSubclass (const SIM_Data *source) |
| Copies the contact information from another SIM_Impacts. | |
| virtual void | saveSubclass (ostream &os) const |
| Saves the contact information to a stream. | |
| virtual bool | loadSubclass (UT_IStream &is) |
| Loads contact information from a stream. | |
| virtual int64 | getMemorySizeSubclass () const |
| Returns the total memory used by this object. | |
| virtual SIM_Query * | createQueryObjectSubclass () const |
| Creates a SIM_QueryArrays object to treat impact as a record. | |
| void | resizeArrays (int numimpacts) |
| void | removeImpact (int index) |
Remember your basic physics and the definition of "impulse": I = F * dt = m * dv
Definition at line 91 of file SIM_Impacts.h.
| SIM_Impacts::SIM_Impacts | ( | const SIM_DataFactory * | factory | ) | [explicit, protected] |
The SIM_Impacts constructor.
| virtual SIM_Impacts::~SIM_Impacts | ( | ) | [protected, virtual] |
The SIM_Impacts destructor.
| void SIM_Impacts::addPointImpact | ( | const UT_Vector3 & | pos, | |
| const UT_Vector3 & | normal, | |||
| fpreal | impulse, | |||
| int | ptnum, | |||
| int | otherobjid, | |||
| int | otherobjptnum, | |||
| int | otherobjprimnum, | |||
| fpreal | otherobjprimu, | |||
| fpreal | otherobjprimv, | |||
| const SIM_Time & | time, | |||
| int | flags = 0 | |||
| ) |
This function adds a new impact at a position in space and associates it with a particular point.
| void SIM_Impacts::addPositionImpact | ( | const UT_Vector3 & | pos, | |
| const UT_Vector3 & | normal, | |||
| fpreal | impulse, | |||
| int | otherobjid, | |||
| int | otherobjptnum, | |||
| int | otherobjprimnum, | |||
| fpreal | otherobjprimu, | |||
| fpreal | otherobjprimv, | |||
| const SIM_Time & | time, | |||
| int | flags = 0 | |||
| ) |
This function adds a new impact at a position in space.
| void SIM_Impacts::addPrimitiveImpact | ( | const UT_Vector3 & | pos, | |
| const UT_Vector3 & | normal, | |||
| fpreal | impulse, | |||
| int | primnum, | |||
| fpreal | primu, | |||
| fpreal | primv, | |||
| int | otherobjid, | |||
| int | otherobjptnum, | |||
| int | otherobjprimnum, | |||
| fpreal | otherobjprimu, | |||
| fpreal | otherobjprimv, | |||
| const SIM_Time & | time, | |||
| int | flags = 0 | |||
| ) |
This function adds a new impact at a position in space and associates it with a particular primitive and UV coordinate.
| virtual SIM_Query* SIM_Impacts::createQueryObjectSubclass | ( | ) | const [protected, virtual] |
| int SIM_Impacts::getFlags | ( | int | index | ) | const |
Get flags associated with the impact.
| fpreal SIM_Impacts::getImpulse | ( | int | index | ) | const |
Get the collision impulse.
| virtual int64 SIM_Impacts::getMemorySizeSubclass | ( | ) | const [protected, virtual] |
| const UT_Vector3& SIM_Impacts::getNormal | ( | int | index | ) | const |
Get the normal for a particular contact, pointing away from the first object. This value generally represents the normal of the surface at the point of contact. This value is used to determine the direction of the impact force at this contact point.
| int SIM_Impacts::getNumImpacts | ( | ) | const |
Get the number of contacts.
| int SIM_Impacts::getOtherObjId | ( | int | index | ) | const |
Get the unique id of the other object involved in a contact.
| int SIM_Impacts::getOtherObjPointNumber | ( | int | index | ) | const |
Get the point number on the other object involved in the collision. This function may return -1 if the point number is unknown.
| int SIM_Impacts::getOtherObjPrimitiveNumber | ( | int | index | ) | const |
Get the primitive number on the other object involved in the collision. This function may return -1 if the primitive number is unknown.
| fpreal SIM_Impacts::getOtherObjPrimitiveU | ( | int | index | ) | const |
Get the u coordinate of the primitive where the impact occurred on the other object.
| fpreal SIM_Impacts::getOtherObjPrimitiveV | ( | int | index | ) | const |
Get the v coordinate of the primitive where the impact occurred on the other object.
| int SIM_Impacts::getPointNumber | ( | int | index | ) | const |
Get the point number involved in the collision. This function may return -1 if the point number is unknown.
| const UT_Vector3& SIM_Impacts::getPosition | ( | int | index | ) | const |
Get the position for a particular contact. The position is stored in simulation space.
| int SIM_Impacts::getPrimitiveNumber | ( | int | index | ) | const |
Get the primitive number involved in the collision. This function may return -1 if the primitive number is unknown.
| fpreal SIM_Impacts::getPrimitiveU | ( | int | index | ) | const |
Get the u coordinate of the primitive where the impact occurred.
| fpreal SIM_Impacts::getPrimitiveV | ( | int | index | ) | const |
Get the v coordinate of the primitive where the impact occurred.
| static UT_Vector3 SIM_Impacts::getRequiredImpulse | ( | const UT_Vector3 & | desiredrelvel, | |
| const UT_DMatrix3 & | Ka, | |||
| const UT_Vector3 & | vela, | |||
| const UT_DMatrix3 & | Kb, | |||
| const UT_Vector3 & | velb, | |||
| const UT_Vector3 & | worldspacepos, | |||
| const UT_Vector3 & | nml, | |||
| fpreal | friction, | |||
| fpreal | dynamicfrictionmultiplier | |||
| ) | [static] |
| static UT_Vector3 SIM_Impacts::getRequiredImpulse | ( | const UT_DMatrix3 & | Ka, | |
| const UT_Vector3 & | vela, | |||
| const UT_Vector3 & | worldspacepos, | |||
| const UT_Vector3 & | nml, | |||
| const SIM_Object * | objb, | |||
| int | ptnumb, | |||
| bool | objbinfinitemass, | |||
| fpreal | bounce, | |||
| fpreal | friction, | |||
| fpreal | dynamicfrictionmultiplier, | |||
| bool | usesdfvelocityb = false, |
|||
| bool | usepointvelocityb = true | |||
| ) | [static] |
| static UT_Vector3 SIM_Impacts::getRequiredImpulse | ( | const UT_Vector3 & | worldspacepos, | |
| const UT_Vector3 & | nml, | |||
| const SIM_Object * | obja, | |||
| int | ptnuma, | |||
| bool | objainfinitemass, | |||
| const SIM_Object * | objb, | |||
| int | ptnumb, | |||
| bool | objbinfinitemass, | |||
| fpreal | bounce, | |||
| fpreal | friction, | |||
| fpreal | dynamicfrictionmultiplier, | |||
| bool | usesdfvelocitya = false, |
|||
| bool | usepointvelocitya = true, |
|||
| bool | usesdfvelocityb = false, |
|||
| bool | usepointvelocityb = true | |||
| ) | [static] |
Calculates the impulses that should be applied on objects a and b. The resulting velocity of the specified points on the two objects after applying the impulse should be (-relvel * bounce). Either or both of obja and objb can be null in which case the mass of those objects is considered to be infinite. The ptnum values can be -1 if the world space position should be used to fetch the impulse mass matrix. The dynamicfrictionmultiplier is multiplied by the friction value to get the dynamic friction value. The returned impulse should be applied equally to both objects. Note that the returned impulse may have a normal different than nml. The normal of the returned impulse should be used, as the impact normal, not the original nml. Otherwise the impulse magnitude will be wrong. Also, the output normal properly accounts for friction. However, the returned normal direction will be in the same hemisphere as the passed in normal, so it can be used directly as the impact normal for object a (the passed in normal is the normal on objb).
| SIM_Time SIM_Impacts::getTime | ( | int | index | ) | const |
Get the estimated time of the collision.
| virtual void SIM_Impacts::initializeSubclass | ( | ) | [protected, virtual] |
| void SIM_Impacts::keepOnlyImpactsForAffectors | ( | const SIM_ObjectArray & | affectors, | |
| int | thisobjectid, | |||
| int | startindex | |||
| ) |
This is a very special-purpose function used by SIM_Engine. It removes any impacts that are self-impacts or that involve other objects that are not in the supplied object array. It starts the search for removal at the supplied index. This is used to eliminate impact data during feedback iteration so that we don't end up multiply applying impacts on non-feedback objects.
| virtual bool SIM_Impacts::loadSubclass | ( | UT_IStream & | is | ) | [protected, virtual] |
| virtual void SIM_Impacts::makeEqualSubclass | ( | const SIM_Data * | source | ) | [protected, virtual] |
| void SIM_Impacts::mergeImpacts | ( | const SIM_Impacts & | src | ) |
Merge the impacts from another SIM_Impacts data into this one.
| void SIM_Impacts::mergeImpactsInTimeRange | ( | const SIM_Impacts & | src, | |
| const SIM_Time & | startTime, | |||
| const SIM_Time & | endTime | |||
| ) |
Merge only the impacts in the given time range. This is useful for feedback and substepping: it allows merging of feedback impacts from the fullstep end object to a substep object.
| void SIM_Impacts::removeImpact | ( | int | index | ) | [protected] |
Remove a impact! O(n) operation. This is protected because the use of this method is discouraged.
| void SIM_Impacts::removeLastImpact | ( | ) |
Remove the last impact.
| void SIM_Impacts::resizeArrays | ( | int | numimpacts | ) | [protected] |
Helper method for the loadSubclass method to resize all of our member variable arrays.
| virtual void SIM_Impacts::saveSubclass | ( | ostream & | os | ) | const [protected, virtual] |
| void SIM_Impacts::setImpulse | ( | int | index, | |
| fpreal | impulse | |||
| ) |
Set the collision impulse.
| static void SIM_Impacts::splitImpulse | ( | const UT_Vector3 & | impulse, | |
| const UT_Vector3 & | normal, | |||
| fpreal & | normalImpulseLength, | |||
| UT_Vector3 & | tangentImpulse | |||
| ) | [static] |
Split an impulse into normal and tangential (friction) components.
1.5.9