30 template <
typename T2>
34 static_cast<T2
>(this->weight),
35 this->targetPosition.template
cast<T2>()};
78 Eigen::Ref<Eigen::VectorX<T>> gradient)
final;
92 Eigen::Ref<Eigen::MatrixX<T>> jacobian,
93 Eigen::Ref<Eigen::VectorX<T>> residual,
126 [[nodiscard]]
int getSkinnedLocatorParameterIndex(
int locatorIndex)
const {
135 void calculateDWorldPos(
136 const SkeletonStateT<T>& state,
137 const SkinnedLocatorConstraintT<T>& constr,
138 const Eigen::Vector3<T>& d_restPos,
139 Eigen::Vector3<T>& d_worldPos)
const;
140 double calculatePositionJacobian(
141 const ModelParametersT<T>& modelParameters,
142 const SkeletonStateT<T>& state,
143 const SkinnedLocatorConstraintT<T>& constr,
144 Ref<Eigen::MatrixX<T>> jac,
145 Ref<Eigen::VectorX<T>> res)
const;
147 double calculatePositionGradient(
148 const ModelParametersT<T>& modelParameters,
149 const SkeletonStateT<T>& state,
150 const SkinnedLocatorConstraintT<T>& constr,
151 Eigen::Ref<Eigen::VectorX<T>> gradient)
const;
154 Eigen::Vector3<T> calculateSkinnedLocatorPosition(
155 const SkeletonStateT<T>& state,
157 const Eigen::Vector3<T>& locatorRestPos)
const;
158 Eigen::Vector3<T> getLocatorRestPosition(
const ModelParametersT<T>& modelParams,
int locatorIndex)
161 const Character& character_;
163 std::vector<SkinnedLocatorConstraintT<T>> constraints_;
SkeletonErrorFunctionT(const Skeleton &skel, const ParameterTransform &pt)
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.
SkinnedLocatorErrorFunctionT(const SkinnedLocatorErrorFunctionT< T > &other)=delete
SkinnedLocatorErrorFunctionT< T > & operator=(SkinnedLocatorErrorFunctionT< T > &&other)=delete
SkinnedLocatorErrorFunctionT(SkinnedLocatorErrorFunctionT< T > &&other)=delete
size_t getJacobianSize() const final
Returns the number of rows needed for the Jacobian matrix.
double getError(const ModelParametersT< T > &modelParameters, const SkeletonStateT< T > &state, const MeshStateT< T > &) final
Computes the total error for all skinned locator constraints.
SkinnedLocatorErrorFunctionT< T > & operator=(const SkinnedLocatorErrorFunctionT< T > &other)=delete
~SkinnedLocatorErrorFunctionT() override
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.
void setConstraints(const std::vector< SkinnedLocatorConstraintT< float > > &constraints)
SkinnedLocatorErrorFunctionT(const Character &character_in)
Constructs a skinned locator error function for the given character.
void addConstraint(int locatorIndex, float weight, const Eigen::Vector3< float > &targetPosition)
const Character * getCharacter() const override
Returns the character associated with this error function.
const std::vector< SkinnedLocatorConstraintT< float > > & getConstraints() const
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.
Constraint structure for skinned locator error function.
Eigen::Vector3< float > targetPosition
SkinnedLocatorConstraintT< T2 > cast() const