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

◆ interpolate_nddata()

Kakshya::DataVariant MayaFlux::Kinesis::interpolate_nddata ( const Kakshya::DataVariant control_points,
Eigen::Index  num_samples,
InterpolationMode  mode,
double  tension = 0.5 
)

Process DataVariant through interpolation.

Parameters
control_pointsInput data as control points
num_samplesNumber of output samples
modeInterpolation mode
tensionTension parameter
Returns
Interpolated data

Definition at line 458 of file MotionCurves.cpp.

463{
464 Eigen::MatrixXd control_matrix = Kakshya::to_eigen_matrix(control_points);
465
466 Eigen::MatrixXd interpolated = generate_interpolated_points(
467 control_matrix, num_samples, mode, tension);
468
469 Kakshya::EigenAccess input_access(control_points);
470
471 if (input_access.is_complex()) {
472 return Kakshya::from_eigen_matrix(interpolated, Kakshya::MatrixInterpretation::COMPLEX);
473 }
474
475 if (input_access.is_structured()) {
476 switch (input_access.component_count()) {
477 case 2:
478 return Kakshya::from_eigen_matrix(interpolated, Kakshya::MatrixInterpretation::VEC2);
479 case 3:
480 return Kakshya::from_eigen_matrix(interpolated, Kakshya::MatrixInterpretation::VEC3);
481 case 4:
482 return Kakshya::from_eigen_matrix(interpolated, Kakshya::MatrixInterpretation::VEC4);
483 default:
484 return Kakshya::from_eigen_matrix(interpolated, Kakshya::MatrixInterpretation::SCALAR);
485 }
486 } else {
487 return Kakshya::from_eigen_matrix(interpolated, Kakshya::MatrixInterpretation::SCALAR);
488 }
489}
Type-erased accessor for converting DataVariant to Eigen types.
Eigen::MatrixXd generate_interpolated_points(const Eigen::MatrixXd &control_points, Eigen::Index num_samples, InterpolationMode mode, double tension)
Generate interpolated points from control points.

References MayaFlux::Kakshya::COMPLEX, MayaFlux::Kakshya::EigenAccess::component_count(), MayaFlux::Kakshya::from_eigen_matrix(), generate_interpolated_points(), MayaFlux::Kakshya::EigenAccess::is_complex(), MayaFlux::Kakshya::EigenAccess::is_structured(), MayaFlux::Kakshya::SCALAR, MayaFlux::Kakshya::to_eigen_matrix(), MayaFlux::Kakshya::VEC2, MayaFlux::Kakshya::VEC3, and MayaFlux::Kakshya::VEC4.

+ Here is the call graph for this function: