|
Jet
v1.3.3
|
Basic 2-D particle system solver. More...
#include <jet/particle_system_solver2.h>
Classes | |
| class | Builder |
| Front-end to create ParticleSystemSolver2 objects step by step. More... | |
Public Member Functions | |
| ParticleSystemSolver2 () | |
| Constructs an empty solver. More... | |
| ParticleSystemSolver2 (double radius, double mass) | |
| Constructs a solver with particle parameters. More... | |
| virtual | ~ParticleSystemSolver2 () |
| Destructor. More... | |
| double | dragCoefficient () const |
| Returns the drag coefficient. More... | |
| void | setDragCoefficient (double newDragCoefficient) |
| Sets the drag coefficient. More... | |
| double | restitutionCoefficient () const |
| Sets the restitution coefficient. More... | |
| void | setRestitutionCoefficient (double newRestitutionCoefficient) |
| Sets the restitution coefficient. More... | |
| const Vector2D & | gravity () const |
| Returns the gravity. More... | |
| void | setGravity (const Vector2D &newGravity) |
| Sets the gravity. More... | |
| const ParticleSystemData2Ptr & | particleSystemData () const |
| Returns the particle system data. More... | |
| const Collider2Ptr & | collider () const |
| Returns the collider. More... | |
| void | setCollider (const Collider2Ptr &newCollider) |
| Sets the collider. More... | |
| const ParticleEmitter2Ptr & | emitter () const |
| Returns the emitter. More... | |
| void | setEmitter (const ParticleEmitter2Ptr &newEmitter) |
| Sets the emitter. More... | |
| const VectorField2Ptr & | wind () const |
| Returns the wind field. More... | |
| void | setWind (const VectorField2Ptr &newWind) |
| Sets the wind. More... | |
Public Member Functions inherited from jet::PhysicsAnimation | |
| PhysicsAnimation () | |
| Default constructor. More... | |
| virtual | ~PhysicsAnimation () |
| Destructor. More... | |
| bool | isUsingFixedSubTimeSteps () const |
| Returns true if fixed sub-timestepping is used. More... | |
| void | setIsUsingFixedSubTimeSteps (bool isUsing) |
| Sets true if fixed sub-timestepping is used. More... | |
| unsigned int | numberOfFixedSubTimeSteps () const |
| Returns the number of fixed sub-timesteps. More... | |
| void | setNumberOfFixedSubTimeSteps (unsigned int numberOfSteps) |
| Sets the number of fixed sub-timesteps. More... | |
| void | advanceSingleFrame () |
| Advances a single frame. More... | |
| Frame | currentFrame () const |
| Returns current frame. More... | |
| void | setCurrentFrame (const Frame &frame) |
| Sets current frame cursor (but do not invoke update()). More... | |
| double | currentTimeInSeconds () const |
| Returns current time in seconds. More... | |
Public Member Functions inherited from jet::Animation | |
| Animation () | |
| virtual | ~Animation () |
| void | update (const Frame &frame) |
Updates animation state for given frame. More... | |
Static Public Member Functions | |
| static Builder | builder () |
| Returns builder fox ParticleSystemSolver2. More... | |
Protected Member Functions | |
| void | onInitialize () override |
| Initializes the simulator. More... | |
| void | onAdvanceTimeStep (double timeStepInSeconds) override |
| Called to advane a single time-step. More... | |
| virtual void | accumulateForces (double timeStepInSeconds) |
| Accumulates forces applied to the particles. More... | |
| virtual void | onBeginAdvanceTimeStep (double timeStepInSeconds) |
| Called when a time-step is about to begin. More... | |
| virtual void | onEndAdvanceTimeStep (double timeStepInSeconds) |
| Called after a time-step is completed. More... | |
| void | resolveCollision () |
| Resolves any collisions occured by the particles. More... | |
| void | resolveCollision (ArrayAccessor1< Vector2D > newPositions, ArrayAccessor1< Vector2D > newVelocities) |
| void | setParticleSystemData (const ParticleSystemData2Ptr &newParticles) |
| Assign a new particle system data. More... | |
Protected Member Functions inherited from jet::PhysicsAnimation | |
| virtual unsigned int | numberOfSubTimeSteps (double timeIntervalInSeconds) const |
| Returns the required number of sub-timesteps for given time interval. More... | |
Basic 2-D particle system solver.
This class implements basic particle system solver. It includes gravity, air drag, and collision. But it does not compute particle-to-particle interaction. Thus, this solver is suitable for performing simple spray-like simulations with low computational cost. This class can be further extend to add more sophisticated simulations, such as SPH, to handle particle-to-particle intersection.
| jet::ParticleSystemSolver2::ParticleSystemSolver2 | ( | ) |
Constructs an empty solver.
| jet::ParticleSystemSolver2::ParticleSystemSolver2 | ( | double | radius, |
| double | mass | ||
| ) |
Constructs a solver with particle parameters.
|
virtual |
Destructor.
|
protectedvirtual |
Accumulates forces applied to the particles.
Reimplemented in jet::SphSolver2.
|
static |
Returns builder fox ParticleSystemSolver2.
| const Collider2Ptr& jet::ParticleSystemSolver2::collider | ( | ) | const |
Returns the collider.
| double jet::ParticleSystemSolver2::dragCoefficient | ( | ) | const |
Returns the drag coefficient.
| const ParticleEmitter2Ptr& jet::ParticleSystemSolver2::emitter | ( | ) | const |
Returns the emitter.
| const Vector2D& jet::ParticleSystemSolver2::gravity | ( | ) | const |
Returns the gravity.
|
overrideprotectedvirtual |
Called to advane a single time-step.
Implements jet::PhysicsAnimation.
|
protectedvirtual |
Called when a time-step is about to begin.
Reimplemented in jet::SphSolver2, and jet::PciSphSolver2.
|
protectedvirtual |
Called after a time-step is completed.
Reimplemented in jet::SphSolver2.
|
overrideprotectedvirtual |
Initializes the simulator.
Reimplemented from jet::PhysicsAnimation.
| const ParticleSystemData2Ptr& jet::ParticleSystemSolver2::particleSystemData | ( | ) | const |
Returns the particle system data.
This function returns the particle system data. The data is created when this solver is constructed and also owned by the solver.
|
protected |
Resolves any collisions occured by the particles.
|
protected |
Resolves any collisions occured by the particles where the particle state is given by the position and velocity arrays.
| double jet::ParticleSystemSolver2::restitutionCoefficient | ( | ) | const |
Sets the restitution coefficient.
| void jet::ParticleSystemSolver2::setCollider | ( | const Collider2Ptr & | newCollider | ) |
Sets the collider.
| void jet::ParticleSystemSolver2::setDragCoefficient | ( | double | newDragCoefficient | ) |
Sets the drag coefficient.
The drag coefficient controls the amount of air-drag. The coefficient should be a positive number and 0 means no drag force.
| [in] | newDragCoefficient | The new drag coefficient. |
| void jet::ParticleSystemSolver2::setEmitter | ( | const ParticleEmitter2Ptr & | newEmitter | ) |
Sets the emitter.
| void jet::ParticleSystemSolver2::setGravity | ( | const Vector2D & | newGravity | ) |
Sets the gravity.
|
protected |
Assign a new particle system data.
| void jet::ParticleSystemSolver2::setRestitutionCoefficient | ( | double | newRestitutionCoefficient | ) |
Sets the restitution coefficient.
The restitution coefficient controls the bouncy-ness of a particle when it hits a collider surface. The range of the coefficient should be 0 to 1 – 0 means no bounce back and 1 means perfect reflection.
| [in] | newRestitutionCoefficient | The new restitution coefficient. |
| void jet::ParticleSystemSolver2::setWind | ( | const VectorField2Ptr & | newWind | ) |
Sets the wind.
Wind can be applied to the particle system by setting a vector field to the solver.
| [in] | newWind | The new wind. |
| const VectorField2Ptr& jet::ParticleSystemSolver2::wind | ( | ) | const |
Returns the wind field.
1.8.18