45 template <
typename T2>
51 result.
depth =
static_cast<T2
>(this->depth);
52 result.
weight =
static_cast<T2
>(this->weight);
86 Eigen::Ref<Eigen::VectorX<T>> gradient)
final;
92 Eigen::Ref<Eigen::MatrixX<T>> jacobian,
93 Eigen::Ref<Eigen::VectorX<T>> residual,
122 [[nodiscard]]
int getSkinnedLocatorParameterIndex(
int locatorIndex)
const {
130 double calculatePositionJacobian(
131 const ModelParametersT<T>& modelParameters,
132 const MeshStateT<T>& meshState,
133 const SkinnedLocatorTriangleConstraintT<T>& constr,
134 Ref<Eigen::MatrixX<T>> jac,
135 Ref<Eigen::VectorX<T>> res)
const;
137 double calculatePlaneJacobian(
138 const ModelParametersT<T>& modelParameters,
139 const MeshStateT<T>& meshState,
140 const SkinnedLocatorTriangleConstraintT<T>& constr,
141 Ref<Eigen::MatrixX<T>> jac,
144 double calculatePositionGradient(
145 const ModelParametersT<T>& modelParameters,
146 const MeshStateT<T>& meshState,
147 const SkinnedLocatorTriangleConstraintT<T>& constr,
148 Eigen::Ref<Eigen::VectorX<T>> gradient)
const;
150 double calculatePlaneGradient(
151 const ModelParametersT<T>& modelParameters,
152 const MeshStateT<T>& meshState,
153 const SkinnedLocatorTriangleConstraintT<T>& constr,
154 Eigen::Ref<Eigen::VectorX<T>> gradient)
const;
156 Eigen::Vector3<T> getLocatorRestPosition(
const ModelParametersT<T>& modelParams,
int locatorIndex)
159 const Character& character_;
161 std::vector<SkinnedLocatorTriangleConstraintT<T>> constraints_;
SkeletonErrorFunctionT(const Skeleton &skel, const ParameterTransform &pt)
SkinnedLocatorTriangleErrorFunctionT & operator=(const SkinnedLocatorTriangleErrorFunctionT &)=delete
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
double getError(const ModelParametersT< T > &modelParameters, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState) final
~SkinnedLocatorTriangleErrorFunctionT() override
const Character * getCharacter() const override
For mesh-based error functions, get access to the underlying character.
SkinnedLocatorTriangleErrorFunctionT(const SkinnedLocatorTriangleErrorFunctionT &other)=delete
SkinnedLocatorTriangleErrorFunctionT & operator=(SkinnedLocatorTriangleErrorFunctionT &&)=delete
SkinnedLocatorTriangleErrorFunctionT(SkinnedLocatorTriangleErrorFunctionT &&)=delete
size_t getJacobianSize() const final
void addConstraint(int locatorIndex, const Eigen::Vector3i &triangleIndices, const Eigen::Vector3< float > &triangleBaryCoords, float depth=0, float weight=1)
bool needsMesh() const override
Override to indicate this function requires mesh state.
SkinnedLocatorTriangleErrorFunctionT(const Character &character, VertexConstraintType type=VertexConstraintType::Position)
void setConstraints(const std::vector< SkinnedLocatorTriangleConstraintT< float > > &constraints)
const std::vector< SkinnedLocatorTriangleConstraintT< float > > & getConstraints() const
Shared types used across error function hierarchies.
Vector3< std::int32_t > Vector3i
VertexConstraintType
Type of vertex constraint mode.
Represents a candidate triangle for sliding constraints.
size_t triangleIdx
Index into mesh.faces.
Eigen::Vector3i vertexIndices
The 3 vertex indices (cached from mesh.faces).
A character model with skeletal structure, mesh, and optional components.
ParameterTransform parameterTransform
Maps model parameters to joint parameters.
Represents the complete state of a model's mesh.
A vector of size numModelParams holding the values of all model parameters for a character.
Represents the complete state of a skeleton.
Eigen::Vector3< float > tgtTriangleBaryCoords
std::vector< CandidateTriangle > candidateTriangles
SkinnedLocatorTriangleConstraintT< T2 > cast() const
Eigen::Vector3i tgtTriangleIndices