NWengine 0.9
Loading...
Searching...
No Matches
Interpolator Class Reference

The Interpolator class represents a generic interpolator. More...

#include <Interpolation.h>

Inheritance diagram for Interpolator:
Serialized BezierInterpolator

Public Member Functions

 Interpolator (float source, float target, float duration)
 Constructs an Interpolator object with the given source, target, and duration.
 
 Interpolator ()=default
 Default constructor for the Interpolator class.
 
virtual float Evaluate (float clock)
 Evaluates the interpolation at the given clock value.
 
int Serialize (std::fstream *data, int offset) override
 Serializes the Interpolator object to a file stream.
 
int Deserialize (std::fstream *data, int offset) override
 Deserializes the Interpolator object from a file stream.
 
- Public Member Functions inherited from Serialized
 Serialized ()
 Default constructor for Serialized class.
 

Public Attributes

struct { 
 
   float   source 
 
   float   target 
 
   float   currentValue 
 
};  
 
float duration = 0.0f
 

Detailed Description

The Interpolator class represents a generic interpolator.

Constructor & Destructor Documentation

◆ Interpolator()

Interpolator::Interpolator ( float source,
float target,
float duration )

Constructs an Interpolator object with the given source, target, and duration.

Parameters
sourceThe source value of the interpolation.
targetThe target value of the interpolation.
durationThe duration of the interpolation in seconds.

Member Function Documentation

◆ Deserialize()

int Interpolator::Deserialize ( std::fstream * data,
int offset )
overridevirtual

Deserializes the Interpolator object from a file stream.

Parameters
dataThe file stream to deserialize from.
offsetThe offset in the file stream to start deserializing from.
Returns
The number of bytes read from the file stream.

Reimplemented from Serialized.

◆ Evaluate()

float Interpolator::Evaluate ( float clock)
virtual

Evaluates the interpolation at the given clock value.

Parameters
clockThe clock value between 0 and 1.
Returns
The interpolated value at the given clock value.

Reimplemented in BezierInterpolator.

◆ Serialize()

int Interpolator::Serialize ( std::fstream * data,
int offset )
overridevirtual

Serializes the Interpolator object to a file stream.

Parameters
dataThe file stream to serialize to.
offsetThe offset in the file stream to start serializing from.
Returns
The number of bytes written to the file stream.

Reimplemented from Serialized.

Member Data Documentation

◆ currentValue

float Interpolator::currentValue

The current value of the interpolation.

◆ duration

float Interpolator::duration = 0.0f

The duration of the interpolation in seconds.

◆ source

float Interpolator::source

The source value of the interpolation.

◆ target

float Interpolator::target

The target value of the interpolation.


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