MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ catmull_rom_spline()

MAYAFLUX_API Eigen::VectorXd MayaFlux::Kinesis::catmull_rom_spline ( const Eigen::MatrixXd &  control_points,
double  t,
double  tension = 0.5 
)

Catmull-Rom spline interpolation using Eigen matrices.

Parameters
control_points4xN matrix where columns are control points (p0, p1, p2, p3)
tParameter in [0,1]
tensionTension parameter (default 0.5)
Returns
Interpolated point as Nx1 vector

Definition at line 282 of file MotionCurves.cpp.

286{
287 if (control_points.cols() != 4) {
288 error<std::invalid_argument>(
289 Journal::Component::Kinesis,
290 Journal::Context::Runtime,
291 std::source_location::current(),
292 "Catmull-Rom interpolation requires 4 control points, but got {}",
293 control_points.cols());
294 }
295
296 Eigen::Matrix4d basis_matrix = BasisMatrices::catmull_rom_with_tension(tension);
297 Eigen::Vector4d t_vector(t * t * t, t * t, t, 1.0);
298 Eigen::Vector4d coeffs = basis_matrix * t_vector;
299
300 return control_points * coeffs;
301}

References MayaFlux::Kinesis::BasisMatrices::catmull_rom_with_tension(), MayaFlux::Journal::Kinesis, and MayaFlux::Journal::Runtime.

Referenced by interpolate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: