Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
momentum::SkeletonStateT< T > Struct Template Reference

Represents the complete state of a skeleton. More...

#include <skeleton_state.h>

Public Member Functions

 SkeletonStateT () noexcept=default
 Creates an empty skeleton state.
 SkeletonStateT (const JointParametersT< T > &parameters, const Skeleton &referenceSkeleton, bool computeDeriv=true)
 Creates a skeleton state from joint parameters and a reference skeleton.
 SkeletonStateT (JointParametersT< T > &&parameters, const Skeleton &referenceSkeleton, bool computeDeriv=true)
 Creates a skeleton state from rvalue joint parameters and a reference skeleton.
template<typename T2>
 SkeletonStateT (const SkeletonStateT< T2 > &rhs)
 Creates a skeleton state from another skeleton state with a different scalar type.
void set (const JointParametersT< T > &jointParameters, const Skeleton &referenceSkeleton, bool computeDeriv=true)
 Updates the skeleton state with new joint parameters.
void set (JointParametersT< T > &&jointParameters, const Skeleton &referenceSkeleton, bool computeDeriv=true)
 Updates the skeleton state with new rvalue joint parameters.
template<typename T2>
void set (const SkeletonStateT< T2 > &rhs)
 Updates the skeleton state from another skeleton state with a different scalar type.
TransformListT< T > toTransforms () const
 Extracts global transforms for all joints in the skeleton.
template<typename T2>
SkeletonStateT< T2 > cast () const
 Converts the skeleton state to a different scalar type.

Static Public Member Functions

static StateSimilarity compare (const SkeletonStateT< T > &state1, const SkeletonStateT< T > &state2)
 Compares two skeleton states and returns similarity metrics.

Public Attributes

JointParametersT< T > jointParameters
 Joint parameters for all joints in the skeleton.
JointStateListT< T > jointState
 Computed joint states for all joints in the skeleton.

Detailed Description

template<typename T>
struct momentum::SkeletonStateT< T >

Represents the complete state of a skeleton.

Stores joint parameters and computed joint states for an entire skeleton. Provides methods for updating the state based on new parameters and comparing different skeleton states.

Definition at line 45 of file skeleton_state.h.

Constructor & Destructor Documentation

◆ SkeletonStateT() [1/4]

template<typename T>
momentum::SkeletonStateT< T >::SkeletonStateT ( )
defaultnoexcept

Creates an empty skeleton state.

Referenced by compare(), set(), and SkeletonStateT().

◆ SkeletonStateT() [2/4]

template<typename T>
momentum::SkeletonStateT< T >::SkeletonStateT ( const JointParametersT< T > & parameters,
const Skeleton & referenceSkeleton,
bool computeDeriv = true )

Creates a skeleton state from joint parameters and a reference skeleton.

Parameters
parametersJoint parameters for all joints in the skeleton
referenceSkeletonThe skeleton structure defining joint hierarchy
computeDerivIf true, computes translationAxis and rotationAxis matrices needed for Jacobian computation in error functions. Set to false ONLY when the state is used for visualization, FK output inspection, or IO — never when the state will be passed to a solver or error function. Skipping derivatives saves ~30% of per-joint FK cost. When false, derivDirty is set to true and derivative accessors (getRotationDerivative, getTranslationDerivative, getScaleDerivative) return invalid results.

Definition at line 22 of file skeleton_state.cpp.

References jointParameters, jointState, and set().

◆ SkeletonStateT() [3/4]

template<typename T>
momentum::SkeletonStateT< T >::SkeletonStateT ( JointParametersT< T > && parameters,
const Skeleton & referenceSkeleton,
bool computeDeriv = true )

Creates a skeleton state from rvalue joint parameters and a reference skeleton.

Parameters
parametersJoint parameters for all joints in the skeleton (moved from)
referenceSkeletonThe skeleton structure defining joint hierarchy
computeDerivIf true, computes translationAxis and rotationAxis matrices needed for Jacobian computation in error functions. Set to false ONLY when the state is used for visualization, FK output inspection, or IO — never when the state will be passed to a solver or error function. Skipping derivatives saves ~30% of per-joint FK cost. When false, derivDirty is set to true and derivative accessors (getRotationDerivative, getTranslationDerivative, getScaleDerivative) return invalid results.

Definition at line 31 of file skeleton_state.cpp.

References jointParameters, jointState, and set().

◆ SkeletonStateT() [4/4]

template<typename T>
template<typename T2>
momentum::SkeletonStateT< T >::SkeletonStateT ( const SkeletonStateT< T2 > & rhs)
explicit

Creates a skeleton state from another skeleton state with a different scalar type.

Template Parameters
T2Source scalar type
Parameters
rhsSource skeleton state to copy from

Definition at line 41 of file skeleton_state.cpp.

References cast(), jointParameters, jointState, and SkeletonStateT().

Member Function Documentation

◆ cast()

template<typename T>
template<typename T2>
SkeletonStateT< T2 > momentum::SkeletonStateT< T >::cast ( ) const
inlinenodiscard

Converts the skeleton state to a different scalar type.

Template Parameters
T2Target scalar type
Returns
Skeleton state with the target scalar type

Definition at line 156 of file skeleton_state.h.

Referenced by SkeletonStateT().

◆ compare()

template<typename T>
StateSimilarity momentum::SkeletonStateT< T >::compare ( const SkeletonStateT< T > & state1,
const SkeletonStateT< T > & state2 )
staticnodiscard

Compares two skeleton states and returns similarity metrics.

Parameters
state1First skeleton state to compare
state2Second skeleton state to compare
Returns
Similarity metrics between the two states

Definition at line 134 of file skeleton_state.cpp.

References momentum::dot(), jointParameters, jointState, MT_CHECK, momentum::StateSimilarity::orientationError, momentum::StateSimilarity::orientationMax, momentum::StateSimilarity::orientationRMSE, momentum::StateSimilarity::positionError, momentum::StateSimilarity::positionMax, momentum::StateSimilarity::positionRMSE, and SkeletonStateT().

◆ set() [1/3]

template<typename T>
void momentum::SkeletonStateT< T >::set ( const JointParametersT< T > & jointParameters,
const Skeleton & referenceSkeleton,
bool computeDeriv = true )

Updates the skeleton state with new joint parameters.

Parameters
jointParametersNew joint parameters for all joints
referenceSkeletonThe skeleton structure defining joint hierarchy
computeDerivIf true, computes translationAxis and rotationAxis matrices needed for Jacobian computation in error functions. Set to false ONLY when the state is used for visualization, FK output inspection, or IO — never when the state will be passed to a solver or error function. Skipping derivatives saves ~30% of per-joint FK cost. When false, derivDirty is set to true and derivative accessors (getRotationDerivative, getTranslationDerivative, getScaleDerivative) return invalid results.

Definition at line 65 of file skeleton_state.cpp.

References jointParameters, momentum::SkeletonT< T >::joints, jointState, MT_PROFILE_FUNCTION, and set().

Referenced by momentum::SkeletonStateT< float >::cast(), momentum::computeFloorContactConstraints(), momentum::SequenceSolverFunctionT< T >::getGradient(), momentum::getLocatorError(), momentum::sampleFrames(), set(), set(), SkeletonStateT(), and SkeletonStateT().

◆ set() [2/3]

template<typename T>
template<typename T2>
void momentum::SkeletonStateT< T >::set ( const SkeletonStateT< T2 > & rhs)

Updates the skeleton state from another skeleton state with a different scalar type.

Template Parameters
T2Source scalar type
Parameters
rhsSource skeleton state to copy from

Definition at line 48 of file skeleton_state.cpp.

References momentum::cast(), jointParameters, jointState, MT_PROFILE_FUNCTION, and SkeletonStateT().

◆ set() [3/3]

template<typename T>
void momentum::SkeletonStateT< T >::set ( JointParametersT< T > && jointParameters,
const Skeleton & referenceSkeleton,
bool computeDeriv = true )

Updates the skeleton state with new rvalue joint parameters.

Parameters
jointParametersNew joint parameters for all joints (moved from)
referenceSkeletonThe skeleton structure defining joint hierarchy
computeDerivIf true, computes translationAxis and rotationAxis matrices needed for Jacobian computation in error functions. Set to false ONLY when the state is used for visualization, FK output inspection, or IO — never when the state will be passed to a solver or error function. Skipping derivatives saves ~30% of per-joint FK cost. When false, derivDirty is set to true and derivative accessors (getRotationDerivative, getTranslationDerivative, getScaleDerivative) return invalid results.

Definition at line 76 of file skeleton_state.cpp.

References jointParameters, momentum::SkeletonT< T >::joints, jointState, MT_PROFILE_FUNCTION, and set().

◆ toTransforms()

template<typename T>
TransformListT< T > momentum::SkeletonStateT< T >::toTransforms ( ) const
nodiscard

Extracts global transforms for all joints in the skeleton.

Returns
List of global transforms for all joints

Definition at line 124 of file skeleton_state.cpp.

References jointState.

Referenced by momentum::StateErrorFunctionT< T >::setTargetState().

Member Data Documentation

◆ jointParameters

◆ jointState

template<typename T>
JointStateListT<T> momentum::SkeletonStateT< T >::jointState

Computed joint states for all joints in the skeleton.

Definition at line 50 of file skeleton_state.h.

Referenced by momentum::accumulateChainDerivatives(), momentum::detail_sdf_collision::accumulateColliderHierarchyGradient(), momentum::detail_sdf_collision::accumulateColliderHierarchyJacobian(), momentum::SkeletonDerivativeT< T >::accumulateVertexGradient(), momentum::SkeletonDerivativeT< T >::accumulateVertexGradientIdentityDfdv(), momentum::SkeletonDerivativeT< T >::accumulateVertexGradientWithNormalCorrection(), momentum::SkeletonDerivativeT< T >::accumulateVertexGradientWithNormalCorrectionDirect(), momentum::SkeletonDerivativeT< T >::accumulateVertexJacobian(), momentum::SkeletonDerivativeT< T >::accumulateVertexJacobianIdentityDfdv(), momentum::SkeletonDerivativeT< T >::accumulateVertexJacobianWithNormalCorrection(), momentum::SkeletonDerivativeT< T >::accumulateVertexJacobianWithNormalCorrectionDirect(), momentum::SkeletonDerivativeT< T >::accumulateVertexNormalBlendShapeGradient(), momentum::SkeletonDerivativeT< T >::accumulateVertexNormalBlendShapeJacobian(), momentum::SkeletonDerivativeT< T >::accumulateVertexNormalCorrectionGradient(), momentum::SkeletonDerivativeT< T >::accumulateVertexNormalCorrectionJacobian(), momentum::applyInverseSSD(), momentum::applySSD(), momentum::applySSD(), momentum::calculateDWorldPos(), compare(), momentum::PoseShape::compute(), momentum::detail_sdf_collision::computeColliderWorldBoundingBox(), momentum::computeFloorContactConstraints(), momentum::detail_sdf_collision::computeWorldToColliderTransform(), momentum::FullyDifferentiableProjectionErrorFunctionT< T >::constraintGradient_dot(), momentum::extractLocatorsFromCharacter(), momentum::extractMarkersFromMotion(), momentum::CameraProjectionErrorFunctionT< T >::getError(), momentum::CameraVertexProjectionErrorFunctionT< T >::getError(), momentum::CenterOfMassErrorFunctionT< T >::getError(), momentum::CollisionErrorFunctionStatelessT< T >::getError(), momentum::CollisionErrorFunctionT< T >::getError(), momentum::DistanceErrorFunctionT< T >::getError(), momentum::FullyDifferentiableOrientationErrorFunctionT< T >::getError(), momentum::JointErrorFunctionT< T, Data, FuncDim, NumVec, NumPos >::getError(), momentum::JointErrorFunctionT< T, AimDataT< T >, 3, 2, 1 >::getError(), momentum::JointToJointDistanceErrorFunctionT< T >::getError(), momentum::JointToJointOrientationErrorFunctionT< T >::getError(), momentum::JointToJointPositionErrorFunctionT< T >::getError(), momentum::PlaneCollisionErrorFunctionT< T >::getError(), momentum::ProjectionErrorFunctionT< T >::getError(), momentum::StateErrorFunctionT< T >::getError(), momentum::CameraProjectionErrorFunctionT< T >::getGradient(), momentum::CameraVertexProjectionErrorFunctionT< T >::getGradient(), momentum::CenterOfMassErrorFunctionT< T >::getGradient(), momentum::CollisionErrorFunctionStatelessT< T >::getGradient(), momentum::CollisionErrorFunctionT< T >::getGradient(), momentum::DistanceErrorFunctionT< T >::getGradient(), momentum::JointToJointDistanceErrorFunctionT< T >::getGradient(), momentum::JointToJointOrientationErrorFunctionT< T >::getGradient(), momentum::JointToJointPositionErrorFunctionT< T >::getGradient(), momentum::PlaneCollisionErrorFunctionT< T >::getGradient(), momentum::ProjectionErrorFunctionT< T >::getGradient(), momentum::SDFCollisionErrorFunctionT< T, SdfColliderType >::getGradient(), momentum::StateErrorFunctionT< T >::getGradient(), momentum::VertexSDFErrorFunctionT< T >::getGradient(), momentum::getInverseSSDTransformation(), momentum::CameraProjectionErrorFunctionT< T >::getJacobian(), momentum::CameraVertexProjectionErrorFunctionT< T >::getJacobian(), momentum::CenterOfMassErrorFunctionT< T >::getJacobian(), momentum::CollisionErrorFunctionStatelessT< T >::getJacobian(), momentum::CollisionErrorFunctionT< T >::getJacobian(), momentum::DistanceErrorFunctionT< T >::getJacobian(), momentum::JointErrorFunctionT< T, Data, FuncDim, NumVec, NumPos >::getJacobian(), momentum::JointToJointDistanceErrorFunctionT< T >::getJacobian(), momentum::JointToJointOrientationErrorFunctionT< T >::getJacobian(), momentum::JointToJointPositionErrorFunctionT< T >::getJacobian(), momentum::PlaneCollisionErrorFunctionT< T >::getJacobian(), momentum::ProjectionErrorFunctionT< T >::getJacobian(), momentum::SDFCollisionErrorFunctionT< T, SdfColliderType >::getJacobian(), momentum::StateErrorFunctionT< T >::getJacobian(), momentum::VelocityMagnitudeSequenceErrorFunctionT< T >::getJacobian(), momentum::VertexSDFErrorFunctionT< T >::getJacobian(), momentum::getLocatorError(), momentum::getSkinnedLocatorPosition(), momentum::Character::initInverseBindPose(), momentum::JointErrorFunctionT< T, AimDataT< T >, 3, 2, 1 >::JointErrorFunctionT(), momentum::loadLocatorsFromBuffer(), momentum::locatorsToSkinnedLocators(), momentum::logCharacter(), momentum::logCollisionGeometry(), momentum::detail::makeCollisionBoxLogData(), momentum::detail::makeCollisionEllipsoidLogData(), momentum::Character::remapLocators(), momentum::Character::remapParameterLimits(), momentum::sampleFrames(), set(), set(), set(), momentum::StateErrorFunctionT< T >::setTargetState(), SkeletonStateT(), SkeletonStateT(), SkeletonStateT(), momentum::skeletonStateToJointParameters(), momentum::skeletonStateToJointParametersRespectingActiveParameters(), momentum::skinnedLocatorsToLocators(), momentum::SkinningWeightIteratorT< T >::SkinningWeightIteratorT(), momentum::SkinningWeightIteratorT< T >::SkinningWeightIteratorT(), momentum::skinWithBlendShapes(), toTransforms(), momentum::transformAtoB(), momentum::PlaneCollisionQueryT< T >::update(), momentum::PositionConstraintStateT< T >::update(), and momentum::CollisionGeometryStateT< T >::updatePrimitive().


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