Jet  v1.3.3
Public Member Functions | Protected Member Functions | List of all members
jet::PhysicsAnimation Class Referenceabstract

Abstract base class for physics-based animation. More...

#include <jet/physics_animation.h>

Inheritance diagram for jet::PhysicsAnimation:
jet::Animation jet::GridFluidSolver2 jet::GridFluidSolver3 jet::ParticleSystemSolver2 jet::ParticleSystemSolver3 jet::GridSmokeSolver2 jet::LevelSetLiquidSolver2 jet::PicSolver2 jet::GridSmokeSolver3 jet::LevelSetLiquidSolver3 jet::PicSolver3 jet::SphSolver2 jet::SphSolver3

Public Member Functions

 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...
 

Protected Member Functions

virtual void onAdvanceTimeStep (double timeIntervalInSeconds)=0
 Called when a single time-step should be advanced. More...
 
virtual unsigned int numberOfSubTimeSteps (double timeIntervalInSeconds) const
 Returns the required number of sub-timesteps for given time interval. More...
 
virtual void onInitialize ()
 Called at frame 0 to initialize the physics state. More...
 

Detailed Description

Abstract base class for physics-based animation.

This class represents physics-based animation by adding time-integration specific functions to Animation class.

Constructor & Destructor Documentation

◆ PhysicsAnimation()

jet::PhysicsAnimation::PhysicsAnimation ( )

Default constructor.

◆ ~PhysicsAnimation()

virtual jet::PhysicsAnimation::~PhysicsAnimation ( )
virtual

Destructor.

Member Function Documentation

◆ advanceSingleFrame()

void jet::PhysicsAnimation::advanceSingleFrame ( )

Advances a single frame.

◆ currentFrame()

Frame jet::PhysicsAnimation::currentFrame ( ) const

Returns current frame.

◆ currentTimeInSeconds()

double jet::PhysicsAnimation::currentTimeInSeconds ( ) const

Returns current time in seconds.

This function returns the current time which is calculated by adding current frame + sub-timesteps it passed.

◆ isUsingFixedSubTimeSteps()

bool jet::PhysicsAnimation::isUsingFixedSubTimeSteps ( ) const

Returns true if fixed sub-timestepping is used.

When performing a time-integration, it is often required to take sub-timestepping for better results. The sub-stepping can be either fixed rate or adaptive, and this function returns which feature is currently selected.

Returns
True if using fixed sub time steps, false otherwise.

◆ numberOfFixedSubTimeSteps()

unsigned int jet::PhysicsAnimation::numberOfFixedSubTimeSteps ( ) const

Returns the number of fixed sub-timesteps.

When performing a time-integration, it is often required to take sub-timestepping for better results. The sub-stepping can be either fixed rate or adaptive, and this function returns the number of fixed sub-steps.

Returns
The number of fixed sub-timesteps.

◆ numberOfSubTimeSteps()

virtual unsigned int jet::PhysicsAnimation::numberOfSubTimeSteps ( double  timeIntervalInSeconds) const
protectedvirtual

Returns the required number of sub-timesteps for given time interval.

The required number of sub-timestep can be different depending on the physics model behind the implementation. Override this function to implement own logic for model specific sub-timestepping for given time interval.

Parameters
[in]timeIntervalInSecondsThe time interval in seconds.
Returns
The required number of sub-timesteps.

Reimplemented in jet::GridFluidSolver2, jet::GridFluidSolver3, jet::SphSolver2, and jet::SphSolver3.

◆ onAdvanceTimeStep()

virtual void jet::PhysicsAnimation::onAdvanceTimeStep ( double  timeIntervalInSeconds)
protectedpure virtual

Called when a single time-step should be advanced.

When Animation::update function is called, this class will internally subdivide a frame into sub-steps if needed. Each sub-step, or time-step, is then taken to move forward in time. This function is called for each time-step, and a subclass that inherits PhysicsAnimation class should implement this function for its own physics model.

Parameters
[in]timeIntervalInSecondsThe time interval in seconds

Implemented in jet::ParticleSystemSolver2, jet::ParticleSystemSolver3, jet::GridFluidSolver2, and jet::GridFluidSolver3.

◆ onInitialize()

virtual void jet::PhysicsAnimation::onInitialize ( )
protectedvirtual

Called at frame 0 to initialize the physics state.

Inheriting classes can override this function to setup initial condition for the simulation.

Reimplemented in jet::GridFluidSolver2, jet::GridFluidSolver3, jet::ParticleSystemSolver2, jet::ParticleSystemSolver3, jet::PicSolver3, and jet::PicSolver2.

◆ setCurrentFrame()

void jet::PhysicsAnimation::setCurrentFrame ( const Frame frame)

Sets current frame cursor (but do not invoke update()).

◆ setIsUsingFixedSubTimeSteps()

void jet::PhysicsAnimation::setIsUsingFixedSubTimeSteps ( bool  isUsing)

Sets true if fixed sub-timestepping is used.

When performing a time-integration, it is often required to take sub-timestepping for better results. The sub-stepping can be either fixed rate or adaptive, and this function sets which feature should be selected.

Parameters
[in]isUsingTrue to enable fixed sub-stepping.

◆ setNumberOfFixedSubTimeSteps()

void jet::PhysicsAnimation::setNumberOfFixedSubTimeSteps ( unsigned int  numberOfSteps)

Sets the number of fixed sub-timesteps.

When performing a time-integration, it is often required to take sub-timestepping for better results. The sub-stepping can be either fixed rate or adaptive, and this function sets the number of fixed sub-steps.

Parameters
[in]numberOfStepsThe number of fixed sub-timesteps.

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