15 template <
int N,
typename Real>
34 inline void SetMass(
int r,
int c, Real mass);
37 inline Real
const&
GetMass(
int r,
int c)
const;
50 inline void SetLengthC(
int r,
int c, Real length);
52 inline Real
const&
GetLengthR(
int r,
int c)
const;
54 inline Real
const&
GetLengthC(
int r,
int c)
const;
73 inline int GetIndex(
int r,
int c)
const;
82 template <
int N,
typename Real>
87 template <
int N,
typename Real>
105 template <
int N,
typename Real>
inline 111 template <
int N,
typename Real>
inline 117 template <
int N,
typename Real>
inline 123 template <
int N,
typename Real>
inline 130 template <
int N,
typename Real>
inline 137 template <
int N,
typename Real>
inline 143 template <
int N,
typename Real>
inline 150 template <
int N,
typename Real>
inline 157 template <
int N,
typename Real>
inline 163 template <
int N,
typename Real>
inline 169 template <
int N,
typename Real>
inline 175 template <
int N,
typename Real>
inline 181 template <
int N,
typename Real>
inline 187 template <
int N,
typename Real>
inline 193 template <
int N,
typename Real>
inline 199 template <
int N,
typename Real>
inline 205 template <
int N,
typename Real>
212 template <
int N,
typename Real>
229 int r,
c, prev, next;
235 diff = position[prev] - position[i];
237 force =
GetConstantR(r - 1, c) * ((Real)1 - ratio) * diff;
238 acceleration += this->
mInvMass[i] * force;
244 diff = position[next] - position[i];
247 acceleration += this->
mInvMass[i] * force;
253 diff = position[prev] - position[i];
255 force =
GetConstantC(r, c - 1) * ((Real)1 - ratio) * diff;
256 acceleration += this->
mInvMass[i] * force;
262 diff = position[next] - position[i];
265 acceleration += this->
mInvMass[i] * force;
271 template <
int N,
typename Real>
inline 277 template <
int N,
typename Real>
inline void SetLengthR(int r, int c, Real length)
void SetLengthC(int r, int c, Real length)
void SetMass(int r, int c, Real mass)
std::vector< Real > mConstantR
Vector< N, Real > const & GetPosition(int r, int c) const
Real const & GetMass(int i) const
void SetConstantR(int r, int c, Real constant)
Real const & GetLengthC(int r, int c) const
std::vector< Real > mLengthC
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 & GetLengthR(int r, int c) const
MassSpringSurface(int numRows, int numCols, Real step)
Real const & GetConstantC(int r, int c) const
Real const & GetConstantR(int r, int c) const
void GetCoordinates(int i, int &r, int &c) const
void SetMass(int i, Real mass)
std::vector< Real > mLengthR
void SetVelocity(int i, Vector< N, Real > const &velocity)
std::vector< Real > mConstantC
void SetConstantC(int r, int c, Real constant)
Real const & GetMass(int r, int c) const
int GetIndex(int r, int c) const
Vector< N, Real > const & GetVelocity(int i) const
GLuint GLsizei GLsizei * length
Vector< N, Real > const & GetVelocity(int r, int c) const
DualQuaternion< Real > Length(DualQuaternion< Real > const &d, bool robust=false)
virtual Vector< N, Real > ExternalAcceleration(int i, Real time, std::vector< Vector< N, Real >> const &position, std::vector< Vector< N, Real >> const &velocity)
void SetPosition(int i, Vector< N, Real > const &position)
void SetVelocity(int r, int c, Vector< N, Real > const &velocity)
virtual ~MassSpringSurface()
std::vector< Real > mInvMass
void SetPosition(int r, int c, Vector< N, Real > const &position)
Vector< N, Real > const & GetPosition(int i) const