translate senseglove/unreal angles/directions

This commit is contained in:
Mamadou Babaei
2022-11-18 15:02:10 +01:00
parent 5d275e2519
commit f3b479132f
15 changed files with 283 additions and 98 deletions
@@ -39,6 +39,7 @@
#include "SGBuildHacks/SGInclude_Core_Vect3D.h"
#include "SGCoreImpl/SGVect3DImpl.h"
#include "SGUtils/SGArrayUtils.h"
#include "SGUtils/SGCoordinates.h"
float FSGAnatomyImpl::GetTotalFingerFlexion()
{
@@ -63,13 +64,15 @@ float FSGAnatomyImpl::GetTotalThumbExtension()
float FSGAnatomyImpl::GetFingerJointLimit(
const bool bRightHanded, const int32 Joint, const int32 Movement, const bool bMax)
{
return FAnatomyType::GetFingerJointLimit(bRightHanded, Joint, Movement, bMax);
return FSGCoordinates::TransformToUnreal(
Movement, FAnatomyType::GetFingerJointLimit(bRightHanded, Joint, Movement, bMax));
}
float FSGAnatomyImpl::GetThumbJointLimit(
const bool bRightHanded, const int32 Joint, const int32 Movement, const bool bMax)
{
return FAnatomyType::GetThumbJointLimit(bRightHanded, Joint, Movement, bMax);
return FSGCoordinates::TransformToUnreal(
Movement, FAnatomyType::GetThumbJointLimit(bRightHanded, Joint, Movement, bMax));
}
float FSGAnatomyImpl::NormalizeFingerFlexion(const float FlexionInRadians)
@@ -85,35 +88,35 @@ float FSGAnatomyImpl::NormalizeThumbFlexion(const float FlexionInRadians)
TArray<TArray<FVector>> FSGAnatomyImpl::GetDefaultHandAngles(const bool bRightHanded)
{
TArray<TArray<FVector>> DefaultHandAngles{
FSGArrayUtils::FromStdVector<FSGVect3DImpl::FVect3DType, FVector, FSGVect3DImpl, &FSGVect3DImpl::ToFVector>(
FAnatomyType::GetDefaultHandAngles(bRightHanded))
FSGArrayUtils::FromSenseGloveAngles<FSGVect3DImpl::FVect3DType>(
FAnatomyType::GetDefaultHandAngles(bRightHanded))
};
return DefaultHandAngles;
return MoveTemp(DefaultHandAngles);
}
TArray<TArray<FVector>> FSGAnatomyImpl::GetFlatHandAngles(const bool bRightHanded)
{
TArray<TArray<FVector>> FlatHandAngles{
FSGArrayUtils::FromStdVector<FSGVect3DImpl::FVect3DType, FVector, FSGVect3DImpl, &FSGVect3DImpl::ToFVector>(
FAnatomyType::GetFlatHandAngles(bRightHanded))
FSGArrayUtils::FromSenseGloveAngles<FSGVect3DImpl::FVect3DType>(
FAnatomyType::GetFlatHandAngles(bRightHanded))
};
return FlatHandAngles;
return MoveTemp(FlatHandAngles);
}
TArray<TArray<FVector>> FSGAnatomyImpl::GetThumbsUpHandAngles(const bool bRightHanded)
{
TArray<TArray<FVector>> ThumbsUpHandAngles{
FSGArrayUtils::FromStdVector<FSGVect3DImpl::FVect3DType, FVector, FSGVect3DImpl, &FSGVect3DImpl::ToFVector>(
FAnatomyType::GetThumbsUpHandAngles(bRightHanded))
FSGArrayUtils::FromSenseGloveAngles<FSGVect3DImpl::FVect3DType>(
FAnatomyType::GetThumbsUpHandAngles(bRightHanded))
};
return ThumbsUpHandAngles;
return MoveTemp(ThumbsUpHandAngles);
}
TArray<TArray<FVector>> FSGAnatomyImpl::GetFistHandAngles(const bool bRightHanded)
{
TArray<TArray<FVector>> FistHandAngles{
FSGArrayUtils::FromStdVector<FSGVect3DImpl::FVect3DType, FVector, FSGVect3DImpl, &FSGVect3DImpl::ToFVector>(
FAnatomyType::GetFistHandAngles(bRightHanded))
FSGArrayUtils::FromSenseGloveAngles<FSGVect3DImpl::FVect3DType>(
FAnatomyType::GetFistHandAngles(bRightHanded))
};
return FistHandAngles;
return MoveTemp(FistHandAngles);
}