Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
tracker_utils.cpp File Reference
#include "momentum/marker_tracking/tracker_utils.h"
#include "momentum/character/blend_shape.h"
#include "momentum/character/blend_shape_skinning.h"
#include "momentum/character/character.h"
#include "momentum/character/inverse_parameter_transform.h"
#include "momentum/character/parameter_limits.h"
#include "momentum/character/skeleton_state.h"
#include "momentum/character_solver/position_error_function.h"
#include "momentum/character_solver/skinned_locator_error_function.h"
#include "momentum/math/constants.h"
#include "momentum/math/mesh.h"
#include "momentum/math/utility.h"
#include "momentum/common/exception.h"
#include "momentum/common/log.h"
#include "axel/math/PointTriangleProjectionDefinitions.h"
#include <algorithm>
#include <queue>
#include <span>
#include <unordered_map>
#include <unordered_set>

Go to the source code of this file.

Namespaces

namespace  momentum

Functions

std::vector< std::vector< PositionData > > momentum::createConstraintData (const std::span< const std::vector< Marker > > markerData, const LocatorList &locators)
std::vector< std::vector< SkinnedLocatorConstraint > > momentum::createSkinnedConstraintData (const std::span< const std::vector< Marker > > markerData, const SkinnedLocatorList &locators)
std::pair< Eigen::Vector< uint32_t, kMaxSkinJoints >, Eigen::Vector< float, kMaxSkinJoints > > momentum::averageTriangleSkinWeights (const Character &character, int triangleIndex, const Eigen::Vector3f &barycentric)
bool momentum::isRelatedJoint (const momentum::Skeleton &skeleton, uint32_t jointA, uint32_t jointB)
 Check if two joints are related (same joint, parent-child, or child-parent relationship).
ClosestPointOnMeshResult momentum::closestPointOnMeshMatchingParent (const momentum::Mesh &mesh, const momentum::SkinWeights &skin, const momentum::Skeleton &skeleton, const Eigen::Vector3f &p_world, uint32_t parentIdx, float cutoffWeight=0.02)
momentum::Character momentum::locatorsToSkinnedLocators (const momentum::Character &sourceCharacter, float maxDistance=3.0f, float minSkinWeight=0.03f, bool verbose=false, float markerDiameter=0.0f)
 Convert locators to skinned locators by finding the closest point on the mesh surface that matches the correct bone index and using the skinned weights from that point.
momentum::Character momentum::skinnedLocatorsToLocators (const momentum::Character &sourceCharacter)
 Convert skinned locators to regular locators by selecting the bone with the highest skin weight.
std::vector< std::vector< size_t > > momentum::buildTriangleAdjacency (const momentum::Mesh &mesh)
 Build triangle adjacency: for each triangle, find triangles that share an edge.
std::vector< CandidateTriangle > momentum::findCandidateTrianglesDfs (const momentum::Mesh &mesh, const momentum::SkinWeights &skin, const momentum::Skeleton &skeleton, std::span< const std::vector< size_t > > adjacency, size_t startTriangleIdx, const Eigen::Vector3f &initialPoint, const Eigen::Vector3f &referenceNormal, uint32_t parentJointIdx, float maxSearchDistanceCm, float maxNormalAngleDeg=30.0f)
 Find candidate triangles by walking along the mesh surface using DFS.
std::vector< momentum::SkinnedLocatorTriangleConstraintT< float > > momentum::createSkinnedLocatorMeshConstraints (const momentum::Character &character, float cutoffWeight, float maxSearchDistanceCm, float maxNormalAngleDeg)
Character momentum::createLocatorCharacter (const Character &sourceCharacter, const std::string &prefix)
LocatorList momentum::extractLocatorsFromCharacter (const Character &locatorCharacter, const CharacterParameters &calibParams)
SkinnedLocatorList momentum::extractSkinnedLocatorsFromCharacter (const Character &locatorCharacter, const CharacterParameters &calibParams)
ModelParameters momentum::extractParameters (const ModelParameters &params, const ParameterSet &parameterSet)
std::tuple< Eigen::VectorXf, LocatorList, SkinnedLocatorList > momentum::extractIdAndLocatorsFromParams (const ModelParameters &param, const Character &sourceCharacter, const Character &targetCharacter)
Mesh momentum::extractBlendShapeFromParams (const momentum::ModelParameters &param, const momentum::Character &sourceCharacter)
void momentum::fillIdentity (const ParameterSet &idSet, const ModelParameters &identity, Eigen::MatrixXf &motionNoId)
void momentum::removeIdentity (const ParameterSet &idSet, const ModelParameters &identity, Eigen::MatrixXf &motionWithId)
ModelParameters momentum::jointIdentityToModelIdentity (const Character &c, const ParameterSet &idSet, const JointParameters &jointIdentity)
std::vector< std::vector< Marker > > momentum::extractMarkersFromMotion (const Character &character, const Eigen::MatrixXf &motion)
std::vector< std::pair< std::string, float > > momentum::computeSkinnedLocatorMeshDistances (const momentum::Character &character)
 Compute the distance from each skinned locator to the closest point on the mesh surface.
std::vector< std::vector< PlaneDataT< float > > > momentum::computeFloorContactConstraints (const Character &character, const MatrixXf &motion, const std::vector< PlaneDataT< float > > &floorConstraints, const std::vector< size_t > &frameIndices, float percentile)