translate senseglove/unreal angles/directions

This commit is contained in:
Mamadou Babaei
2022-11-18 15:01:53 +01:00
parent aac0bb8a05
commit b683aa22af
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);
}
@@ -49,6 +49,7 @@
#include "SGCoreImpl/SGQuatImpl.h"
#include "SGCoreImpl/SGVect3DImpl.h"
#include "SGUtils/SGArrayUtils.h"
#include "SGUtils/SGCoordinates.h"
struct FSGHandInterpolatorImpl::FImpl
{
@@ -81,53 +82,53 @@ struct FSGHandInterpolatorImpl::FImpl
FSGHandInterpolatorImpl FSGHandInterpolatorImpl::Default(const bool bRightHanded)
{
const FSGHandInterpolatorImpl HandInterpolatorImpl(FHandInterpolatorType::Default(bRightHanded));
return HandInterpolatorImpl;
FSGHandInterpolatorImpl HandInterpolatorImpl(FHandInterpolatorType::Default(bRightHanded));
return MoveTemp(HandInterpolatorImpl);
}
FSGHandInterpolatorImpl FSGHandInterpolatorImpl::Deserialize(const FString& SerializedString)
{
std::string Serialized(TCHAR_TO_UTF8(*SerializedString));
const FSGHandInterpolatorImpl GlovePose(FHandInterpolatorType::Deserialize(MoveTemp(Serialized)));
return GlovePose;
FSGHandInterpolatorImpl GlovePose(FHandInterpolatorType::Deserialize(MoveTemp(Serialized)));
return MoveTemp(GlovePose);
}
TArray<FVector> FSGHandInterpolatorImpl::InterpolateFingerAngles(
ESGFinger Finger, const FSGHandInterpolatorImpl& Interpolator, const FVector& TotalGloveAngles)
const ESGFinger Finger, const FSGHandInterpolatorImpl& Interpolator, const FVector& TotalGloveAngles)
{
const TArray<FVector> Angles{
FSGArrayUtils::FromStdVector<FSGVect3DImpl::FVect3DType, FVector, FSGVect3DImpl, &FSGVect3DImpl::ToFVector>(
TArray<FVector> Angles{
FSGArrayUtils::FromSenseGloveAngles<FSGVect3DImpl::FVect3DType>(
FHandInterpolatorType::InterpolateFingerAngles(
FSGCoreEnumCast::ToEFinger(Finger), Interpolator.ToHandInterpolator(),
FSGVect3DImpl(TotalGloveAngles).ToVect3D()))
FSGCoordinates::TransformToSenseGlove<FSGVect3DImpl::FVect3DType>(TotalGloveAngles)))
};
return Angles;
return MoveTemp(Angles);
}
TArray<FVector> FSGHandInterpolatorImpl::InterpolateThumbAngles(const FSGHandInterpolatorImpl& Interpolator,
const FVector& TotalGloveAngles)
{
const TArray<FVector> Angles{
FSGArrayUtils::FromStdVector<FSGVect3DImpl::FVect3DType, FVector, FSGVect3DImpl, &FSGVect3DImpl::ToFVector>(
TArray<FVector> Angles{
FSGArrayUtils::FromSenseGloveAngles<FSGVect3DImpl::FVect3DType>(
FHandInterpolatorType::InterpolateThumbAngles(
Interpolator.ToHandInterpolator(), FSGVect3DImpl(TotalGloveAngles).ToVect3D()))
Interpolator.ToHandInterpolator(),
FSGCoordinates::TransformToSenseGlove<FSGVect3DImpl::FVect3DType>(TotalGloveAngles)))
};
return Angles;
return MoveTemp(Angles);
}
TArray<TArray<FVector>> FSGHandInterpolatorImpl::InterpolateHandAngles(const FSGHandInterpolatorImpl& Interpolator,
const TArray<FVector>& TotalAngles)
{
std::vector<FSGVect3DImpl::FVect3DType> TotalAnglesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
TotalAngles)
FSGArrayUtils::ToSenseGloveAngles<FSGVect3DImpl::FVect3DType>(TotalAngles)
};
const TArray<TArray<FVector>> Angles{
FSGArrayUtils::FromStdVector<FSGVect3DImpl::FVect3DType, FVector, FSGVect3DImpl, &FSGVect3DImpl::ToFVector>(
TArray<TArray<FVector>> Angles{
FSGArrayUtils::FromSenseGloveAngles<FSGVect3DImpl::FVect3DType>(
FHandInterpolatorType::InterpolateHandAngles(
Interpolator.ToHandInterpolator(), MoveTemp(TotalAnglesVector)))
};
return Angles;
return MoveTemp(Angles);
}
FSGHandInterpolatorImpl::FSGHandInterpolatorImpl()
@@ -242,28 +243,33 @@ void FSGHandInterpolatorImpl::SetCmcStartRotation(const FQuat& CmcStartRotation)
float FSGHandInterpolatorImpl::CalculateAngle(const ESGFinger Finger, const int32 Movement, const float Value) const
{
return Pimpl->HandInterpolator.CalculateAngle(FSGCoreEnumCast::ToEFinger(Finger), Movement, Value);
return FSGCoordinates::TransformToUnreal(
Movement, Pimpl->HandInterpolator.CalculateAngle(FSGCoreEnumCast::ToEFinger(Finger), Movement, Value));
}
float FSGHandInterpolatorImpl::CalculateAngle(const ESGFinger Finger, const ESGFingerMovement Movement,
const float Value) const
{
return Pimpl->HandInterpolator.CalculateAngle(
FSGCoreEnumCast::ToEFinger(Finger), FSGCoreEnumCast::ToEFingerMovement(Movement), Value);
return FSGCoordinates::TransformToUnreal(
Movement, Pimpl->HandInterpolator.CalculateAngle(FSGCoreEnumCast::ToEFinger(Finger),
FSGCoreEnumCast::ToEFingerMovement(Movement), Value));
}
float FSGHandInterpolatorImpl::CalculateAngle(const ESGFinger Finger, const ESGThumbMovement Movement,
const float Value) const
{
return Pimpl->HandInterpolator.CalculateAngle(
FSGCoreEnumCast::ToEFinger(Finger), FSGCoreEnumCast::ToEThumbMovement(Movement), Value);
return FSGCoordinates::TransformToUnreal(
Movement, Pimpl->HandInterpolator.CalculateAngle(FSGCoreEnumCast::ToEFinger(Finger),
FSGCoreEnumCast::ToEThumbMovement(Movement), Value));
}
void FSGHandInterpolatorImpl::SetInterpolation(
const int32 Finger, const int32 Movement,
const float InputAt0, const float InputAt1, const float AngleAt0, const float AngleAt1)
{
Pimpl->HandInterpolator.SetInterpolation(Finger, Movement, InputAt0, InputAt1, AngleAt0, AngleAt1);
Pimpl->HandInterpolator.SetInterpolation(Finger, Movement, InputAt0, InputAt1,
FSGCoordinates::TransformToUnreal(Movement, AngleAt0),
FSGCoordinates::TransformToUnreal(Movement, AngleAt1));
}
void FSGHandInterpolatorImpl::SetInterpolation(
@@ -272,7 +278,9 @@ void FSGHandInterpolatorImpl::SetInterpolation(
{
Pimpl->HandInterpolator.SetInterpolation(
FSGCoreEnumCast::ToEFinger(Finger), FSGCoreEnumCast::ToEFingerMovement(Movement),
InputAt0, InputAt1, AngleAt0, AngleAt1);
InputAt0, InputAt1,
FSGCoordinates::TransformToUnreal(Movement, AngleAt0),
FSGCoordinates::TransformToUnreal(Movement, AngleAt1));
}
void FSGHandInterpolatorImpl::SetInterpolation(
@@ -280,7 +288,9 @@ void FSGHandInterpolatorImpl::SetInterpolation(
const float InputAt0, const float InputAt1, const float AngleAt0, const float AngleAt1)
{
Pimpl->HandInterpolator.SetInterpolation(FSGCoreEnumCast::ToEThumbMovement(Movement),
InputAt0, InputAt1, AngleAt0, AngleAt1);
InputAt0, InputAt1,
FSGCoordinates::TransformToUnreal(Movement, AngleAt0),
FSGCoordinates::TransformToUnreal(Movement, AngleAt1));
}
FSGInterpolationSetImpl FSGHandInterpolatorImpl::GetInterpolation(const int32 Finger, const int32 Movement) const
@@ -48,6 +48,7 @@
#include "SGCoreImpl/SGQuatImpl.h"
#include "SGCoreImpl/SGVect3DImpl.h"
#include "SGUtils/SGArrayUtils.h"
#include "SGUtils/SGCoordinates.h"
struct FSGHandPoseImpl::FImpl
{
@@ -89,8 +90,7 @@ FSGHandPoseImpl FSGHandPoseImpl::FromHandAngles(const TArray<TArray<FVector>>& H
const FSGBasicHandModelImpl& HandDimensions)
{
std::vector<std::vector<FSGVect3DImpl::FVect3DType>> HandAnglesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
HandAngles)
FSGArrayUtils::ToSenseGloveAngles<FSGVect3DImpl::FVect3DType>(HandAngles)
};
return FSGHandPoseImpl(FHandPoseType::FromHandAngles(
MoveTemp(HandAnglesVector), bRightHanded, HandDimensions.ToBasicHandModel()));
@@ -99,8 +99,7 @@ FSGHandPoseImpl FSGHandPoseImpl::FromHandAngles(const TArray<TArray<FVector>>& H
FSGHandPoseImpl FSGHandPoseImpl::FromHandAngles(const TArray<TArray<FVector>>& HandAngles, const bool bRightHanded)
{
std::vector<std::vector<FSGVect3DImpl::FVect3DType>> HandAnglesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
HandAngles)
FSGArrayUtils::ToSenseGloveAngles<FSGVect3DImpl::FVect3DType>(HandAngles)
};
return FSGHandPoseImpl(FHandPoseType::FromHandAngles(MoveTemp(HandAnglesVector), bRightHanded));
}
@@ -173,8 +172,7 @@ FSGHandPoseImpl::FSGHandPoseImpl(const bool bRightHanded, const TArray<TArray<FV
};
std::vector<std::vector<FSGVect3DImpl::FVect3DType>> HandAnglesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
HandAngles)
FSGArrayUtils::ToSenseGloveAngles<FSGVect3DImpl::FVect3DType>(HandAngles)
};
Pimpl->HandPose = FHandPoseType(
@@ -271,8 +269,7 @@ void FSGHandPoseImpl::SetJointRotations(const TArray<TArray<FQuat>>& JointRotati
TArray<TArray<FVector>> FSGHandPoseImpl::GetHandAngles() const
{
TArray<TArray<FVector>> HandAngles{
FSGArrayUtils::FromStdVector<FSGVect3DImpl::FVect3DType, FVector, FSGVect3DImpl, &FSGVect3DImpl::ToFVector>(
Pimpl->HandPose.GetHandAngles())
FSGArrayUtils::FromSenseGloveAngles<FSGVect3DImpl::FVect3DType>(Pimpl->HandPose.GetHandAngles())
};
return MoveTemp(HandAngles);
}
@@ -280,8 +277,7 @@ TArray<TArray<FVector>> FSGHandPoseImpl::GetHandAngles() const
void FSGHandPoseImpl::SetHandAngles(const TArray<TArray<FVector>>& HandAngles) const
{
std::vector<std::vector<FSGVect3DImpl::FVect3DType>> HandAnglesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
HandAngles)
FSGArrayUtils::ToSenseGloveAngles<FSGVect3DImpl::FVect3DType>(HandAngles)
};
Pimpl->HandPose.SetHandAngles(MoveTemp(HandAnglesVector));
}
@@ -46,6 +46,7 @@
#include "SGCoreImpl/SGSensorRangeImpl.h"
#include "SGCoreImpl/SGVect3DImpl.h"
#include "SGUtils/SGArrayUtils.h"
#include "SGUtils/SGCoordinates.h"
struct FSGHapticGloveCalibrationCheckImpl::FImpl
{
@@ -88,6 +89,8 @@ float FSGHapticGloveCalibrationCheckImpl::GetNovaGloveThreshold()
float FSGHapticGloveCalibrationCheckImpl::GetSenseGloveMinFlexion()
{
/// TODO
/// Though flexion should not be translated, should we still call the translation function?
return FHapticGloveCalibrationCheckType::GetSenseGloveMinFlexion();
}
@@ -98,11 +101,15 @@ float FSGHapticGloveCalibrationCheckImpl::GetNovaGloveMinFlexion()
float FSGHapticGloveCalibrationCheckImpl::GetSenseGloveMinAbduction()
{
return FHapticGloveCalibrationCheckType::GetSenseGloveMinAbduction();
/// TODO
/// Maybe use enums?
return FSGCoordinates::TransformToUnreal(2, FHapticGloveCalibrationCheckType::GetSenseGloveMinAbduction());
}
float FSGHapticGloveCalibrationCheckImpl::GetNovaGloveMinAbduction()
{
/// NOTE
/// Nova abduction translation is redundant.
return FHapticGloveCalibrationCheckType::GetNovaGloveMinAbduction();
}
@@ -57,8 +57,7 @@ bool FSGJointKinematicsImpl::ForwardKinematics(const FVector& StartPosition, con
};
std::vector<FSGVect3DImpl::FVect3DType> JointAnglesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
JointAngles)
FSGArrayUtils::ToSenseGloveAngles<FSGVect3DImpl::FVect3DType>(JointAngles)
};
std::vector<FSGVect3DImpl::FVect3DType> NewPositions;
@@ -81,8 +80,7 @@ bool FSGJointKinematicsImpl::ForwardKinematics(const FSGBasicHandModelImpl& Prof
TArray<FVector>& OutNewPositions, TArray<FQuat>& OutNewRotations)
{
std::vector<FSGVect3DImpl::FVect3DType> JointAnglesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
JointAngles)
FSGArrayUtils::ToSenseGloveAngles<FSGVect3DImpl::FVect3DType>(JointAngles)
};
std::vector<FSGVect3DImpl::FVect3DType> NewPositions;
@@ -77,13 +77,11 @@ void FSGNovaGloveCalibrationImpl::ApplyInterpolationValues(const TArray<FVector>
};
std::vector<std::vector<FSGVect3DImpl::FVect3DType>> RetractedAnglesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
RetractedAngles)
FSGArrayUtils::ToSenseGloveAngles<FSGVect3DImpl::FVect3DType>(RetractedAngles)
};
std::vector<std::vector<FSGVect3DImpl::FVect3DType>> ExtendedAnglesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
ExtendedAngles)
FSGArrayUtils::ToSenseGloveAngles<FSGVect3DImpl::FVect3DType>(ExtendedAngles)
};
FNovaGloveCalibrationType::ApplyInterpolationValues(
@@ -246,7 +246,7 @@ FSGNovaGloveImpl::FSGNovaGloveImpl()
{
}
FSGNovaGloveImpl::FSGNovaGloveImpl(const FSGNovaGloveInfoImpl DeviceInfo)
FSGNovaGloveImpl::FSGNovaGloveImpl(const FSGNovaGloveInfoImpl& DeviceInfo)
: FSGHapticGloveImpl(FSGNovaGloveImpl(std::make_shared<FNovaGloveType>((DeviceInfo.ToNovaGloveInfo())))),
#if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 )
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
@@ -119,8 +119,7 @@ FSGSenseGlovePoseImpl FSGSenseGloveImpl::CalculateGlovePose(const TArray<TArray<
const FSGSenseGloveInfoImpl& GloveModel)
{
std::vector<std::vector<FSGVect3DImpl::FVect3DType>> GloveAnglesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
GloveAngles)
FSGArrayUtils::ToSenseGloveAngles<FSGVect3DImpl::FVect3DType>(GloveAngles)
};
FSGSenseGlovePoseImpl Pose{
FSenseGloveType::CalculateGlovePose(MoveTemp(GloveAnglesVector), GloveModel.ToSenseGloveInfo())
@@ -352,9 +352,13 @@ TArray<FVector> FSGSenseGloveInfoImpl::GetGloveLengths(const ESGFinger Finger) c
TArray<TArray<FVector>> FSGSenseGloveInfoImpl::ToGloveAngles(const TArray<TArray<float>>& SensorAngles) const
{
std::vector<std::vector<float>> SensorAnglesVector{FSGArrayUtils::ToStdVector<float>(SensorAngles)};
/// TODO
/// Does the nested float TArray requires translation? If so, how to do that without a Movement value?
std::vector<std::vector<float>> SensorAnglesVector{
FSGArrayUtils::ToStdVector<float>(SensorAngles)
};
TArray<TArray<FVector>> GloveAngles{
FSGArrayUtils::FromStdVector<FSGVect3DImpl::FVect3DType, FVector, FSGVect3DImpl, &FSGVect3DImpl::ToFVector>(
FSGArrayUtils::FromSenseGloveAngles<FSGVect3DImpl::FVect3DType>(
Pimpl->SenseGloveInfo.ToGloveAngles(MoveTemp((SensorAnglesVector))))
};
return MoveTemp(GloveAngles);
@@ -81,15 +81,15 @@ struct FSGSenseGlovePoseImpl::FImpl
FSGSenseGlovePoseImpl FSGSenseGlovePoseImpl::IdlePose(const FSGSenseGloveInfoImpl& GloveInfo)
{
const FSGSenseGlovePoseImpl GlovePoseImpl(FSenseGlovePoseType::IdlePose(GloveInfo.ToSenseGloveInfo()));
return GlovePoseImpl;
FSGSenseGlovePoseImpl GlovePoseImpl(FSenseGlovePoseType::IdlePose(GloveInfo.ToSenseGloveInfo()));
return MoveTemp(GlovePoseImpl);
}
FSGSenseGlovePoseImpl FSGSenseGlovePoseImpl::Deserialize(const FString& SerializedString)
{
std::string Serialized(TCHAR_TO_UTF8(*SerializedString));
const FSGSenseGlovePoseImpl GlovePose(FSenseGlovePoseType::Deserialize(MoveTemp(Serialized)));
return GlovePose;
FSGSenseGlovePoseImpl GlovePose(FSenseGlovePoseType::Deserialize(MoveTemp(Serialized)));
return MoveTemp(GlovePose);
}
FSGSenseGlovePoseImpl::FSGSenseGlovePoseImpl()
@@ -102,7 +102,7 @@ FSGSenseGlovePoseImpl::FSGSenseGlovePoseImpl()
{
}
FSGSenseGlovePoseImpl::FSGSenseGlovePoseImpl(bool bRightHanded, const TArray<TArray<FVector>>& JointPositions,
FSGSenseGlovePoseImpl::FSGSenseGlovePoseImpl(const bool bRightHanded, const TArray<TArray<FVector>>& JointPositions,
const TArray<TArray<FQuat>>& JointRotations,
const TArray<TArray<FVector>>& GloveAngles)
:
@@ -116,12 +116,10 @@ FSGSenseGlovePoseImpl::FSGSenseGlovePoseImpl(bool bRightHanded, const TArray<TAr
FSGArrayUtils::ToMillimeters<FSGVect3DImpl::FVect3DType, FSGVect3DImpl>(JointPositions)
};
std::vector<std::vector<FSGQuatImpl::FQuatType>> JointRotationsVector{
FSGArrayUtils::ToStdVector<FQuat, FSGQuatImpl::FQuatType, FSGQuatImpl, &FSGQuatImpl::ToQuat>(
JointRotations)
FSGArrayUtils::ToStdVector<FQuat, FSGQuatImpl::FQuatType, FSGQuatImpl, &FSGQuatImpl::ToQuat>(JointRotations)
};
std::vector<std::vector<FSGVect3DImpl::FVect3DType>> GloveAnglesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
GloveAngles)
FSGArrayUtils::ToSenseGloveAngles<FSGVect3DImpl::FVect3DType>(GloveAngles)
};
Pimpl->SenseGlovePose = FSenseGlovePoseType(bRightHanded,
@@ -182,11 +180,11 @@ void FSGSenseGlovePoseImpl::SetIsRight(const bool bRightHanded) const
TArray<TArray<FVector>> FSGSenseGlovePoseImpl::GetJointPositions() const
{
const TArray<TArray<FVector>> JointPositions{
TArray<TArray<FVector>> JointPositions{
FSGArrayUtils::FromMillimeters<FSGVect3DImpl::FVect3DType, FSGVect3DImpl>(
Pimpl->SenseGlovePose.GetJointPositions())
};
return JointPositions;
return MoveTemp(JointPositions);
}
void FSGSenseGlovePoseImpl::SetJointPositions(const TArray<TArray<FVector>>& JointPositions) const
@@ -199,11 +197,11 @@ void FSGSenseGlovePoseImpl::SetJointPositions(const TArray<TArray<FVector>>& Joi
TArray<TArray<FQuat>> FSGSenseGlovePoseImpl::GetJointRotations() const
{
const TArray<TArray<FQuat>> JointRotations{
TArray<TArray<FQuat>> JointRotations{
FSGArrayUtils::FromStdVector<FSGQuatImpl::FQuatType, FQuat, FSGQuatImpl, &FSGQuatImpl::ToFQuat>(
Pimpl->SenseGlovePose.GetJointRotations())
};
return JointRotations;
return MoveTemp(JointRotations);
}
void FSGSenseGlovePoseImpl::SetJointRotations(const TArray<TArray<FQuat>>& JointRotations) const
@@ -217,17 +215,17 @@ void FSGSenseGlovePoseImpl::SetJointRotations(const TArray<TArray<FQuat>>& Joint
TArray<TArray<FVector>> FSGSenseGlovePoseImpl::GetGloveAngles() const
{
const TArray<TArray<FVector>> GloveAngles{
FSGArrayUtils::FromStdVector<FSGVect3DImpl::FVect3DType, FVector, FSGVect3DImpl, &FSGVect3DImpl::ToFVector>(
TArray<TArray<FVector>> GloveAngles{
FSGArrayUtils::FromSenseGloveAngles<FSGVect3DImpl::FVect3DType>(
Pimpl->SenseGlovePose.GetGloveAngles())
};
return GloveAngles;
return MoveTemp(GloveAngles);
}
void FSGSenseGlovePoseImpl::SetGloveAngles(const TArray<TArray<FVector>>& GloveAngles) const
{
std::vector<std::vector<FSGVect3DImpl::FVect3DType>> HandAnglesVector{
FSGArrayUtils::ToStdVector<FVector, FSGVect3DImpl::FVect3DType, FSGVect3DImpl, &FSGVect3DImpl::ToVect3D>(
FSGArrayUtils::ToSenseGloveAngles<FSGVect3DImpl::FVect3DType>(
GloveAngles)
};
Pimpl->SenseGlovePose.SetGloveAngles(MoveTemp(HandAnglesVector));
@@ -235,39 +233,38 @@ void FSGSenseGlovePoseImpl::SetGloveAngles(const TArray<TArray<FVector>>& GloveA
TArray<FVector> FSGSenseGlovePoseImpl::GetThimblePositions() const
{
const TArray<FVector> ThimblePositions{
TArray<FVector> ThimblePositions{
FSGArrayUtils::FromMillimeters<FSGVect3DImpl::FVect3DType, FSGVect3DImpl>(
Pimpl->SenseGlovePose.GetThimblePositions())
};
return ThimblePositions;
return MoveTemp(ThimblePositions);
}
TArray<FQuat> FSGSenseGlovePoseImpl::GetThimbleRotations() const
{
const TArray<FQuat> ThimbleRotations{
TArray<FQuat> ThimbleRotations{
FSGArrayUtils::FromStdVector<FSGQuatImpl::FQuatType, FQuat, FSGQuatImpl, &FSGQuatImpl::ToFQuat>(
Pimpl->SenseGlovePose.GetThimbleRotations())
};
return ThimbleRotations;
return MoveTemp(ThimbleRotations);
}
TArray<FVector> FSGSenseGlovePoseImpl::GetTotalGloveAngles() const
{
const TArray<FVector> TotalGloveAngles{
FSGArrayUtils::FromStdVector<FSGVect3DImpl::FVect3DType, FVector, FSGVect3DImpl, &FSGVect3DImpl::ToFVector>(
Pimpl->SenseGlovePose.GetTotalGloveAngles())
TArray<FVector> TotalGloveAngles{
FSGArrayUtils::FromSenseGloveAngles<FSGVect3DImpl::FVect3DType>(Pimpl->SenseGlovePose.GetTotalGloveAngles())
};
return TotalGloveAngles;
return MoveTemp(TotalGloveAngles);
}
TArray<FVector> FSGSenseGlovePoseImpl::CalculateFingerTips(
const FSGSenseGloveHandProfileImpl& SenseGloveHandProfileImpl) const
{
const TArray<FVector> FingerTips{
TArray<FVector> FingerTips{
FSGArrayUtils::FromMillimeters<FSGVect3DImpl::FVect3DType, FSGVect3DImpl>(
Pimpl->SenseGlovePose.CalculateFingerTips(SenseGloveHandProfileImpl.ToSenseGloveHandProfile()))
};
return FingerTips;
return MoveTemp(FingerTips);
}
TArray<FVector> FSGSenseGlovePoseImpl::CalculateFingerTips(const TArray<FVector>& FingerOffsets) const
@@ -279,7 +276,7 @@ TArray<FVector> FSGSenseGlovePoseImpl::CalculateFingerTips(const TArray<FVector>
FSGArrayUtils::FromMillimeters<FSGVect3DImpl::FVect3DType, FSGVect3DImpl>(
Pimpl->SenseGlovePose.CalculateFingerTips(MoveTemp(FingerOffsetsVector)))
};
return FingerTips;
return MoveTemp(FingerTips);
}
bool FSGSenseGlovePoseImpl::Equals(const FSGSenseGlovePoseImpl& SenseGlovePoseImpl) const
@@ -289,14 +286,14 @@ bool FSGSenseGlovePoseImpl::Equals(const FSGSenseGlovePoseImpl& SenseGlovePoseIm
FString FSGSenseGlovePoseImpl::ToString(bool bShortFormat) const
{
const FString String(UTF8_TO_TCHAR(Pimpl->SenseGlovePose.ToString(bShortFormat).c_str()));
return String;
FString String(UTF8_TO_TCHAR(Pimpl->SenseGlovePose.ToString(bShortFormat).c_str()));
return MoveTemp(String);
}
FString FSGSenseGlovePoseImpl::Serialize() const
{
const FString Serialized(UTF8_TO_TCHAR(Pimpl->SenseGlovePose.Serialize().c_str()));
return Serialized;
FString Serialized(UTF8_TO_TCHAR(Pimpl->SenseGlovePose.Serialize().c_str()));
return MoveTemp(Serialized);
}
FSGSenseGlovePoseImpl::FImpl::FImpl(FSGSenseGlovePoseImpl* InOwner)
@@ -135,7 +135,7 @@ private:
public:
FSGNovaGloveImpl();
explicit FSGNovaGloveImpl(const FSGNovaGloveInfoImpl DeviceInfo);
explicit FSGNovaGloveImpl(const FSGNovaGloveInfoImpl& DeviceInfo);
public:
/**