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

The skeletal structure of a momentum Character. More...

#include <skeleton.h>

Public Member Functions

 SkeletonT ()=default
 SkeletonT (JointList joints)
 SkeletonT (const SkeletonT &other)=default
 SkeletonT (SkeletonT &&other) noexcept=default
SkeletonT & operator= (const SkeletonT &other)=default
SkeletonT & operator= (SkeletonT &&other) noexcept=default
 ~SkeletonT ()=default
size_t getJointIdByName (std::string_view name) const
 Returns the index of a joint with the given name, or kInvalidIndex if not found.
std::vector< std::string > getJointNames () const
std::vector< size_t > getChildrenJoints (size_t jointId, bool recursive=true) const
 Returns indices of child joints of the specified joint.
bool isAncestor (size_t jointId, size_t ancestorJointId) const
 Returns true if ancestorJointId is an ancestor of jointId.
bool isSameOrAdjacentJoints (size_t joint1, size_t joint2) const
 Returns true if the two joints are the same, or one is the direct parent of the other.
size_t commonAncestor (size_t joint1, size_t joint2) const
 Returns the lowest common ancestor of two joints in the hierarchy, or kInvalidIndex if either joint is kInvalidIndex.
template<typename U>
SkeletonT< U > cast () const
 Returns a copy of this skeleton with all numeric values converted to scalar type U.

Public Attributes

JointList joints
 The list of joints in this skeleton, ordered such that every joint's parent appears earlier in the list (parent index < child index, or kInvalidIndex for roots).

Detailed Description

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

The skeletal structure of a momentum Character.

Definition at line 22 of file skeleton.h.

Constructor & Destructor Documentation

◆ SkeletonT() [1/4]

template<typename T>
momentum::SkeletonT< T >::SkeletonT ( )
default

◆ SkeletonT() [2/4]

template<typename T>
momentum::SkeletonT< T >::SkeletonT ( JointList joints)
explicit
Precondition
Every joint's parent index is either less than its own index or kInvalidIndex.
Exceptions
ifthe hierarchy invariant is violated.

Definition at line 16 of file skeleton.cpp.

References joints, momentum::kInvalidIndex, and MT_CHECK.

◆ SkeletonT() [3/4]

template<typename T>
momentum::SkeletonT< T >::SkeletonT ( const SkeletonT< T > & other)
default

◆ SkeletonT() [4/4]

template<typename T>
momentum::SkeletonT< T >::SkeletonT ( SkeletonT< T > && other)
defaultnoexcept

◆ ~SkeletonT()

template<typename T>
momentum::SkeletonT< T >::~SkeletonT ( )
default

Member Function Documentation

◆ cast()

template<typename T>
template<typename U>
SkeletonT< U > momentum::SkeletonT< T >::cast ( ) const
inlinenodiscard

Returns a copy of this skeleton with all numeric values converted to scalar type U.

Definition at line 68 of file skeleton.h.

◆ commonAncestor()

template<typename T>
size_t momentum::SkeletonT< T >::commonAncestor ( size_t joint1,
size_t joint2 ) const
nodiscard

Returns the lowest common ancestor of two joints in the hierarchy, or kInvalidIndex if either joint is kInvalidIndex.

Definition at line 97 of file skeleton.cpp.

References joints, momentum::kInvalidIndex, and MT_CHECK.

Referenced by momentum::detail_sdf_collision::findCommonAncestorForVertex().

◆ getChildrenJoints()

template<typename T>
std::vector< size_t > momentum::SkeletonT< T >::getChildrenJoints ( size_t jointId,
bool recursive = true ) const
nodiscard

Returns indices of child joints of the specified joint.

Parameters
jointIdIndex of the joint to find children for
recursiveIf true, returns all descendants; if false, only direct children
Exceptions
std::out_of_rangeif jointId is invalid

Definition at line 45 of file skeleton.cpp.

References joints, momentum::kInvalidIndex, and MT_THROW_IF_T.

◆ getJointIdByName()

◆ getJointNames()

template<typename T>
std::vector< std::string > momentum::SkeletonT< T >::getJointNames ( ) const
nodiscard

Definition at line 35 of file skeleton.cpp.

References joints.

Referenced by momentum::logJoints(), momentum::parameterTransformFromJson(), and momentum::saveMotion().

◆ isAncestor()

template<typename T>
bool momentum::SkeletonT< T >::isAncestor ( size_t jointId,
size_t ancestorJointId ) const
nodiscard

Returns true if ancestorJointId is an ancestor of jointId.

A joint is considered to be its own ancestor (isAncestor(id, id) returns true).

Definition at line 73 of file skeleton.cpp.

References joints, momentum::kInvalidIndex, and MT_CHECK.

Referenced by momentum::replaceSkeletonHierarchy().

◆ isSameOrAdjacentJoints()

template<typename T>
bool momentum::SkeletonT< T >::isSameOrAdjacentJoints ( size_t joint1,
size_t joint2 ) const
nodiscard

Returns true if the two joints are the same, or one is the direct parent of the other.

Returns false if either joint is kInvalidIndex, since world-fixed entities have no joint ancestry and are never considered adjacent to skeleton joints.

Definition at line 87 of file skeleton.cpp.

References joints, momentum::kInvalidIndex, and MT_CHECK.

Referenced by momentum::isValidCollisionPair().

◆ operator=() [1/2]

template<typename T>
SkeletonT & momentum::SkeletonT< T >::operator= ( const SkeletonT< T > & other)
default

◆ operator=() [2/2]

template<typename T>
SkeletonT & momentum::SkeletonT< T >::operator= ( SkeletonT< T > && other)
defaultnoexcept

Member Data Documentation

◆ joints

template<typename T>
JointList momentum::SkeletonT< T >::joints

The list of joints in this skeleton, ordered such that every joint's parent appears earlier in the list (parent index < child index, or kInvalidIndex for roots).

Definition at line 25 of file skeleton.h.

Referenced by momentum::accumulateChainDerivatives(), momentum::detail_sdf_collision::accumulateColliderHierarchyGradient(), momentum::detail_sdf_collision::accumulateColliderHierarchyJacobian(), momentum::addKeypointProjectionConstraints(), momentum::fbx_internal::addPhysicalProperties(), momentum::addRigidTransformNode(), momentum::averageTriangleSkinWeights(), momentum::bakeGloveOffsetsFromParams(), momentum::buildHierarchicalPaths(), momentum::calibrateModel(), momentum::SkeletonT< float >::cast(), commonAncestor(), momentum::fbx_internal::createAnimationCurves(), momentum::createGloveOrientationConstraintData(), momentum::createGlovePositionConstraintData(), momentum::fbx_internal::createSkeletonNodes(), momentum::FiniteDifferenceSequenceErrorFunctionT< T >::FiniteDifferenceSequenceErrorFunctionT(), getChildrenJoints(), getJointIdByName(), getJointNames(), isAncestor(), momentum::isRelatedJoint(), isSameOrAdjacentJoints(), momentum::loadCharacterFromLegacyJsonString(), momentum::loadLocatorsFromBuffer(), momentum::loadPoseShape(), momentum::loadSkeletonFromUsd(), momentum::loadSkeletonStatesFromUsd(), momentum::locatorsToSkinnedLocators(), momentum::logJoints(), momentum::makeCharacterDocument(), momentum::mapIdentityToCharacter(), momentum::mapMotionToCharacter(), momentum::parameterTransformFromJson(), momentum::parameterTransformToJson(), momentum::parseParameterTransform(), momentum::Character::remapLocators(), momentum::Character::remapParameterLimits(), momentum::Character::remapSkinnedLocators(), momentum::Character::remapSkinWeights(), momentum::removeJoints(), momentum::replaceSkeletonHierarchy(), momentum::resolvePhysicalPropertiesJointIndex(), momentum::saveBvhCharacter(), momentum::saveCollisionGeometryToUsd(), momentum::saveLocators(), momentum::saveLocatorsToUsd(), momentum::saveMmo(), momentum::saveSkeletonStatesToUsd(), momentum::saveSkeletonToUsd(), momentum::SkeletonStateT< T >::set(), momentum::SkeletonStateT< T >::set(), momentum::fbx_internal::setupJointAnimCurves(), momentum::Character::simplifySkeleton(), momentum::skeletonStateToJointParameters(), momentum::skeletonStateToJointParameters(), momentum::skeletonStateToJointParametersRespectingActiveParameters(), momentum::skeletonStateToJointParametersRespectingActiveParameters(), SkeletonT(), momentum::skinnedLocatorsToLocators(), momentum::transformAtoB(), momentum::VelocityMagnitudeSequenceErrorFunctionT< T >::VelocityMagnitudeSequenceErrorFunctionT(), momentum::writeParameterLimits(), and momentum::writeParameterTransform().


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