dyng
DynamicGraphLayout
Classes | Public Member Functions | List of all members
dyng::interpolator Class Reference

Used to create a smooth animation from a sequence of states given by a dynamic graph. More...

#include <interpolator.h>

Public Member Functions

 interpolator (phased)
 Sets up the default order of phases. More...
 
 interpolator (simultaneous)
 Sets up the default order of phases creating a simultaneous transition. More...
 
 interpolator ()
 Sets up the default order of phases. More...
 
 interpolator (std::vector< phase > phases)
 Initializes a custom order of phases. More...
 
void set_phases (std::vector< phase > phases)
 Sets custom order of phases. More...
 
const std::vector< phase > & get_phases () const
 
float & duration (phase p)
 You can read or set the duration of a specific phase type. More...
 
const float & duration (phase p) const
 You can read the duration of a specific phase type. More...
 
float transition_duration () const
 Returns the total length of a transition between two states. More...
 
float length (const dynamic_graph &dgraph) const
 Returns the total length of the animation. More...
 
graph_state operator() (const dynamic_graph &dgraph, float time) const
 Returns a graph state representing a single frame of animation. More...
 

Detailed Description

Used to create a smooth animation from a sequence of states given by a dynamic graph.

Calls the method dynamic_graph::states() respectively to create a graph_state corresponding to a given time frame.

(Described in section 6.1.6)

See also
dyng::phase

Constructor & Destructor Documentation

◆ interpolator() [1/4]

dyng::interpolator::interpolator ( phased  )
inline

Sets up the default order of phases.

Default order being: idle, disappear, morph, appear. Transition lasts 2 seconds.

See also
dyng::phase

◆ interpolator() [2/4]

dyng::interpolator::interpolator ( simultaneous  )
inline

Sets up the default order of phases creating a simultaneous transition.

Default order being: idle, simultaneous. Transition lasts 2 seconds.

See also
dyng::phase

◆ interpolator() [3/4]

dyng::interpolator::interpolator ( )
inline

Sets up the default order of phases.

The same as interpolator(phased).

See also
interpolator(phased)

◆ interpolator() [4/4]

dyng::interpolator::interpolator ( std::vector< phase >  phases)
inline

Initializes a custom order of phases.

The same as set_phases().

See also
set_phases()

Member Function Documentation

◆ duration() [1/2]

float& dyng::interpolator::duration ( phase  p)
inline

You can read or set the duration of a specific phase type.

Default durations are:

  • phase::idle: 0.5
  • phase::appear: 0.25
  • phase::disappear: 0.25
  • phase::morph: 1.0
  • phase::simultaneous: 1.5

◆ duration() [2/2]

const float& dyng::interpolator::duration ( phase  p) const
inline

You can read the duration of a specific phase type.

Default durations are:

  • phase::idle: 0.5
  • phase::appear: 0.25
  • phase::disappear: 0.25
  • phase::morph: 1.0
  • phase::simultaneous: 1.5

◆ length()

float dyng::interpolator::length ( const dynamic_graph dgraph) const
inline

Returns the total length of the animation.

It's equal to (dgraph.states().size() - 1) * transition_duration().

Returns
The length of the animation.

◆ operator()()

graph_state dyng::interpolator::operator() ( const dynamic_graph dgraph,
float  time 
) const
inline

Returns a graph state representing a single frame of animation.

Interpolates between states and returns corresponding graph_state representing a single frame of animation.

Parameters
timeThe time to interpolate.
Exceptions
std::out_of_rangeIf time < 0 or time > length().

◆ set_phases()

void dyng::interpolator::set_phases ( std::vector< phase >  phases)
inline

Sets custom order of phases.

You can either set to use simultaneous or phased transition.

For phased transition all three phases have to be present exactly once: phase::appear, phase::disappear, phase::morph.

For simultaneous transition phase::simultaneous has to be present exactly once.

These two approaches are incompatible. However, both can have as many idle phases as you want.

Exceptions
std::invalid_argumentIf incompatible or incorrect phases are used.
See also
phase

◆ transition_duration()

float dyng::interpolator::transition_duration ( ) const
inline

Returns the total length of a transition between two states.

It is equal to the sum of durations of all phases.


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