47 std::vector<size_t> vertexIndices,
48 T targetHeight = T(0),
49 const Eigen::Vector3<T>& upDirection = Eigen::Vector3<T>::UnitY(),
67 Eigen::Ref<Eigen::VectorX<T>> gradient)
final;
73 Eigen::Ref<Eigen::MatrixX<T>> jacobian,
74 Eigen::Ref<Eigen::VectorX<T>> residual,
102 return vertexIndices_;
117 struct MinHeightResult {
119 std::vector<size_t> vertexIndices;
120 std::vector<T> vertexWeights;
124 [[nodiscard]] MinHeightResult calculateMinHeight(
const MeshStateT<T>& meshState)
const;
127 template <
typename Derived>
128 void calculateVertexJacobian(
130 const SkeletonStateT<T>& state,
131 const MeshStateT<T>& meshState,
132 const Eigen::Vector3<T>& jacobianDirection,
133 Eigen::MatrixBase<Derived>& jacobian)
const;
136 void calculateVertexGradient(
138 const SkeletonStateT<T>& state,
139 const MeshStateT<T>& meshState,
140 const Eigen::Vector3<T>& gradientDirection,
141 Eigen::Ref<Eigen::VectorX<T>> gradient)
const;
143 const Character& character_;
145 std::vector<size_t> vertexIndices_;
147 Eigen::Vector3<T> upDirection_;
const Character * getCharacter() const override
Get the character.
bool needsMesh() const override
This function requires the solver to provide a posed mesh.
float getTargetHeight() const
FloorErrorFunctionT(const Character &character, std::vector< size_t > vertexIndices, T targetHeight=T(0), const Eigen::Vector3< T > &upDirection=Eigen::Vector3< T >::UnitY(), size_t k=5)
Construct a floor error function.
const std::vector< size_t > & getVertexIndices() const
Get the candidate vertex indices.
size_t getJacobianSize() const 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
FloorErrorFunctionT(FloorErrorFunctionT &&other) noexcept=delete
void setTargetHeight(float height)
FloorErrorFunctionT(const FloorErrorFunctionT &other)=delete
void setUpDirection(const Eigen::Vector3< T > &upDirection)
Set the up direction for height measurement.
FloorErrorFunctionT & operator=(FloorErrorFunctionT &&other)=delete
void setVertexIndices(std::vector< size_t > indices)
Set the candidate vertex indices.
double getGradient(const ModelParametersT< T > &modelParameters, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, Eigen::Ref< Eigen::VectorX< T > > gradient) final
~FloorErrorFunctionT() override
double getError(const ModelParametersT< T > &modelParameters, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState) final
FloorErrorFunctionT & operator=(const FloorErrorFunctionT &other)=delete
const Eigen::Vector3< T > & getUpDirection() const
Get the up direction.
SkeletonErrorFunctionT(const Skeleton &skel, const ParameterTransform &pt)
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.
Represents the complete state of a skeleton.