45 template <
typename T2>
49 this->sourceOffset.template
cast<T2>(),
51 this->referenceOffset.template
cast<T2>(),
53 static_cast<T2
>(this->weight),
97 int& usedRows)
override;
112 const
Vector3<T>& sourceOffset,
113 size_t referenceJoint,
114 const
Vector3<T>& referenceOffset,
117 const std::
string& name = {});
126 [[nodiscard]]
const std::vector<JointToJointPositionDataT<T>>&
getConstraints()
const {
132 return constraints_.size();
136 std::vector<JointToJointPositionDataT<T>> constraints_;
JointToJointPositionErrorFunctionT(const Skeleton &skel, const ParameterTransform &pt)
void addConstraint(const JointToJointPositionDataT< T > &constraint)
Add a constraint using the JointToJointPositionDataT struct.
double getGradient(const ModelParametersT< T > ¶ms, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, Ref< VectorX< T > > gradient) override
void clearConstraints()
Clear all constraints.
void addConstraint(size_t sourceJoint, const Vector3< float > &sourceOffset, size_t referenceJoint, const Vector3< float > &referenceOffset, const Vector3< float > &target, float weight=float(1), const std::string &name={})
double getError(const ModelParametersT< T > ¶ms, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState) final
const std::vector< JointToJointPositionDataT< T > > & getConstraints() const
Get all constraints.
size_t getJacobianSize() const final
JointToJointPositionErrorFunctionT(const Character &character)
size_t getNumConstraints() const
Returns the number of constraints.
double getJacobian(const ModelParametersT< T > ¶ms, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, Ref< MatrixX< T > > jacobian, Ref< VectorX< T > > residual, int &usedRows) override
SkeletonErrorFunctionT(const Skeleton &skel, const ParameterTransform &pt)
SkeletonT< float > Skeleton
ParameterTransformT< float > ParameterTransform
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.
constexpr size_t kInvalidIndex
Sentinel value indicating an invalid or unset size_t index.
A character model with skeletal structure, mesh, and optional components.
Constraint data for joint-to-joint position error between two joints.
size_t referenceJoint
Index of the reference joint (the joint whose coordinate frame we use).
Vector3< T > referenceOffset
Offset from referenceJoint in the local coordinate system of referenceJoint.
JointToJointPositionDataT< T2 > cast() const
size_t sourceJoint
Index of the source joint (the joint whose position we want to constrain).
std::string name
Name of the constraint (for debugging).
Vector3< T > target
Target position in the reference joint's coordinate frame.
T weight
Weight for this constraint.
Vector3< T > sourceOffset
Offset from sourceJoint in the local coordinate system of sourceJoint.
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.