Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
momentum::PointTriangleVertexErrorFunctionT< T > Class Template Reference

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>

Inheritance diagram for momentum::PointTriangleVertexErrorFunctionT< T >:

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 > &parameters, 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}

Detailed Description

template<typename T>
class momentum::PointTriangleVertexErrorFunctionT< T >

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.

Constructor & Destructor Documentation

◆ PointTriangleVertexErrorFunctionT() [1/3]

◆ ~PointTriangleVertexErrorFunctionT()

template<typename T>
momentum::PointTriangleVertexErrorFunctionT< T >::~PointTriangleVertexErrorFunctionT ( )
overridedefault

◆ PointTriangleVertexErrorFunctionT() [2/3]

template<typename T>
momentum::PointTriangleVertexErrorFunctionT< T >::PointTriangleVertexErrorFunctionT ( const PointTriangleVertexErrorFunctionT< T > & )
default

◆ PointTriangleVertexErrorFunctionT() [3/3]

template<typename T>
momentum::PointTriangleVertexErrorFunctionT< T >::PointTriangleVertexErrorFunctionT ( PointTriangleVertexErrorFunctionT< T > && )
defaultnoexcept

Member Function Documentation

◆ addConstraint()

template<typename T>
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.

◆ clearConstraints()

template<typename T>
void momentum::PointTriangleVertexErrorFunctionT< T >::clearConstraints ( )

Definition at line 54 of file point_triangle_vertex_error_function.cpp.

◆ getCharacter()

template<typename T>
const Character * momentum::PointTriangleVertexErrorFunctionT< T >::getCharacter ( ) const
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.

◆ getConstraints()

template<typename T>
const std::vector< PointTriangleVertexConstraintT< T > > & momentum::PointTriangleVertexErrorFunctionT< T >::getConstraints ( ) const
inlinenodiscard

Definition at line 86 of file point_triangle_vertex_error_function.h.

◆ getError()

◆ getGradient()

template<typename T>
double momentum::PointTriangleVertexErrorFunctionT< T >::getGradient ( const ModelParametersT< T > & modelParameters,
const SkeletonStateT< T > & state,
const MeshStateT< T > & meshState,
Eigen::Ref< Eigen::VectorX< T > > gradient )
finalvirtual

◆ getJacobian()

template<typename T>
double momentum::PointTriangleVertexErrorFunctionT< T >::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 )
finalvirtual

◆ getJacobianSize()

template<typename T>
size_t momentum::PointTriangleVertexErrorFunctionT< T >::getJacobianSize ( ) const
nodiscardfinalvirtual

◆ getNumVertices()

template<typename T>
size_t momentum::PointTriangleVertexErrorFunctionT< T >::getNumVertices ( ) const
nodiscard

Definition at line 46 of file point_triangle_vertex_error_function.cpp.

◆ needsMesh()

template<typename T>
bool momentum::PointTriangleVertexErrorFunctionT< T >::needsMesh ( ) const
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.

◆ operator=() [1/2]

◆ operator=() [2/2]

Member Data Documentation

◆ kPlaneWeight

template<typename T>
T momentum::PointTriangleVertexErrorFunctionT< T >::kPlaneWeight = PlaneErrorFunctionT<T>::kLegacyWeight
staticconstexpr

Definition at line 91 of file point_triangle_vertex_error_function.h.

Referenced by getError().

◆ kPositionWeight

template<typename T>
T momentum::PointTriangleVertexErrorFunctionT< T >::kPositionWeight = PositionErrorFunctionT<T>::kLegacyWeight
staticconstexpr

Definition at line 90 of file point_triangle_vertex_error_function.h.

Referenced by getError().


The documentation for this class was generated from the following files: