|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Error function for skinned locator constraints. More...
#include <skinned_locator_error_function.h>
Public Member Functions | |
| SkinnedLocatorErrorFunctionT (const Character &character_in) | |
| Constructs a skinned locator error function for the given character. | |
| ~SkinnedLocatorErrorFunctionT () override | |
| SkinnedLocatorErrorFunctionT (const SkinnedLocatorErrorFunctionT< T > &other)=delete | |
| SkinnedLocatorErrorFunctionT< T > & | operator= (const SkinnedLocatorErrorFunctionT< T > &other)=delete |
| SkinnedLocatorErrorFunctionT (SkinnedLocatorErrorFunctionT< T > &&other)=delete | |
| SkinnedLocatorErrorFunctionT< T > & | operator= (SkinnedLocatorErrorFunctionT< T > &&other)=delete |
| double | getError (const ModelParametersT< T > &modelParameters, const SkeletonStateT< T > &state, const MeshStateT< T > &) final |
| Computes the total error for all skinned locator constraints. | |
| double | getGradient (const ModelParametersT< T > &modelParameters, const SkeletonStateT< T > &state, const MeshStateT< T > &, Eigen::Ref< Eigen::VectorX< T > > gradient) final |
| Computes the gradient of the error function with respect to model parameters. | |
| double | getJacobian (const ModelParametersT< T > &modelParameters, const SkeletonStateT< T > &state, const MeshStateT< T > &, Eigen::Ref< Eigen::MatrixX< T > > jacobian, Eigen::Ref< Eigen::VectorX< T > > residual, int &usedRows) final |
| Computes the Jacobian matrix and residual vector for the error function. | |
| size_t | getJacobianSize () const final |
| Returns the number of rows needed for the Jacobian matrix. | |
| void | addConstraint (int locatorIndex, T weight, const Eigen::Vector3< T > &targetPosition) |
| Adds a new skinned locator constraint. | |
| void | clearConstraints () |
| Removes all constraints. | |
| void | setConstraints (const std::vector< SkinnedLocatorConstraintT< T > > &constraints) |
| Sets all constraints at once, replacing any existing constraints. | |
| const std::vector< SkinnedLocatorConstraintT< T > > & | getConstraints () const |
| Returns the current list of constraints. | |
| const Character * | getCharacter () const override |
| Returns the character associated with this error function. | |
| 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) |
| virtual bool | needsMesh () const |
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 skinned locator constraints.
This error function computes the error between skinned locator positions and their target positions. Skinned locators are points that are deformed by the character's skeleton and can be used to constrain the character to specific world positions. The error is computed as the weighted squared distance between the current skinned locator position and the target position.
Definition at line 47 of file skinned_locator_error_function.h.
|
explicit |
Constructs a skinned locator error function for the given character.
Definition at line 26 of file skinned_locator_error_function.cpp.
References momentum::SkeletonErrorFunctionT< T >::SkeletonErrorFunctionT().
|
overridedefault |
|
delete |
|
delete |
| void momentum::SkinnedLocatorErrorFunctionT< T >::addConstraint | ( | int | locatorIndex, |
| T | weight, | ||
| const Eigen::Vector3< T > & | targetPosition ) |
Adds a new skinned locator constraint.
| locatorIndex | Index of the skinned locator in the character |
| weight | Weight for this constraint |
| targetPosition | Target position in world space |
Definition at line 39 of file skinned_locator_error_function.cpp.
References MT_CHECK.
| void momentum::SkinnedLocatorErrorFunctionT< T >::clearConstraints | ( | ) |
Removes all constraints.
Definition at line 34 of file skinned_locator_error_function.cpp.
|
inlinenodiscardoverridevirtual |
Returns the character associated with this error function.
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 120 of file skinned_locator_error_function.h.
|
inlinenodiscard |
Returns the current list of constraints.
Definition at line 115 of file skinned_locator_error_function.h.
|
nodiscardfinalvirtual |
Computes the total error for all skinned locator constraints.
| modelParameters | The current model parameters |
| state | The current skeleton state |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 85 of file skinned_locator_error_function.cpp.
References momentum::SkinnedLocatorConstraintT< T >::locatorIndex, MT_PROFILE_FUNCTION, momentum::SkinnedLocatorConstraintT< T >::targetPosition, momentum::SkinnedLocatorConstraintT< T >::weight, and momentum::SkeletonErrorFunctionT< T >::weight_.
|
finalvirtual |
Computes the gradient of the error function with respect to model parameters.
| modelParameters | The current model parameters |
| state | The current skeleton state |
| gradient | Output gradient vector to be filled |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 290 of file skinned_locator_error_function.cpp.
References momentum::SkeletonErrorFunctionT< T >::weight_.
|
finalvirtual |
Computes the Jacobian matrix and residual vector for the error function.
| modelParameters | The current model parameters |
| state | The current skeleton state |
| jacobian | Output Jacobian matrix to be filled |
| residual | Output residual vector to be filled |
| usedRows | Number of rows used in the Jacobian (output parameter) |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 306 of file skinned_locator_error_function.cpp.
References MT_CHECK, and momentum::EigenStrongType< Derived, EigenType >::size().
|
nodiscardfinalvirtual |
Returns the number of rows needed for the Jacobian matrix.
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 335 of file skinned_locator_error_function.cpp.
|
delete |
|
delete |
| void momentum::SkinnedLocatorErrorFunctionT< T >::setConstraints | ( | const std::vector< SkinnedLocatorConstraintT< T > > & | constraints | ) |
Sets all constraints at once, replacing any existing constraints.
| constraints | Vector of constraints to set |
Definition at line 48 of file skinned_locator_error_function.cpp.