1#include <Core/Animation/PoseOperation.hpp>
2#include <Core/Math/Interpolation.hpp>
4#include <Eigen/Geometry>
10bool compatible(
const Pose& p0,
const Pose& p1 ) {
11 return ( p0.size() == p1.size() );
14Pose relativePose(
const Pose& modelPose,
const RestPose& restPose ) {
15 CORE_ASSERT( compatible( modelPose, restPose ),
" Poses with different size " );
16 Pose T( restPose.size() );
17#pragma omp parallel for
18 for (
int i = 0; i < int( T.size() ); ++i ) {
19 T[i] = modelPose[i] * restPose[i].inverse( Eigen::Affine );
26#pragma omp parallel for
27 for (
int i = 0; i < int( T.size() ); ++i ) {
33Pose applyTransformation(
const Pose& pose,
const Transform& transform ) {
34 Pose T( pose.size() );
35#pragma omp parallel for
36 for (
int i = 0; i < int( T.size() ); ++i ) {
42bool areEqual(
const Pose& p0,
const Pose& p1 ) {
43 CORE_ASSERT( compatible( p0, p1 ),
" Poses with different size " );
44 const uint n = p0.size();
45 for ( uint i = 0; i < n; ++i ) {
46 if ( !p0[i].isApprox( p1[i] ) ) {
return false; }
51Pose interpolatePoses(
const Pose& a,
const Pose& b,
const Scalar t ) {
52 CORE_ASSERT( ( a.size() == b.size() ),
"Poses are wrong" );
53 CORE_ASSERT( ( ( t >= Scalar( 0. ) ) && ( t <= Scalar( 1. ) ) ),
"T is wrong" );
55 const uint size = a.size();
56 Pose interpolatedPose( size );
58#pragma omp parallel for
59 for (
int i = 0; i < int( size ); ++i ) {
63 return interpolatedPose;
T linearInterpolate(const T &v0, const T &v1, const Scalar t)
std::vector< T, Eigen::aligned_allocator< T > > AlignedStdVector
hepler function to manage enum as underlying types in VariableSet