|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Support constraining different parts of the mesh together by specifying that a source vertex should target a location on the mesh defined by a target triangle and its normal. More...
#include <point_triangle_vertex_error_function.h>
Public Member Functions | |
| PointTriangleVertexErrorFunctionT (const Character &character, VertexConstraintType type=VertexConstraintType::Position) | |
| ~PointTriangleVertexErrorFunctionT () override | |
| PointTriangleVertexErrorFunctionT (const PointTriangleVertexErrorFunctionT &)=default | |
| PointTriangleVertexErrorFunctionT & | operator= (const PointTriangleVertexErrorFunctionT &)=default |
| PointTriangleVertexErrorFunctionT (PointTriangleVertexErrorFunctionT &&) noexcept=default | |
| PointTriangleVertexErrorFunctionT & | operator= (PointTriangleVertexErrorFunctionT &&) noexcept=default |
| 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 | addConstraint (int vertexIndex, const Eigen::Vector3i &triangleIndices, const Eigen::Vector3< T > &triangleBaryCoords, float depth=0, T weight=1) |
| void | clearConstraints () |
| const std::vector< PointTriangleVertexConstraintT< T > > & | getConstraints () const |
| size_t | getNumVertices () const |
| const Character * | getCharacter () const override |
| For mesh-based error functions, get access to the underlying character. | |
| bool | needsMesh () const override |
| Override to indicate this function requires mesh state. | |
| 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) |
Static Public Attributes | |
| static constexpr T | kPositionWeight = PositionErrorFunctionT<T>::kLegacyWeight |
| static constexpr T | kPlaneWeight = PlaneErrorFunctionT<T>::kLegacyWeight |
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} |
Support constraining different parts of the mesh together by specifying that a source vertex should target a location on the mesh defined by a target triangle and its normal.
The target point is specified as sum_i (bary_i * target_triangle_vertex_i) + depth * target_triangle_normal. Note that this constraint applies "forces" both to the source vertex and every vertex in the target triangle, so it will actually try to pull both toward each other.
Definition at line 45 of file point_triangle_vertex_error_function.h.
|
explicit |
Definition at line 31 of file point_triangle_vertex_error_function.cpp.
References momentum::Character::faceExpressionBlendShape, momentum::Character::mesh, MT_CHECK, MT_THROW_IF, momentum::Position, momentum::SkeletonErrorFunctionT< T >::SkeletonErrorFunctionT(), momentum::Character::skinWeights, and momentum::toString().
|
overridedefault |
|
default |
|
defaultnoexcept |
| void momentum::PointTriangleVertexErrorFunctionT< T >::addConstraint | ( | int | vertexIndex, |
| const Eigen::Vector3i & | triangleIndices, | ||
| const Eigen::Vector3< T > & | triangleBaryCoords, | ||
| float | depth = 0, | ||
| T | weight = 1 ) |
Definition at line 59 of file point_triangle_vertex_error_function.cpp.
References MT_CHECK.
| void momentum::PointTriangleVertexErrorFunctionT< T >::clearConstraints | ( | ) |
Definition at line 54 of file point_triangle_vertex_error_function.cpp.
|
inlinenodiscardoverridevirtual |
For mesh-based error functions, get access to the underlying character.
Error functions that depend only on the skeleton can return nullptr.
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 94 of file point_triangle_vertex_error_function.h.
|
inlinenodiscard |
Definition at line 86 of file point_triangle_vertex_error_function.h.
|
nodiscardfinalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 97 of file point_triangle_vertex_error_function.cpp.
References momentum::computeTargetBaryPosition(), momentum::computeTargetPosition(), momentum::computeTargetTriangleNormal(), momentum::PointTriangleVertexConstraintT< T >::depth, kPlaneWeight, kPositionWeight, MT_CHECK_NOTNULL, MT_PROFILE_FUNCTION, momentum::normal(), momentum::MeshStateT< T >::posedMesh_, momentum::Position, momentum::PointTriangleVertexConstraintT< T >::srcVertexIndex, momentum::PointTriangleVertexConstraintT< T >::weight, and momentum::SkeletonErrorFunctionT< T >::weight_.
|
finalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 641 of file point_triangle_vertex_error_function.cpp.
References MT_CHECK_NOTNULL, momentum::MeshStateT< T >::posedMesh_, and momentum::Position.
|
finalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 676 of file point_triangle_vertex_error_function.cpp.
References MT_CHECK, MT_CHECK_NOTNULL, MT_PROFILE_EVENT, momentum::MeshStateT< T >::posedMesh_, momentum::Position, and momentum::EigenStrongType< Derived, EigenType >::size().
|
nodiscardfinalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 730 of file point_triangle_vertex_error_function.cpp.
References momentum::Normal, momentum::Plane, momentum::Position, and momentum::SymmetricNormal.
|
nodiscard |
Definition at line 46 of file point_triangle_vertex_error_function.cpp.
|
inlinenodiscardoverridevirtual |
Override to indicate this function requires mesh state.
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 99 of file point_triangle_vertex_error_function.h.
|
default |
|
defaultnoexcept |
|
staticconstexpr |
Definition at line 91 of file point_triangle_vertex_error_function.h.
Referenced by getError().
|
staticconstexpr |
Definition at line 90 of file point_triangle_vertex_error_function.h.
Referenced by getError().