Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
pose_shape.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#pragma once
9
11#include <momentum/math/types.h>
12
13namespace momentum {
14
20struct PoseShape {
22 size_t baseJoint;
23
28
30 std::vector<size_t> jointMap;
31
36
42
47 [[nodiscard]] std::vector<Vector3f> compute(const SkeletonState& state) const;
48
51 [[nodiscard]] inline bool isApprox(const PoseShape& poseShape) const {
52 return (
53 (baseJoint == poseShape.baseJoint) && baseRot.isApprox(poseShape.baseRot) &&
54 (jointMap == poseShape.jointMap) && baseShape.isApprox(poseShape.baseShape) &&
55 shapeVectors.isApprox(poseShape.shapeVectors));
56 }
57};
58
59} // namespace momentum
Quaternion< float > Quaternionf
Definition types.h:386
SkeletonStateT< float > SkeletonState
Definition fwd.h:282
VectorX< float > VectorXf
Definition types.h:209
MatrixX< float > MatrixXf
Definition types.h:82
Computes shape deformations based on joint rotations.
Definition pose_shape.h:20
size_t baseJoint
Index of the joint used as reference for computing relative rotations.
Definition pose_shape.h:22
MatrixXf shapeVectors
Shape deformation vectors for each quaternion component of each joint.
Definition pose_shape.h:41
std::vector< Vector3f > compute(const SkeletonState &state) const
Computes the deformed shape vertices for the given skeleton pose.
VectorXf baseShape
Base shape vertices stored as a flat vector [x1,y1,z1,x2,y2,z2,...].
Definition pose_shape.h:35
std::vector< size_t > jointMap
Indices of joints whose rotations drive the shape deformation.
Definition pose_shape.h:30
Quaternionf baseRot
Base rotation used as reference for computing rotation differences.
Definition pose_shape.h:27
bool isApprox(const PoseShape &poseShape) const
Returns true if all members are approximately equal (uses Eigen::isApprox for floating-point members ...
Definition pose_shape.h:51