56 Eigen::Vector3<T>
target = Eigen::Vector3<T>::Zero();
134 Eigen::Ref<Eigen::VectorX<T>> gradient)
override;
140 Eigen::Ref<Eigen::MatrixX<T>> jacobian,
141 Eigen::Ref<Eigen::VectorX<T>> residual,
142 int& usedRows)
override;
size_t getJacobianSize() const final
CenterOfMassErrorFunctionT(const Skeleton &skeleton, const ParameterTransform ¶meterTransform)
Constructs the error function.
void addConstraint(const ConstraintType &constraint)
double getJacobian(const ModelParametersT< T > ¶ms, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, Eigen::Ref< Eigen::MatrixX< T > > jacobian, Eigen::Ref< Eigen::VectorX< T > > residual, int &usedRows) override
double getError(const ModelParametersT< T > ¶ms, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState) final
const std::vector< ConstraintType > & getConstraints() const
size_t getNumConstraints() const
void setConstraints(std::span< const ConstraintType > constraints)
CenterOfMassConstraintT< T > ConstraintType
~CenterOfMassErrorFunctionT() override=default
double getGradient(const ModelParametersT< T > ¶ms, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, Eigen::Ref< Eigen::VectorX< T > > gradient) override
Shared utility for derivative computation in error functions.
SkeletonErrorFunctionT(const Skeleton &skel, const ParameterTransform &pt)
SkeletonT< float > Skeleton
ParameterTransformT< float > ParameterTransform
gsl::span< T > span
Span type alias using gsl::span (C++17 fallback).
Constraint data for a center of mass target.
T totalMass() const
Returns the total mass (sum of all masses).
T weight
Weight of this constraint.
bool projectToPlane
If true, project the computed center of mass to projectionNormal dot x - projectionD = 0 before compa...
Eigen::Vector3< T > target
Target position for the center of mass.
T projectionD
Offset for the optional projection plane in the equation normal dot x - d = 0.
std::vector< Eigen::Vector3< T > > offsets
Optional local center-of-mass offsets for each joint.
std::vector< T > masses
Mass values for each joint (must match jointIndices size).
std::vector< size_t > jointIndices
Indices of joints contributing to this CoM constraint.
Eigen::Vector3< T > projectionNormal
Normal for the optional projection plane.
std::string name
Optional name for debugging.
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.