Jet  v1.3.3
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
jet::ParticleSystemSolver2 Class Reference

Basic 2-D particle system solver. More...

#include <jet/particle_system_solver2.h>

Inheritance diagram for jet::ParticleSystemSolver2:
jet::PhysicsAnimation jet::Animation jet::SphSolver2 jet::PciSphSolver2

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 Vector2Dgravity () const
 Returns the gravity. More...
 
void setGravity (const Vector2D &newGravity)
 Sets the gravity. More...
 
const ParticleSystemData2PtrparticleSystemData () const
 Returns the particle system data. More...
 
const Collider2Ptrcollider () const
 Returns the collider. More...
 
void setCollider (const Collider2Ptr &newCollider)
 Sets the collider. More...
 
const ParticleEmitter2Ptremitter () const
 Returns the emitter. More...
 
void setEmitter (const ParticleEmitter2Ptr &newEmitter)
 Sets the emitter. More...
 
const VectorField2Ptrwind () 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...
 

Detailed Description

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.

See also
SphSolver2

Constructor & Destructor Documentation

◆ ParticleSystemSolver2() [1/2]

jet::ParticleSystemSolver2::ParticleSystemSolver2 ( )

Constructs an empty solver.

◆ ParticleSystemSolver2() [2/2]

jet::ParticleSystemSolver2::ParticleSystemSolver2 ( double  radius,
double  mass 
)

Constructs a solver with particle parameters.

◆ ~ParticleSystemSolver2()

virtual jet::ParticleSystemSolver2::~ParticleSystemSolver2 ( )
virtual

Destructor.

Member Function Documentation

◆ accumulateForces()

virtual void jet::ParticleSystemSolver2::accumulateForces ( double  timeStepInSeconds)
protectedvirtual

Accumulates forces applied to the particles.

Reimplemented in jet::SphSolver2.

◆ builder()

static Builder jet::ParticleSystemSolver2::builder ( )
static

Returns builder fox ParticleSystemSolver2.

◆ collider()

const Collider2Ptr& jet::ParticleSystemSolver2::collider ( ) const

Returns the collider.

◆ dragCoefficient()

double jet::ParticleSystemSolver2::dragCoefficient ( ) const

Returns the drag coefficient.

◆ emitter()

const ParticleEmitter2Ptr& jet::ParticleSystemSolver2::emitter ( ) const

Returns the emitter.

◆ gravity()

const Vector2D& jet::ParticleSystemSolver2::gravity ( ) const

Returns the gravity.

◆ onAdvanceTimeStep()

void jet::ParticleSystemSolver2::onAdvanceTimeStep ( double  timeStepInSeconds)
overrideprotectedvirtual

Called to advane a single time-step.

Implements jet::PhysicsAnimation.

◆ onBeginAdvanceTimeStep()

virtual void jet::ParticleSystemSolver2::onBeginAdvanceTimeStep ( double  timeStepInSeconds)
protectedvirtual

Called when a time-step is about to begin.

Reimplemented in jet::SphSolver2, and jet::PciSphSolver2.

◆ onEndAdvanceTimeStep()

virtual void jet::ParticleSystemSolver2::onEndAdvanceTimeStep ( double  timeStepInSeconds)
protectedvirtual

Called after a time-step is completed.

Reimplemented in jet::SphSolver2.

◆ onInitialize()

void jet::ParticleSystemSolver2::onInitialize ( )
overrideprotectedvirtual

Initializes the simulator.

Reimplemented from jet::PhysicsAnimation.

◆ particleSystemData()

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.

Returns
The particle system data.

◆ resolveCollision() [1/2]

void jet::ParticleSystemSolver2::resolveCollision ( )
protected

Resolves any collisions occured by the particles.

◆ resolveCollision() [2/2]

void jet::ParticleSystemSolver2::resolveCollision ( ArrayAccessor1< Vector2D newPositions,
ArrayAccessor1< Vector2D newVelocities 
)
protected

Resolves any collisions occured by the particles where the particle state is given by the position and velocity arrays.

◆ restitutionCoefficient()

double jet::ParticleSystemSolver2::restitutionCoefficient ( ) const

Sets the restitution coefficient.

◆ setCollider()

void jet::ParticleSystemSolver2::setCollider ( const Collider2Ptr newCollider)

Sets the collider.

◆ setDragCoefficient()

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.

Parameters
[in]newDragCoefficientThe new drag coefficient.

◆ setEmitter()

void jet::ParticleSystemSolver2::setEmitter ( const ParticleEmitter2Ptr newEmitter)

Sets the emitter.

◆ setGravity()

void jet::ParticleSystemSolver2::setGravity ( const Vector2D newGravity)

Sets the gravity.

◆ setParticleSystemData()

void jet::ParticleSystemSolver2::setParticleSystemData ( const ParticleSystemData2Ptr newParticles)
protected

Assign a new particle system data.

◆ setRestitutionCoefficient()

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.

Parameters
[in]newRestitutionCoefficientThe new restitution coefficient.

◆ setWind()

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.

Parameters
[in]newWindThe new wind.

◆ wind()

const VectorField2Ptr& jet::ParticleSystemSolver2::wind ( ) const

Returns the wind field.


The documentation for this class was generated from the following file: