15 template <
int N,
typename Real>
37 inline void SetMass(
int s,
int r,
int c, Real mass);
42 Real
const&
GetMass(
int s,
int r,
int c)
const;
65 inline Real
const&
GetConstantS(
int s,
int r,
int c)
const;
66 inline Real
const&
GetLengthS(
int s,
int r,
int c)
const;
67 inline Real
const&
GetConstantR(
int s,
int r,
int c)
const;
68 inline Real
const&
GetLengthR(
int s,
int r,
int c)
const;
69 inline Real
const&
GetConstantC(
int s,
int r,
int c)
const;
70 inline Real
const&
GetLengthC(
int s,
int r,
int c)
const;
89 inline int GetIndex(
int s,
int r,
int c)
const;
99 template <
int N,
typename Real>
104 template <
int N,
typename Real>
106 int numCols, Real step)
113 mLengthS(numSlices * numRows * numCols),
115 mLengthR(numSlices * numRows * numCols),
117 mLengthC(numSlices * numRows * numCols)
127 template <
int N,
typename Real>
inline 133 template <
int N,
typename Real>
inline 139 template <
int N,
typename Real>
inline 145 template <
int N,
typename Real>
inline 151 template <
int N,
typename Real>
inline 158 template <
int N,
typename Real>
inline 165 template <
int N,
typename Real>
inline 171 template <
int N,
typename Real>
inline 178 template <
int N,
typename Real>
inline 185 template <
int N,
typename Real>
inline 192 template <
int N,
typename Real>
inline 198 template <
int N,
typename Real>
inline 205 template <
int N,
typename Real>
inline 211 template <
int N,
typename Real>
inline 218 template <
int N,
typename Real>
inline 224 template <
int N,
typename Real>
inline 230 template <
int N,
typename Real>
inline 236 template <
int N,
typename Real>
inline 242 template <
int N,
typename Real>
inline 248 template <
int N,
typename Real>
inline 254 template <
int N,
typename Real>
inline 260 template <
int N,
typename Real>
267 template <
int N,
typename Real>
284 int s,
r,
c, prev, next;
290 diff = position[prev] - position[i];
292 force =
GetConstantS(s - 1, r, c) * ((Real)1 - ratio) * diff;
293 acceleration += this->
mInvMass[i] * force;
299 diff = position[next] - position[i];
301 force =
GetConstantS(s, r, c) * ((Real)1 - ratio) * diff;
302 acceleration += this->
mInvMass[i] * force;
308 diff = position[prev] - position[i];
310 force =
GetConstantR(s, r - 1, c) * ((Real)1 - ratio) * diff;
311 acceleration += this->
mInvMass[i] * force;
317 diff = position[next] - position[i];
319 force =
GetConstantR(s, r, c) * ((Real)1 - ratio) * diff;
320 acceleration += this->
mInvMass[i] * force;
326 diff = position[prev] - position[i];
328 force =
GetConstantC(s, r, c - 1) * ((Real)1 - ratio) * diff;
329 acceleration += this->
mInvMass[i] * force;
335 diff = position[next] - position[i];
337 force =
GetConstantC(s, r, c) * ((Real)1 - ratio) * diff;
338 acceleration += this->
mInvMass[i] * force;
344 template <
int N,
typename Real>
inline 350 template <
int N,
typename Real>
virtual ~MassSpringVolume()
Real const & GetConstantR(int s, int r, int c) const
Real const & GetConstantS(int s, int r, int c) const
Vector< N, Real > const & GetPosition(int s, int r, int c) const
std::vector< Real > mLengthC
void SetVelocity(int s, int r, int c, Vector< N, Real > const &velocity)
std::vector< Real > mConstantS
Real const & GetMass(int i) const
virtual Vector< N, Real > ExternalAcceleration(int i, Real time, std::vector< Vector< N, Real >> const &position, std::vector< Vector< N, Real >> const &velocity)
virtual Vector< N, Real > Acceleration(int i, Real time, std::vector< Vector< N, Real >> const &position, std::vector< Vector< N, Real >> const &velocity)
Real const & GetMass(int s, int r, int c) const
Real const & GetLengthR(int s, int r, int c) const
void SetConstantC(int s, int r, int c, Real constant)
void SetLengthR(int s, int r, int c, Real length)
Vector< N, Real > const & GetVelocity(int s, int r, int c) const
void SetMass(int i, Real mass)
void SetLengthS(int s, int r, int c, Real length)
void SetLengthC(int s, int r, int c, Real length)
Real const & GetLengthS(int s, int r, int c) const
void GetCoordinates(int i, int &s, int &r, int &c) const
void SetConstantS(int s, int r, int c, Real constant)
void SetVelocity(int i, Vector< N, Real > const &velocity)
std::vector< Real > mConstantC
void SetPosition(int s, int r, int c, Vector< N, Real > const &position)
Real const & GetConstantC(int s, int r, int c) const
std::vector< Real > mLengthS
MassSpringVolume(int numSlices, int numRows, int numCols, Real step)
int GetIndex(int s, int r, int c) const
std::vector< Real > mConstantR
Vector< N, Real > const & GetVelocity(int i) const
GLuint GLsizei GLsizei * length
DualQuaternion< Real > Length(DualQuaternion< Real > const &d, bool robust=false)
void SetPosition(int i, Vector< N, Real > const &position)
std::vector< Real > mLengthR
std::vector< Real > mInvMass
Real const & GetLengthC(int s, int r, int c) const
void SetMass(int s, int r, int c, Real mass)
Vector< N, Real > const & GetPosition(int i) const
void SetConstantR(int s, int r, int c, Real constant)