Bifrost SDK
Bifrost SDK documentation
Bifrost::Math::FCurve Class Reference

FCurve User Class. More...

#include <FCurve.h>

Classes

struct  ControlPoints
 Struct for previous, current, and next point for a curve. More...
 
class  SegmentPoint
 Struct for one point. More...
 

Public Types

enum class  SpanInterpolationMethod : uint8_t { Constant , Linear , Curve }
 
enum class  CurveInterpolationMethod : uint8_t {
  Bezier , Hermite , Sine , Parabolic ,
  TangentLog
}
 
enum class  ExtrapolationMode {
  Constant , Linear , Cycle , RelativeRepeat ,
  Oscillate
}
 
using FCurvePoints = Amino::Array< SegmentPoint >
 

Public Member Functions

 FCurve (bool createDefaultValue=true)
 Constructor. More...
 
 ~FCurve ()
 Destructor. More...
 
 FCurve (FCurve const &other)
 Copy constructor. More...
 
bool defaultValue ()
 Reset to a default FCurve. More...
 
FCurvePoints const & getPoints () const
 Get the points of the FCurve. More...
 
ExtrapolationMode getPreExtrapolation () const
 Get the pre-extrapolation mode. More...
 
ExtrapolationMode getPostExtrapolation () const
 Get the post-extrapolation mode. More...
 
int numPoints () const
 Number of points in the FCurve. More...
 
double evalFCurve (double x) const
 Evaluate the FCurve at the given x value. More...
 
void setPoints (FCurvePoints points)
 Set the array of segment points. More...
 
void setExtrapolationModes (ExtrapolationMode preExtrapolation, ExtrapolationMode postExtrapolation)
 Set the extrapolation modes of the regions before the first and after the last point. More...
 

Static Public Member Functions

static double evaluateCurveSegment (CurveInterpolationMethod interpolation, double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3, double x)
 Support function to evaluate a cubic curve segment. More...
 
static double evalBezier (double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3, double x)
 Short-hand for evaluateCurveSegment with Bezier interpolation. More...
 

Friends

class Amino::FCurveSerializer
 FCurve Serializer friend. More...
 

Detailed Description

FCurve User Class.

Definition at line 45 of file FCurve.h.

Member Typedef Documentation

◆ FCurvePoints

Member Enumeration Documentation

◆ CurveInterpolationMethod

Defines interpolation function within curve segments for non-rotation curves

Enumerator
Bezier 

Bezier.

Hermite 

Hermite.

Sine 

Sine.

Parabolic 

Parabolic.

TangentLog 

Log.

Definition at line 62 of file FCurve.h.

◆ ExtrapolationMode

Curve extrapolation mode supported for pre/post extrapolation Note: this enum values are use to do serialization/deserialization

Enumerator
Constant 

Flat line.

Linear 

Continue the linear trend in linear interpolation.

Cycle 

Cycle the curve. (abc -> abc abc abc...)

RelativeRepeat 

Offsets the value of the first point to the value of the last point each cycle.

Oscillate 

Mirror the curve on X, and then cycle the mirrored the result. (abc -> abc cba abc cba...)

Definition at line 72 of file FCurve.h.

◆ SpanInterpolationMethod

Defines span interpolation method determined by the tangents of boundary keys

Enumerator
Constant 

Constant.

Linear 

Linear.

Curve 

Bezier/Hermite/...

Definition at line 54 of file FCurve.h.

Constructor & Destructor Documentation

◆ FCurve() [1/2]

Bifrost::Math::FCurve::FCurve ( bool  createDefaultValue = true)
explicit

Constructor.

param [in] createDefaultValue True will create a default curve y=x; numPoints() > 0. False will evaluate as y=x; numPoints() == 0.

◆ ~FCurve()

Bifrost::Math::FCurve::~FCurve ( )

Destructor.

◆ FCurve() [2/2]

Bifrost::Math::FCurve::FCurve ( FCurve const &  other)

Copy constructor.

Parameters
otherThe FCurve to copy

Member Function Documentation

◆ defaultValue()

bool Bifrost::Math::FCurve::defaultValue ( )

Reset to a default FCurve.

The default FCurve is y=x.

Returns
True if reset is successful, else false.

◆ evalBezier()

static double Bifrost::Math::FCurve::evalBezier ( double  x0,
double  y0,
double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
double  x 
)
inlinestatic

Short-hand for evaluateCurveSegment with Bezier interpolation.

Definition at line 227 of file FCurve.h.

◆ evalFCurve()

double Bifrost::Math::FCurve::evalFCurve ( double  x) const

Evaluate the FCurve at the given x value.

Parameters
[in]xThe x value at which the FCurve will be evaluated
Returns
The value of the FCurve at x.

◆ evaluateCurveSegment()

static double Bifrost::Math::FCurve::evaluateCurveSegment ( CurveInterpolationMethod  interpolation,
double  x0,
double  y0,
double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
double  x 
)
static

Support function to evaluate a cubic curve segment.

Parameters
interpolationThe desired curve interpolation method
x0The x coordinate of 0th control point
y0The y coordinate of 0th control point
x1The x coordinate of 1st control point
y1The y coordinate of 1st control point
x2The x coordinate of 2nd control point
y2The y coordinate of 2nd control point
x3The x coordinate of 3rd control point
y3The y coordinate of 3rd control point
xThe x coordinate at which to evaluate the curve segment
Returns
The value of the curve at x, given the 4 control points

◆ getPoints()

FCurvePoints const & Bifrost::Math::FCurve::getPoints ( ) const
inline

Get the points of the FCurve.

Definition at line 243 of file FCurve.h.

◆ getPostExtrapolation()

ExtrapolationMode Bifrost::Math::FCurve::getPostExtrapolation ( ) const
inline

Get the post-extrapolation mode.

Definition at line 249 of file FCurve.h.

◆ getPreExtrapolation()

ExtrapolationMode Bifrost::Math::FCurve::getPreExtrapolation ( ) const
inline

Get the pre-extrapolation mode.

Definition at line 246 of file FCurve.h.

◆ numPoints()

int Bifrost::Math::FCurve::numPoints ( ) const

Number of points in the FCurve.

Returns
The number of points in this FCurve

◆ setExtrapolationModes()

void Bifrost::Math::FCurve::setExtrapolationModes ( ExtrapolationMode  preExtrapolation,
ExtrapolationMode  postExtrapolation 
)
inline

Set the extrapolation modes of the regions before the first and after the last point.

Definition at line 270 of file FCurve.h.

◆ setPoints()

void Bifrost::Math::FCurve::setPoints ( FCurvePoints  points)
inline

Set the array of segment points.

Definition at line 266 of file FCurve.h.

Friends And Related Function Documentation

◆ Amino::FCurveSerializer

friend class Amino::FCurveSerializer
friend

FCurve Serializer friend.

Definition at line 47 of file FCurve.h.