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

◆ interpolate_nddata()

MAYAFLUX_API 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 946 of file MotionCurves.cpp.

951{
952 Eigen::MatrixXd control_matrix = Kakshya::to_eigen_matrix(control_points);
953
954 Eigen::MatrixXd interpolated = generate_interpolated_points(
955 control_matrix, num_samples, mode, tension);
956
957 Kakshya::EigenAccess input_access(control_points);
958
959 if (input_access.is_complex()) {
960 return Kakshya::from_eigen_matrix(interpolated, Kakshya::MatrixInterpretation::COMPLEX);
961 }
962
963 if (input_access.is_structured()) {
964 switch (input_access.component_count()) {
965 case 2:
966 return Kakshya::from_eigen_matrix(interpolated, Kakshya::MatrixInterpretation::VEC2);
967 case 3:
968 return Kakshya::from_eigen_matrix(interpolated, Kakshya::MatrixInterpretation::VEC3);
969 case 4:
970 return Kakshya::from_eigen_matrix(interpolated, Kakshya::MatrixInterpretation::VEC4);
971 default:
972 return Kakshya::from_eigen_matrix(interpolated, Kakshya::MatrixInterpretation::SCALAR);
973 }
974 } else {
975 return Kakshya::from_eigen_matrix(interpolated, Kakshya::MatrixInterpretation::SCALAR);
976 }
977}
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(), interpolate_nddata(), 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.

Referenced by interpolate_nddata().

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