28 template <
typename T2>
32 this->tgtTriangleIndices,
33 this->tgtTriangleBaryCoords.template
cast<T2>(),
34 static_cast<T2
>(this->depth),
35 static_cast<T2
>(this->weight)};
104 double calculatePositionJacobian(
109 Ref<Eigen::MatrixX<T>> jac,
110 Ref<Eigen::VectorX<T>> res)
const;
112 double calculateNormalJacobian(
117 T sourceNormalWeight,
118 T targetNormalWeight,
119 Ref<Eigen::MatrixX<T>> jac,
122 double calculatePositionGradient(
127 Eigen::Ref<Eigen::VectorX<T>> gradient)
const;
129 double calculateNormalGradient(
134 T sourceNormalWeight,
135 T targetNormalWeight,
136 Eigen::Ref<Eigen::VectorX<T>> gradient)
const;
138 std::pair<T, T> computeNormalWeights()
const;
142 std::vector<PointTriangleVertexConstraintT<T>> constraints_;
static constexpr T kLegacyWeight
Default constant weight in MarkerErrorFunction.
PointTriangleVertexErrorFunctionT(const Character &character, VertexConstraintType type=VertexConstraintType::Position)
double getError(const ModelParametersT< float > &modelParameters, const SkeletonStateT< float > &state, const MeshStateT< float > &meshState) final
size_t getNumVertices() const
size_t getJacobianSize() const final
bool needsMesh() const override
Override to indicate this function requires mesh state.
const Character * getCharacter() const override
For mesh-based error functions, get access to the underlying character.
const std::vector< PointTriangleVertexConstraintT< float > > & getConstraints() const
static constexpr float kPlaneWeight
double getGradient(const ModelParametersT< float > &modelParameters, const SkeletonStateT< float > &state, const MeshStateT< float > &meshState, Eigen::Ref< Eigen::VectorX< float > > gradient) final
double getJacobian(const ModelParametersT< float > &modelParameters, const SkeletonStateT< float > &state, const MeshStateT< float > &meshState, Eigen::Ref< Eigen::MatrixX< float > > jacobian, Eigen::Ref< Eigen::VectorX< float > > residual, int &usedRows) final
PointTriangleVertexErrorFunctionT & operator=(const PointTriangleVertexErrorFunctionT &)=default
PointTriangleVertexErrorFunctionT(PointTriangleVertexErrorFunctionT &&) noexcept=default
PointTriangleVertexErrorFunctionT(const PointTriangleVertexErrorFunctionT &)=default
static constexpr float kPositionWeight
~PointTriangleVertexErrorFunctionT() override
void addConstraint(int vertexIndex, const Eigen::Vector3i &triangleIndices, const Eigen::Vector3< float > &triangleBaryCoords, float depth=0, float weight=1)
static constexpr T kLegacyWeight
Default constant weight in MarkerErrorFunction.
SkeletonErrorFunctionT(const Skeleton &skel, const ParameterTransform &pt)
Shared types used across error function hierarchies.
Eigen::Matrix< T, Dynamic, Dynamic > MatrixX
Dynamic-size, column-major dense matrix.
Vector< T, Dynamic > VectorX
Dynamic-size column vector. Common return type for solver residuals and parameter vectors.
Vector3< std::int32_t > Vector3i
VertexConstraintType
Type of vertex constraint mode.
A character model with skeletal structure, mesh, and optional components.
Represents the complete state of a model's mesh.
A vector of size numModelParams holding the values of all model parameters for a character.
Eigen::Vector3< float > tgtTriangleBaryCoords
PointTriangleVertexConstraintT< T2 > cast() const
Eigen::Vector3i tgtTriangleIndices
Represents the complete state of a skeleton.