Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
momentum::PoseShape Struct Reference

Computes shape deformations based on joint rotations. More...

#include <pose_shape.h>

Public Member Functions

std::vector< Vector3f > compute (const SkeletonState &state) const
 Computes the deformed shape vertices for the given skeleton pose.
bool isApprox (const PoseShape &poseShape) const
 Returns true if all members are approximately equal (uses Eigen::isApprox for floating-point members and exact equality for baseJoint/jointMap).

Public Attributes

size_t baseJoint
 Index of the joint used as reference for computing relative rotations.
Quaternionf baseRot
 Base rotation used as reference for computing rotation differences.
std::vector< size_t > jointMap
 Indices of joints whose rotations drive the shape deformation.
VectorXf baseShape
 Base shape vertices stored as a flat vector [x1,y1,z1,x2,y2,z2,...].
MatrixXf shapeVectors
 Shape deformation vectors for each quaternion component of each joint.

Detailed Description

Computes shape deformations based on joint rotations.

PoseShape implements a linear blend shape system where shape deformations are driven by joint rotations. This is useful for modeling effects like muscle bulging or skin sliding that occur during animation.

Definition at line 20 of file pose_shape.h.

Member Function Documentation

◆ compute()

std::vector< Vector3f > momentum::PoseShape::compute ( const SkeletonState & state) const
nodiscard

Computes the deformed shape vertices for the given skeleton pose.

Returns
Flattened 3D vertex positions, length baseShape.size() / 3.
Exceptions
IfbaseShape.size() != shapeVectors.rows().

Definition at line 15 of file pose_shape.cpp.

References baseJoint, baseRot, baseShape, jointMap, momentum::SkeletonStateT< T >::jointState, MT_CHECK, and shapeVectors.

◆ isApprox()

bool momentum::PoseShape::isApprox ( const PoseShape & poseShape) const
inlinenodiscard

Returns true if all members are approximately equal (uses Eigen::isApprox for floating-point members and exact equality for baseJoint/jointMap).

Definition at line 51 of file pose_shape.h.

References baseJoint, baseRot, baseShape, jointMap, and shapeVectors.

Member Data Documentation

◆ baseJoint

size_t momentum::PoseShape::baseJoint

Index of the joint used as reference for computing relative rotations.

Definition at line 22 of file pose_shape.h.

Referenced by compute(), isApprox(), and momentum::loadPoseShape().

◆ baseRot

Quaternionf momentum::PoseShape::baseRot

Base rotation used as reference for computing rotation differences.

The effective rotation used for deformation is baseRot * joint.rotation().inverse()

Definition at line 27 of file pose_shape.h.

Referenced by compute(), isApprox(), and momentum::loadPoseShape().

◆ baseShape

VectorXf momentum::PoseShape::baseShape

Base shape vertices stored as a flat vector [x1,y1,z1,x2,y2,z2,...].

The size must be a multiple of 3 (3 coordinates per vertex).

Definition at line 35 of file pose_shape.h.

Referenced by compute(), isApprox(), and momentum::loadPoseShape().

◆ jointMap

std::vector<size_t> momentum::PoseShape::jointMap

Indices of joints whose rotations drive the shape deformation.

Definition at line 30 of file pose_shape.h.

Referenced by compute(), isApprox(), and momentum::loadPoseShape().

◆ shapeVectors

MatrixXf momentum::PoseShape::shapeVectors

Shape deformation vectors for each quaternion component of each joint.

Matrix dimensions are [baseShape.size() × (jointMap.size() * 4)]. Each column corresponds to a quaternion component (x,y,z,w) of a joint.

Definition at line 41 of file pose_shape.h.

Referenced by compute(), isApprox(), and momentum::loadPoseShape().


The documentation for this struct was generated from the following files: