Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
skinned_locator.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
13
14namespace momentum {
15
26 std::string name;
27
30 Eigen::Matrix<uint32_t, kMaxSkinJoints, 1> parents;
31
33 Eigen::Matrix<float, kMaxSkinJoints, 1> skinWeights;
34
36 Vector3f position = Vector3f::Zero();
37
39 float weight = 1.0f;
40
43 float skinOffset = 0.0f;
44
46 const std::string& name = "uninitialized",
47 const Eigen::Matrix<uint32_t, kMaxSkinJoints, 1>& parents =
48 Eigen::Matrix<uint32_t, kMaxSkinJoints, 1>::Zero(),
49 const Eigen::Matrix<float, kMaxSkinJoints, 1>& skinWeights =
50 Eigen::Matrix<float, kMaxSkinJoints, 1>::Zero(),
51 const Vector3f& position = Vector3f::Zero(),
52 const float weight = 1.0f,
53 const float skinOffset = 0.0f)
54 : name(name),
60
62 inline bool operator==(const SkinnedLocator& locator) const {
63 return (
64 (name == locator.name) && (parents == locator.parents) &&
65 skinWeights.isApprox(locator.skinWeights) && position.isApprox(locator.position) &&
66 isApprox(weight, locator.weight) && isApprox(skinOffset, locator.skinOffset));
67 }
68};
69
71using SkinnedLocatorList = std::vector<SkinnedLocator>;
72
73} // namespace momentum
bool isApprox(T l, T r, T eps=Eps< T >(1e-4, 1e-6)) noexcept
Determines if two values are approximately equal within a given tolerance.
Definition utility.h:53
std::vector< SkinnedLocator > SkinnedLocatorList
A collection of locators attached to a skeleton.
Vector3< float > Vector3f
Definition types.h:251
Eigen::Matrix< uint32_t, kMaxSkinJoints, 1 > parents
Indices of the parent joints used for skinning.
Eigen::Matrix< float, kMaxSkinJoints, 1 > skinWeights
Skinning weight for each entry in parents. Typically sums to 1.0.
SkinnedLocator(const std::string &name="uninitialized", const Eigen::Matrix< uint32_t, kMaxSkinJoints, 1 > &parents=Eigen::Matrix< uint32_t, kMaxSkinJoints, 1 >::Zero(), const Eigen::Matrix< float, kMaxSkinJoints, 1 > &skinWeights=Eigen::Matrix< float, kMaxSkinJoints, 1 >::Zero(), const Vector3f &position=Vector3f::Zero(), const float weight=1.0f, const float skinOffset=0.0f)
bool operator==(const SkinnedLocator &locator) const
Equality comparison; uses approximate (isApprox) comparison for floating-point fields.
float weight
Influence weight when used as a constraint in error functions.
Vector3f position
Position in the character's rest-pose coordinate frame.
float skinOffset
Offset from the skin surface in centimeters, used when solving for body shape.