sandbox
Loading...
Searching...
No Matches
sbx::animations::spline< Type > Class Template Reference

Time-ordered spline for interpolated animation values. More...

#include <spline.hpp>

Public Member Functions

auto add (const std::float_t timestamp, const Type &value) -> void
 Add a keyframe to the spline. More...
 
auto sample (const std::float_t time) const -> Type
 Sample the spline at a given time. More...
 
auto size () const noexcept -> std::size_t
 Retrieve the number of keyframes stored. More...
 

Detailed Description

template<typename Type>
class sbx::animations::spline< Type >

Time-ordered spline for interpolated animation values.

Template Parameters
TypeValue type stored in the spline.

The spline class maintains a sequence of keyframes, each consisting of a timestamp and a corresponding value. Values can be sampled continuously over time using interpolation defined in the implementation.

This class does not enforce a specific interpolation strategy at the interface level; instead, behavior is specialized in the accompanying implementation file.

Typical use cases include animation curves for transforms, scalar parameters, and orientation data.

Member Function Documentation

◆ add()

template<typename Type >
auto sbx::animations::spline< Type >::add ( const std::float_t  timestamp,
const Type &  value 
) -> void

Add a keyframe to the spline.

Inserts a new keyframe into the spline. Implementations are expected to maintain ordering of timestamps and associated values.

Parameters
timestampTime position of the keyframe.
valueValue associated with the timestamp.

◆ sample()

template<typename Type >
auto sbx::animations::spline< Type >::sample ( const std::float_t  time) const -> Type

Sample the spline at a given time.

Returns a value interpolated between surrounding keyframes based on the provided time. Behavior when sampling outside the range of stored timestamps is implementation-defined.

Parameters
timeTime value to sample.
Returns
Interpolated value at the given time.

◆ size()

template<typename Type >
auto sbx::animations::spline< Type >::size
noexcept

Retrieve the number of keyframes stored.

Returns
Number of timestamped values in the spline.

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