|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Error function for character height constraints. More...
#include <height_error_function.h>
Public Member Functions | |
| HeightErrorFunctionT (const Character &character, T targetHeight, const Eigen::Vector3< T > &upDirection=Eigen::Vector3< T >::UnitY(), size_t k=1) | |
| Construct a height error function. | |
| ~HeightErrorFunctionT () override | |
| HeightErrorFunctionT (const HeightErrorFunctionT &other)=delete | |
| HeightErrorFunctionT (HeightErrorFunctionT &&other) noexcept=delete | |
| HeightErrorFunctionT & | operator= (const HeightErrorFunctionT &other)=delete |
| HeightErrorFunctionT & | operator= (HeightErrorFunctionT &&other)=delete |
| double | getError (const ModelParametersT< T > &modelParameters, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState) final |
| double | getGradient (const ModelParametersT< T > &modelParameters, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, Eigen::Ref< Eigen::VectorX< T > > gradient) final |
| double | getJacobian (const ModelParametersT< T > &modelParameters, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, Eigen::Ref< Eigen::MatrixX< T > > jacobian, Eigen::Ref< Eigen::VectorX< T > > residual, int &usedRows) final |
| size_t | getJacobianSize () const final |
| void | setTargetHeight (T height) |
| Set the target height. | |
| T | getTargetHeight () const |
| Get the target height. | |
| void | setUpDirection (const Eigen::Vector3< T > &upDirection) |
| Set the up direction for height measurement. | |
| const Eigen::Vector3< T > & | getUpDirection () const |
| Get the up direction. | |
| const Character * | getCharacter () const override |
| Get the character. | |
| bool | needsMesh () const override |
| Override to indicate this function does NOT require mesh state (we maintain our own meshes). | |
| Public Member Functions inherited from momentum::SkeletonErrorFunctionT< T > | |
| SkeletonErrorFunctionT (const Skeleton &skel, const ParameterTransform &pt) | |
| virtual | ~SkeletonErrorFunctionT ()=default |
| const Skeleton & | getSkeleton () const |
| const ParameterTransform & | getParameterTransform () const |
| void | setWeight (T w) |
| T | getWeight () const |
| void | setActiveJoints (const VectorX< bool > &aj) |
| void | setEnabledParameters (const ParameterSet &ps) |
| virtual void | getHessian (const ModelParametersT< T > &, const SkeletonStateT< T > &, const MeshStateT< T > &, Eigen::Ref< Eigen::MatrixX< T > >) |
| virtual double | getSolverDerivatives (const ModelParametersT< T > ¶meters, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, const size_t actualParameters, Eigen::MatrixX< T > &hess, Eigen::VectorX< T > &grad) |
Additional Inherited Members | |
| Protected Attributes inherited from momentum::SkeletonErrorFunctionT< T > | |
| const Skeleton & | skeleton_ |
| const ParameterTransform & | parameterTransform_ |
| T | weight_ |
| VectorX< bool > | activeJointParams_ |
| ParameterSet | enabledParameters_ |
| bool | useHessian_ {false} |
Error function for character height constraints.
This error function measures the height of a character mesh by projecting all vertices onto a specified "up" direction and computing the difference between the maximum and minimum projections.
IMPORTANT: Unlike most error functions, this one only depends on specific active parameters that are automatically determined in the constructor. Specifically, it uses blend shape, face expression, and scale parameters only (not pose parameters). The error function achieves this by zeroing out all inactive parameters before computing the skeleton and mesh state. This allows us to constrain height independent of pose, e.g. the solver doesn't try to fix height by having the character bend over.
Definition at line 36 of file height_error_function.h.
|
explicit |
Construct a height error function.
| character | The character to measure height for |
| targetHeight | The target height for the character (required) |
| upDirection | The direction to measure height along (defaults to Y-axis) |
| k | Number of vertices to average for min/max height calculation (defaults to 1) |
This error function automatically uses blend shape, face expression, and scale parameters only. All other parameters (pose, etc.) are kept inactive.
Definition at line 70 of file height_error_function.cpp.
References momentum::ParameterTransformT< T >::getBlendShapeParameters(), momentum::ParameterTransformT< T >::getFaceExpressionParameters(), momentum::ParameterTransformT< T >::getScalingParameters(), momentum::Character::mesh, MT_CHECK, momentum::Character::parameterTransform, and momentum::SkeletonErrorFunctionT< T >::SkeletonErrorFunctionT().
|
overridedefault |
|
delete |
|
deletenoexcept |
|
inlinenodiscardoverridevirtual |
Get the character.
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 98 of file height_error_function.h.
|
nodiscardfinalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 200 of file height_error_function.cpp.
References momentum::cast(), MT_PROFILE_FUNCTION, momentum::SkeletonErrorFunctionT< T >::parameterTransform_, and momentum::SkeletonErrorFunctionT< T >::weight_.
|
finalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 223 of file height_error_function.cpp.
References momentum::cast(), MT_PROFILE_FUNCTION, momentum::SkeletonErrorFunctionT< T >::parameterTransform_, and momentum::SkeletonErrorFunctionT< T >::weight_.
|
finalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 265 of file height_error_function.cpp.
References momentum::cast(), MT_CHECK, MT_PROFILE_FUNCTION, momentum::SkeletonErrorFunctionT< T >::parameterTransform_, and momentum::SkeletonErrorFunctionT< T >::weight_.
|
nodiscardfinalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 319 of file height_error_function.cpp.
|
inlinenodiscard |
Get the target height.
Definition at line 84 of file height_error_function.h.
|
inlinenodiscard |
Get the up direction.
Definition at line 93 of file height_error_function.h.
|
inlinenodiscardoverridevirtual |
Override to indicate this function does NOT require mesh state (we maintain our own meshes).
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 104 of file height_error_function.h.
|
delete |
|
delete |
| void momentum::HeightErrorFunctionT< T >::setTargetHeight | ( | T | height | ) |
Set the target height.
| height | The desired height |
Definition at line 95 of file height_error_function.cpp.
| void momentum::HeightErrorFunctionT< T >::setUpDirection | ( | const Eigen::Vector3< T > & | upDirection | ) |
Set the up direction for height measurement.
| upDirection | The direction to measure height along (will be normalized) |
Definition at line 100 of file height_error_function.cpp.