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

The BezierInterpolator class represents a Bezier curve interpolator. More...

#include <Interpolation.h>

Inheritance diagram for BezierInterpolator:
Interpolator Serialized

Public Member Functions

 BezierInterpolator (float source, float target, float duration)
 Constructs a BezierInterpolator object with the given source, target, and duration.
 
 BezierInterpolator ()
 Default constructor for the BezierInterpolator class.
 
void Linearize ()
 Linearizes the Bezier curve by subdividing it into linear segments.
 
float Evaluate (float clock) override
 Evaluates the interpolation at the given clock value using the Bezier curve.
 
int Serialize (std::fstream *data, int offset) override
 Serialize the object and write it to the file.
 
int Deserialize (std::fstream *data, int offset) override
 Deserialize the object from the file.
 
- Public Member Functions inherited from Interpolator
 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.
 
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

fVec2 controlPoints [2]
 
- Public Attributes inherited from Interpolator
struct { 
 
   float   source 
 
   float   target 
 
   float   currentValue 
 
};  
 
float duration = 0.0f
 

Detailed Description

The BezierInterpolator class represents a Bezier curve interpolator.

Constructor & Destructor Documentation

◆ BezierInterpolator()

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

Constructs a BezierInterpolator 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 BezierInterpolator::Deserialize ( std::fstream * data,
int offset )
overridevirtual

Deserialize the object from the file.

Parameters
dataThe file stream to read the serialized data from.
offsetThe offset in the file to start reading the serialized data.
Returns
The number of bytes read from the file, or -1 if an error occurred.

Reimplemented from Serialized.

◆ Evaluate()

float BezierInterpolator::Evaluate ( float clock)
overridevirtual

Evaluates the interpolation at the given clock value using the Bezier curve.

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

Reimplemented from Interpolator.

◆ Serialize()

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

Serialize the object and write it to the file.

Parameters
dataThe file stream to write the serialized data to.
offsetThe offset in the file to start writing the serialized data.
Returns
The number of bytes written to the file, or -1 if an error occurred.

Reimplemented from Serialized.

Member Data Documentation

◆ controlPoints

fVec2 BezierInterpolator::controlPoints[2]

The control points of the Bezier curve.


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