31 jointParameters.
size(),
50 bool hasScaleParametersInMotion =
false;
51 for (Eigen::Index iFrame = 0; iFrame < motion.cols() && !hasScaleParametersInMotion; ++iFrame) {
53 if (scalingParams.test(iParam) && motion(iParam, iFrame) != 0) {
54 hasScaleParametersInMotion =
true;
62 if (jointIdentity.
size() > 0 && !jointIdentity.
v.isZero()) {
63 if (hasScaleParametersInMotion) {
64 MT_LOGW(
"Motion already contains scale parameters, not adding joint identity parameters.");
66 const auto scalingTransform = parameterTransform.
simplify(scalingParams);
71 static_cast<Eigen::Index
>(parameterTransform.
name.size()) ==
73 "Parameter name count ({}) does not match model parameter count ({})",
74 parameterTransform.
name.size(),
77 if (scalingParams.test(iParam)) {
79 static_cast<size_t>(iParam) >= parameterTransform.
name.size(),
80 "Parameter index {} exceeds parameter name count {}",
82 parameterTransform.
name.size());
84 scalingTransform.getParameterIdByName(parameterTransform.
name[iParam]);
86 subsetParamIdx >=
static_cast<size_t>(scaleParametersSubset.
size()),
87 "Subset parameter index {} exceeds scaleParametersSubset size {}",
89 scaleParametersSubset.
size());
90 modelIdentity[iParam] = scaleParametersSubset(subsetParamIdx);
93 if (!hasScaleParametersInMotion) {
94 for (Eigen::Index jFrame = 0; jFrame < motion.cols(); ++jFrame) {
95 motion(iParam, jFrame) += scaleParametersSubset(subsetParamIdx);
102 return modelIdentity;
#define MT_CHECK(condition,...)
Runtime check macros with two interchangeable backends:
#define MT_THROW_IF(Condition,...)
Conditionally throws a std::runtime_error with a formatted message if the condition is true.
ModelParameters applyModelParameterScales(const ParameterTransform ¶meterTransform, MatrixXf &motion, const JointParameters &jointIdentity)
Apply model parameter scale conversion to motion data.
ParameterTransformT< float > ParameterTransform
MatrixX< T > pseudoInverse(const MatrixX< T > &mat)
Calculates the pseudo-inverse of a matrix.
Eigen::Matrix< T, Dynamic, Dynamic > MatrixX
Dynamic-size, column-major dense matrix.
JointParametersT< float > JointParameters
InverseParameterTransformT< float > InverseParameterTransform
ModelParametersT< float > ModelParameters
MatrixX< float > MatrixXf
A struct that encapsulates both pose and identity parameters for a character.
JointParametersT< T > offsets
The joint parameter vector representing the unique bone lengths of the character, defining the charac...
ModelParametersT< T > pose
The model parameter vector representing the pose of the character.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE auto size() const
static EIGEN_DEVICE_FUNC Derived< Scalar > Zero(::Eigen::Index size)
A vector describing joint parameters, of size numSkeletonJoints * kParametersPerJoint.