#include <SIM_Force.h>

Public Types | |
| enum | SIM_ForceSample { SIM_FORCE_SAMPLEPOINT, SIM_FORCE_SAMPLECIRCLE, SIM_FORCE_SAMPLESPHERE } |
Public Member Functions | |
| void | getForce (const SIM_Object &object, const UT_Vector3 &position, const UT_Vector3 &velocity, const UT_Vector3 &angvel, const fpreal mass, UT_Vector3 &force, UT_Vector3 &torque) const |
| bool | getForceSet (const SIM_Object &object, const UT_Vector3Array &positions, const UT_Vector3Array &velocities, const UT_Vector3Array &angvelocities, const UT_FloatArray &masses, UT_Vector3Array &forces, UT_Vector3Array &torques) const |
| SIM_ForceResolver * | getForceResolver (const SIM_Object &object) const |
| void | getForceOnCircle (const SIM_Object &object, const UT_Vector3 &position, const UT_Vector3 &normal, const fpreal radius, const UT_Vector3 &velocity, const UT_Vector3 &angvel, const fpreal mass, UT_Vector3 &force, UT_Vector3 &torque) const |
| void | getForceOnSphere (const SIM_Object &object, const UT_Vector3 &position, const fpreal radius, const UT_Vector3 &velocity, const UT_Vector3 &angvel, const fpreal mass, UT_Vector3 &force, UT_Vector3 &torque) const |
| void | getForceJacobian (const SIM_Object &object, const UT_Vector3 &position, const UT_Vector3 &velocity, const UT_Vector3 &angvel, const fpreal mass, UT_Matrix &dFdX, UT_Matrix &dFdV) const |
| SIM_ForceSample | getOptimalForceSampling () const |
| void | getPointForces (SIM_PointForceCallback &cb, const SIM_Object &object, const GU_ConstDetailHandle &gdh, const UT_DMatrix4 &geoxform, const SIM_Position *position, const SIM_Motion *motion, bool forcesinworldspace) const |
Protected Member Functions | |
| SIM_Force (const SIM_DataFactory *factory) | |
| virtual | ~SIM_Force () |
| void | applyNoise (const UT_Vector3 &pos, UT_Vector3 &forceortorque) const |
| void | applyNoise (const UT_Vector3 &pos, UT_Vector3 &force, UT_Vector3 &torque) const |
| void | applyNoiseJacobian (const UT_Vector3 &pos, UT_Matrix &dFdX, UT_Matrix &dFdV) const |
| virtual void | getForceSubclass (const SIM_Object &object, const UT_Vector3 &position, const UT_Vector3 &velocity, const UT_Vector3 &angvel, const fpreal mass, UT_Vector3 &force, UT_Vector3 &torque) const |
| virtual SIM_ForceResolver * | getForceResolverSubclass (const SIM_Object &object) const |
| virtual bool | getForceSetSubclass (const SIM_Object &object, const UT_Vector3Array &positions, const UT_Vector3Array &velocities, const UT_Vector3Array &angvelocities, const UT_FloatArray &masses, UT_Vector3Array &forces, UT_Vector3Array &torque) const |
| virtual void | getForceOnCircleSubclass (const SIM_Object &object, const UT_Vector3 &position, const UT_Vector3 &normal, const fpreal radius, const UT_Vector3 &velocity, const UT_Vector3 &angvel, const fpreal mass, UT_Vector3 &force, UT_Vector3 &torque) const |
| virtual void | getForceOnSphereSubclass (const SIM_Object &object, const UT_Vector3 &position, const fpreal radius, const UT_Vector3 &velocity, const UT_Vector3 &angvel, const fpreal mass, UT_Vector3 &force, UT_Vector3 &torque) const |
| virtual void | getForceJacobianSubclass (const SIM_Object &object, const UT_Vector3 &position, const UT_Vector3 &velocity, const UT_Vector3 &angvel, const fpreal mass, UT_Matrix &dFdX, UT_Matrix &dFdV) const |
| virtual SIM_ForceSample | getOptimalForceSamplingSubclass () const |
Definition at line 52 of file SIM_Force.h.
Definition at line 55 of file SIM_Force.h.
| SIM_Force::SIM_Force | ( | const SIM_DataFactory * | factory | ) | [explicit, protected] |
| virtual SIM_Force::~SIM_Force | ( | ) | [protected, virtual] |
| void SIM_Force::applyNoise | ( | const UT_Vector3 & | pos, | |
| UT_Vector3 & | force, | |||
| UT_Vector3 & | torque | |||
| ) | const [protected] |
Looks for a SIM_Noise subdata and multiplies the force and torque vector by the noise value at the specified position. This is equivalent to calling the alternate applyNoise function twice, but eliminates the need to look up the noise value twice.
| void SIM_Force::applyNoise | ( | const UT_Vector3 & | pos, | |
| UT_Vector3 & | forceortorque | |||
| ) | const [protected] |
Looks for a SIM_Noise subdata and multiplies the force or torque vector by the noise value at the specified position.
| void SIM_Force::applyNoiseJacobian | ( | const UT_Vector3 & | pos, | |
| UT_Matrix & | dFdX, | |||
| UT_Matrix & | dFdV | |||
| ) | const [protected] |
The dFdX and dFdV jacobians should already be filled out with the jacobians of this force prior to noise. They are then scaled to match the magnitude of the noise at this location.
| void SIM_Force::getForce | ( | const SIM_Object & | object, | |
| const UT_Vector3 & | position, | |||
| const UT_Vector3 & | velocity, | |||
| const UT_Vector3 & | angvel, | |||
| const fpreal | mass, | |||
| UT_Vector3 & | force, | |||
| UT_Vector3 & | torque | |||
| ) | const |
Returns the force and torque applied by this force to a point. This function calls getForceSubclass().
| void SIM_Force::getForceJacobian | ( | const SIM_Object & | object, | |
| const UT_Vector3 & | position, | |||
| const UT_Vector3 & | velocity, | |||
| const UT_Vector3 & | angvel, | |||
| const fpreal | mass, | |||
| UT_Matrix & | dFdX, | |||
| UT_Matrix & | dFdV | |||
| ) | const |
Returns the derivatives of force & torque with respect to position and velocity. The jacobians are 6x6 matrices which will be initialized as UT_Matrix(1, 6, 1, 6).
| virtual void SIM_Force::getForceJacobianSubclass | ( | const SIM_Object & | object, | |
| const UT_Vector3 & | position, | |||
| const UT_Vector3 & | velocity, | |||
| const UT_Vector3 & | angvel, | |||
| const fpreal | mass, | |||
| UT_Matrix & | dFdX, | |||
| UT_Matrix & | dFdV | |||
| ) | const [protected, virtual] |
Returns the derivatives of force & torque with respect to position and velocity. The jacobians are 6x6 matrices indexed from 1 (ie, dFdX(1,1) is first element). The default behaviour is to return 0 matrices. Note that the matrices are already initialized to 0 when this is called.
Reimplemented in SIM_ForceDrag, and SIM_ForceField.
| void SIM_Force::getForceOnCircle | ( | const SIM_Object & | object, | |
| const UT_Vector3 & | position, | |||
| const UT_Vector3 & | normal, | |||
| const fpreal | radius, | |||
| const UT_Vector3 & | velocity, | |||
| const UT_Vector3 & | angvel, | |||
| const fpreal | mass, | |||
| UT_Vector3 & | force, | |||
| UT_Vector3 & | torque | |||
| ) | const |
Returns the force and torque applied by this force to a circle. This function calls getForceOnCircleSubclass().
| virtual void SIM_Force::getForceOnCircleSubclass | ( | const SIM_Object & | object, | |
| const UT_Vector3 & | position, | |||
| const UT_Vector3 & | normal, | |||
| const fpreal | radius, | |||
| const UT_Vector3 & | velocity, | |||
| const UT_Vector3 & | angvel, | |||
| const fpreal | mass, | |||
| UT_Vector3 & | force, | |||
| UT_Vector3 & | torque | |||
| ) | const [protected, virtual] |
Returns the force and torque applied by this force to a circle. The outputs may be modified according to the information passed in about the object to which the force is being applied. The default implementation calls getForce() and assumes this is the force on a unit area. So the force and torque are then scaled by the area of the circle.
Reimplemented in SIM_ForceDrag, SIM_ForceFan, SIM_ForceField, SIM_ForceGravity, SIM_ForceImpulse, SIM_ForceVelImpulse, and HDK_Sample::SIM_ForceOrbit.
| void SIM_Force::getForceOnSphere | ( | const SIM_Object & | object, | |
| const UT_Vector3 & | position, | |||
| const fpreal | radius, | |||
| const UT_Vector3 & | velocity, | |||
| const UT_Vector3 & | angvel, | |||
| const fpreal | mass, | |||
| UT_Vector3 & | force, | |||
| UT_Vector3 & | torque | |||
| ) | const |
Returns the force and torque applied by this force to a sphere. This function calls getForceOnSphereSubclass().
| virtual void SIM_Force::getForceOnSphereSubclass | ( | const SIM_Object & | object, | |
| const UT_Vector3 & | position, | |||
| const fpreal | radius, | |||
| const UT_Vector3 & | velocity, | |||
| const UT_Vector3 & | angvel, | |||
| const fpreal | mass, | |||
| UT_Vector3 & | force, | |||
| UT_Vector3 & | torque | |||
| ) | const [protected, virtual] |
Returns the force and torque applied by this force to a sphere. The outputs may be modified according to the information passed in about the object to which the force is being applied. The default implementation calls getForce() and assumes that the result is a force per unit volume. The force and torque are then scaled by the volume of the sphere.
Reimplemented in SIM_ForceBuoyancy, SIM_ForceGravity, SIM_ForceImpulse, SIM_ForceVelImpulse, and HDK_Sample::SIM_ForceOrbit.
| SIM_ForceResolver* SIM_Force::getForceResolver | ( | const SIM_Object & | object | ) | const |
Creates a resolver to evaluate this force on the given object. The caller must delete the returned resolver.
| virtual SIM_ForceResolver* SIM_Force::getForceResolverSubclass | ( | const SIM_Object & | object | ) | const [protected, virtual] |
Creates a force resolver to evaluate this force in a threadsafe manner.
Reimplemented in SIM_ForceDrag, SIM_ForceField, SIM_ForceGravity, SIM_ForceReferenceFrame, and SIM_ForceUniform.
| bool SIM_Force::getForceSet | ( | const SIM_Object & | object, | |
| const UT_Vector3Array & | positions, | |||
| const UT_Vector3Array & | velocities, | |||
| const UT_Vector3Array & | angvelocities, | |||
| const UT_FloatArray & | masses, | |||
| UT_Vector3Array & | forces, | |||
| UT_Vector3Array & | torques | |||
| ) | const |
Returns the forces and torques applied by this force to a list of points. This function calls getForceSetSubclass(). This function is available so that subclasses that implement getForceSetSubclass can make use of multithreading for a set of force calculations. Returns true if ok, false otherwise. (We use this return value to determine whether or not a subclass actually implements this function)
| virtual bool SIM_Force::getForceSetSubclass | ( | const SIM_Object & | object, | |
| const UT_Vector3Array & | positions, | |||
| const UT_Vector3Array & | velocities, | |||
| const UT_Vector3Array & | angvelocities, | |||
| const UT_FloatArray & | masses, | |||
| UT_Vector3Array & | forces, | |||
| UT_Vector3Array & | torque | |||
| ) | const [protected, virtual] |
Returns the forces and torques applied by this force to a list of points. Returns true if ok, false otherwise. This return value is used to determine whether or not subclasses actually implement this function. If this is implemented, it is the implementations responsibility to resize the forces & torque arrays appropriately.
Reimplemented in SIM_ForceVex, and SIM_ForceVortex.
| virtual void SIM_Force::getForceSubclass | ( | const SIM_Object & | object, | |
| const UT_Vector3 & | position, | |||
| const UT_Vector3 & | velocity, | |||
| const UT_Vector3 & | angvel, | |||
| const fpreal | mass, | |||
| UT_Vector3 & | force, | |||
| UT_Vector3 & | torque | |||
| ) | const [protected, virtual] |
Returns the force and torque applied by this force to a point. The outputs may be modified according to the information passed in about the object to which the force is being applied. The default implementation sets the force and torque to zero.
Reimplemented in SIM_ForceBuoyancy, SIM_ForceDrag, SIM_ForceFan, SIM_ForceField, SIM_ForceGravity, SIM_ForceImpulse, SIM_ForceMagnet, SIM_ForcePoint, SIM_ForceReferenceFrame, SIM_ForceUniform, SIM_ForceVelImpulse, SIM_ForceVex, SIM_ForceVortex, and HDK_Sample::SIM_ForceOrbit.
| SIM_ForceSample SIM_Force::getOptimalForceSampling | ( | ) | const |
Allows solvers to query what the optimal sampling type for this force would be. Solvers do not have to respect this. This should be user overrideable so users can trade efficiency for accuracy.
| virtual SIM_ForceSample SIM_Force::getOptimalForceSamplingSubclass | ( | ) | const [protected, virtual] |
Allows solvers to query what the optimal sampling type for this force would be. Solvers do not have to respect this. This should be user overrideable so users can trade efficiency for accuracy.
Reimplemented in SIM_ForceBuoyancy, SIM_ForceDrag, SIM_ForceFan, SIM_ForceField, SIM_ForceGravity, SIM_ForceImpulse, SIM_ForceMagnet, SIM_ForcePoint, SIM_ForceReferenceFrame, SIM_ForceUniform, SIM_ForceVelImpulse, SIM_ForceVex, and SIM_ForceVortex.
| void SIM_Force::getPointForces | ( | SIM_PointForceCallback & | cb, | |
| const SIM_Object & | object, | |||
| const GU_ConstDetailHandle & | gdh, | |||
| const UT_DMatrix4 & | geoxform, | |||
| const SIM_Position * | position, | |||
| const SIM_Motion * | motion, | |||
| bool | forcesinworldspace | |||
| ) | const |
This is a convenience function for applying a force to each point in a piece of geometry. For each point in the geometry, the force on that point is calculated with the getForce() function. The result of each call is passed to the SIM_PointForceCallback::forceCallback() function, along with the point number. The position, velocity, and mass for each point come from the point attributes (if they exist), modified by the SIM_Position or SIM_Motion data if they are passed in.
1.5.9