18 template <
typename Real>
97 template <
typename Real>
102 template <
typename Real>
105 mMass(
std::numeric_limits<Real>::max()),
120 template <
typename Real>
123 if ((Real)0 < mass && mass < std::numeric_limits<Real>::max())
131 mMass = std::numeric_limits<Real>::max();
144 template <
typename Real>
151 template <
typename Real>
inline 157 template <
typename Real>
164 template <
typename Real>
171 template <
typename Real>
180 template <
typename Real>
187 template <
typename Real>
194 template <
typename Real>
203 template <
typename Real>
inline 209 template <
typename Real>
inline 215 template <
typename Real>
inline 221 template <
typename Real>
inline 227 template <
typename Real>
233 template <
typename Real>
239 template <
typename Real>
inline 245 template <
typename Real>
inline 251 template <
typename Real>
inline 257 template <
typename Real>
inline 263 template <
typename Real>
inline 269 template <
typename Real>
inline 275 template <
typename Real>
inline 281 template <
typename Real>
287 Real halfDT = ((Real)0.5)*dt;
288 Real sixthDT = dt / ((Real)6);
289 Real TpHalfDT = t + halfDT;
292 Vector3<Real> newPosition, newLinearMomentum, newAngularMomentum,
293 newLinearVelocity, newAngularVelocity;
300 mAngularVelocity[1], mAngularVelocity[2], (Real)0);
311 newPosition =
mPosition + halfDT * A1DXDT;
312 newQuatOrient = mQuatOrient + halfDT * A1DQDT;
316 newLinearVelocity =
mInvMass * newLinearMomentum;
317 newAngularVelocity = newAngularMomentum * newRotOrient;
318 newAngularVelocity =
mInvInertia * newAngularVelocity;
319 newAngularVelocity = newRotOrient * newAngularVelocity;
324 newAngularVelocity[2], (Real)0);
328 newQuatOrient, newLinearMomentum, newAngularMomentum, newRotOrient,
329 newLinearVelocity, newAngularVelocity);
332 newQuatOrient, newLinearMomentum, newAngularMomentum, newRotOrient,
333 newLinearVelocity, newAngularVelocity);
335 newPosition =
mPosition + halfDT * A2DXDT;
336 newQuatOrient = mQuatOrient + halfDT * A2DQDT;
340 newLinearVelocity =
mInvMass * newLinearMomentum;
341 newAngularVelocity = newAngularMomentum * newRotOrient;
342 newAngularVelocity =
mInvInertia * newAngularVelocity;
343 newAngularVelocity = newRotOrient * newAngularVelocity;
348 newAngularVelocity[2], (Real)0);
352 newQuatOrient, newLinearMomentum, newAngularMomentum, newRotOrient,
353 newLinearVelocity, newAngularVelocity);
356 newQuatOrient, newLinearMomentum, newAngularMomentum, newRotOrient,
357 newLinearVelocity, newAngularVelocity);
360 newQuatOrient = mQuatOrient + dt * A3DQDT;
364 newLinearVelocity =
mInvMass * newLinearMomentum;
365 newAngularVelocity = newAngularMomentum * newRotOrient;
366 newAngularVelocity =
mInvInertia * newAngularVelocity;
367 newAngularVelocity = newRotOrient * newAngularVelocity;
372 newAngularVelocity[2], (Real)0);
376 newQuatOrient, newLinearMomentum, newAngularMomentum, newRotOrient,
377 newLinearVelocity, newAngularVelocity);
380 newLinearMomentum, newAngularMomentum, newRotOrient,
381 newLinearVelocity, newAngularVelocity);
383 mPosition += sixthDT * (A1DXDT + ((Real)2) * (A2DXDT + A3DXDT) + A4DXDT);
384 mQuatOrient += sixthDT * (A1DQDT + ((Real)2)*(A2DQDT + A3DQDT) + A4DQDT);
Vector3< Real > mLinearVelocity
std::function< Vector3< Real > Real, Real, Vector3< Real > const &, Quaternion< Real > const &, Vector3< Real > const &, Vector3< Real > const &, Matrix3x3< Real > const &, Vector3< Real > const &, Vector3< Real > const &) > Function
Matrix3x3< Real > const & GetROrientation() const
Vector3< Real > const & GetPosition() const
Vector3< Real > const & GetAngularVelocity() const
Matrix3x3< Real > mRotOrient
Vector3< Real > mLinearMomentum
Quaternion< Real > const & GetQOrientation() const
Matrix3x3< Real > const & GetBodyInertia() const
Quaternion< Real > mQuatOrient
Matrix3x3< Real > GetWorldInertia() const
void SetLinearMomentum(Vector3< Real > const &linearMomentum)
Real GetInverseMass() const
void SetBodyInertia(Matrix3x3< Real > const &inertia)
void SetLinearVelocity(Vector3< Real > const &linearVelocity)
void SetPosition(Vector3< Real > const &position)
Vector3< Real > mPosition
Matrix3x3< Real > mInvInertia
Vector3< Real > const & GetLinearMomentum() const
Matrix3x3< Real > const & GetBodyInverseInertia() const
void SetAngularVelocity(Vector3< Real > const &angularVelocity)
void SetAngularMomentum(Vector3< Real > const &angularMomentum)
Vector3< Real > mAngularVelocity
Vector3< Real > mAngularMomentum
void SetQOrientation(Quaternion< Real > const &quatOrient)
void SetROrientation(Matrix3x3< Real > const &rotOrient)
Vector3< Real > const & GetAngularMomentum() const
static Quaternion Identity()
void Update(Real t, Real dt)
GMatrix< Real > MultiplyABT(GMatrix< Real > const &A, GMatrix< Real > const &B)
Quaternion< Real > Inverse(Quaternion< Real > const &d)
Vector3< Real > const & GetLinearVelocity() const
Matrix3x3< Real > mInertia
Matrix3x3< Real > GetWorldInverseInertia() const