D’ALEMBERT’S PRINCIPLE
For particles D’Alembert’s principle implies that, if we have a set of forces acting on an object, we can replace all those forces with a single force, which is calculated by
\[f = \sum\limits_{i} f_{i} \]In other words, we simply add the forces together using vector addition, and we apply the single force that results.
FORCE GENERATORS
class ParticleForceGenerator
{
public:
/**
* Overload this in implementations of the interface to calculate
* and update the force applied to the given particle.
*/
virtual void updateForce(Particle *particle, real duration) = 0; //更新每个粒子的加速度
};
A GRAVITY FORCE GENERATOR
class ParticleGravity : public ParticleForceGenerator
{
/** Holds the acceleration due to gravity. */
Vector3 gravity;
public:
/** Creates the generator with the given acceleration. */
ParticleGravity(const Vector3 &gravity);
/** Applies the gravitational force to the given particle. */
virtual void updateForce(Particle *particle, real duration);
};
标签:adding,given,force,particle,gravity,general,forces,public
From: https://www.cnblogs.com/ultramanX/p/18070643