Infinity Engine v0.6.20
C++ API Documentation
Loading...
Searching...
No Matches
Infinity::Types::Spatial::Spline4D Class Reference

Four-dimensional spline curve for extended parameter space interpolation. More...

#include <Spline.hpp>

Inheritance diagram for Infinity::Types::Spatial::Spline4D:
[legend]
Collaboration diagram for Infinity::Types::Spatial::Spline4D:
[legend]

Public Types

using Vec = Math::Vector4
 

Public Member Functions

 Spline4D ()
 Default constructor.
 
 Spline4D (SplineKind kind)
 Constructs a spline with specified interpolation type.
 
 Spline4D (const Spline4D &other)
 Copy constructor.
 
 ~Spline4D ()
 Destructor.
 
Spline4Doperator= (const Spline4D &other)
 Copy assignment operator.
 
Vec evaluate (float t) const
 Evaluates the spline position at parameter t.
 
Vec tangent (float t) const
 Computes the tangent vector at parameter t.
 
void setCurveKind (SplineKind kind)
 Changes the spline interpolation type.
 
SplineKind type () const
 Gets the current spline interpolation type.
 
const Infinity::Types::TypeIDtypeId () const override
 Gets the TypeID for Spline4D.
 
- Public Member Functions inherited from Infinity::Types::Core::Data
 Data ()
 
 Data (const Data &other)
 
 Data (Data &&other)
 
Dataoperator= (const Data &other)
 
Dataoperator= (Data &&other)
 
std::unique_ptr< Baseclone () const override
 
virtual ~Data ()
 Virtual destructor.
 
bool hasProperty (const std::string &key) const
 
template<typename T >
void setProperty (const std::string &key, T &&value)
 Sets a typed property value.
 
template<typename T >
void setProperty (const std::string &key, const T &value)
 Sets a typed property value.
 
void setProperty (const std::string &key, PropertyValue &&value)
 Sets a typed property value.
 
const PropertyValuegetProperty (const std::string &key) const
 Gets a property value without type checking.
 
template<typename T >
const T & getProperty (const std::string &key) const
 Gets a typed property value.
 
void removeProperty (const std::string &key)
 
- Public Member Functions inherited from Infinity::Types::Core::Base
virtual ~Base ()
 Virtual destructor.
 
virtual std::istream & legibleDataRead (std::istream &in) override
 Deserializes the object from a single-line text representation.
 
virtual std::ostream & legibleDataWrite (std::ostream &out) const override
 Serializes the object to a single-line text representation.
 

Public Attributes

Containers::Array< Vecpoints
 Control points defining the spline curve.
 
- Public Attributes inherited from Infinity::Types::Core::Data
std::unordered_map< std::string, PropertyValueproperties
 Property storage for arbitrary metadata.
 

Detailed Description

Four-dimensional spline curve for extended parameter space interpolation.

Spline4D provides smooth curve interpolation through 4D control points using various mathematical methods (Bezier, Catmull-Rom, B-Spline, or Linear). While less common than 2D/3D splines, it is useful for:

  • Color animation paths (RGBA over time)
  • Quaternion interpolation paths (when represented as 4-vectors)
  • Combined spatial + parameter curves (position + intensity/temperature/etc.)
  • Homogeneous coordinate paths
  • Multi-parameter procedural animation

The spline can be evaluated at any parametric position t ∈ [0, 1] to obtain interpolated 4D positions and tangent vectors.

Note
The parameter t is normalized: 0 = start of curve, 1 = end of curve.
Tangent vectors are not normalized.
For quaternion interpolation, consider using dedicated slerp/squad methods instead.

Example usage:

// Create a color animation path (RGBA)
Spline4D colorPath(SplineKind::CatmullRom);
colorPath.points.push_back(Vector4{1.0f, 0.0f, 0.0f, 1.0f}); // Red
colorPath.points.push_back(Vector4{1.0f, 1.0f, 0.0f, 1.0f}); // Yellow
colorPath.points.push_back(Vector4{0.0f, 1.0f, 0.0f, 1.0f}); // Green
colorPath.points.push_back(Vector4{0.0f, 0.0f, 1.0f, 1.0f}); // Blue
// Evaluate color at different times
Vector4 color = colorPath.evaluate(0.5f);
// Use with ProceduralSystem
system->setIn("color_gradient", std::move(colorPath));
Four-dimensional spline curve for extended parameter space interpolation.
Definition Spline.hpp:417

Member Typedef Documentation

◆ Vec

Constructor & Destructor Documentation

◆ Spline4D() [1/3]

Infinity::Types::Spatial::Spline4D::Spline4D ( )

Default constructor.

Creates an empty spline with Bezier interpolation.

◆ Spline4D() [2/3]

Infinity::Types::Spatial::Spline4D::Spline4D ( SplineKind  kind)
explicit

Constructs a spline with specified interpolation type.

Parameters
kindInterpolation method to use (Bezier, CatmullRom, BSpline, or Linear).

◆ Spline4D() [3/3]

Infinity::Types::Spatial::Spline4D::Spline4D ( const Spline4D other)

Copy constructor.

Creates a deep copy of the spline, including all control points and settings.

Parameters
otherSpline to copy from.

◆ ~Spline4D()

Infinity::Types::Spatial::Spline4D::~Spline4D ( )

Destructor.

Member Function Documentation

◆ evaluate()

Vec Infinity::Types::Spatial::Spline4D::evaluate ( float  t) const

Evaluates the spline position at parameter t.

Computes the interpolated 4D position on the curve.

Parameters
tParameter value in range [0, 1].
Returns
Interpolated 4D position on the curve.

◆ operator=()

Spline4D & Infinity::Types::Spatial::Spline4D::operator= ( const Spline4D other)

Copy assignment operator.

Parameters
otherSpline to copy from.
Returns
Reference to this spline.

◆ setCurveKind()

void Infinity::Types::Spatial::Spline4D::setCurveKind ( SplineKind  kind)

Changes the spline interpolation type.

Parameters
kindNew interpolation method to use.

◆ tangent()

Vec Infinity::Types::Spatial::Spline4D::tangent ( float  t) const

Computes the tangent vector at parameter t.

Calculates the 4D derivative of the curve.

Parameters
tParameter value in range [0, 1].
Returns
4D tangent vector at the specified position.
Note
The tangent vector is NOT normalized.

◆ type()

SplineKind Infinity::Types::Spatial::Spline4D::type ( ) const

Gets the current spline interpolation type.

Returns
Current SplineKind being used for interpolation.

◆ typeId()

const Infinity::Types::TypeID & Infinity::Types::Spatial::Spline4D::typeId ( ) const
overridevirtual

Gets the TypeID for Spline4D.

Returns
TypeID identifying this Spline4D type.

Reimplemented from Infinity::Types::Core::Data.

Member Data Documentation

◆ points

Containers::Array<Vec> Infinity::Types::Spatial::Spline4D::points

Control points defining the spline curve.

Public array of Vector4 control points that define the curve shape. Modify this array directly to change the spline geometry.