consider millimeters/centimeters conversion, introduce units, and minor array utils refactoring

This commit is contained in:
Mamadou Babaei
2022-11-15 00:28:52 +01:00
parent ea3f23bae3
commit 7c05d767bd
23 changed files with 400 additions and 185 deletions
@@ -82,20 +82,20 @@ float USGAnatomyKismetLibrary::NormalizeThumbFlex(const float FlexionInRadians)
TArray<FSGVectorArray> USGAnatomyKismetLibrary::GetDefaultHandAngles(const bool bRightHanded)
{
return FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(FSGAnatomy::GetDefaultHandAngles(bRightHanded));
return FSGArrayUtils::ToNestedBPArray<FVector, FSGVectorArray>(FSGAnatomy::GetDefaultHandAngles(bRightHanded));
}
TArray<FSGVectorArray> USGAnatomyKismetLibrary::GetFlatHandAngles(const bool bRightHanded)
{
return FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(FSGAnatomy::GetFlatHandAngles(bRightHanded));
return FSGArrayUtils::ToNestedBPArray<FVector, FSGVectorArray>(FSGAnatomy::GetFlatHandAngles(bRightHanded));
}
TArray<FSGVectorArray> USGAnatomyKismetLibrary::GetThumbsUpHandAngles(const bool bRightHanded)
{
return FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(FSGAnatomy::GetThumbsUpHandAngles(bRightHanded));
return FSGArrayUtils::ToNestedBPArray<FVector, FSGVectorArray>(FSGAnatomy::GetThumbsUpHandAngles(bRightHanded));
}
TArray<FSGVectorArray> USGAnatomyKismetLibrary::GetFistHandAngles(const bool bRightHanded)
{
return FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(FSGAnatomy::GetFistHandAngles(bRightHanded));
return FSGArrayUtils::ToNestedBPArray<FVector, FSGVectorArray>(FSGAnatomy::GetFistHandAngles(bRightHanded));
}
@@ -81,7 +81,7 @@ USGBasicHandModel* USGBasicHandModelKismetLibrary::Deserialize(UObject* WorldCon
TArray<FSGFloatArray> USGBasicHandModelKismetLibrary::GetBaseFingerLengths()
{
return FSGArrayUtils::ToBPNestedArray<float, FSGFloatArray>(USGBasicHandModel::GetBaseFingerLengths());
return FSGArrayUtils::ToNestedBPArray<float, FSGFloatArray>(USGBasicHandModel::GetBaseFingerLengths());
}
TArray<FVector> USGBasicHandModelKismetLibrary::GetBaseJointPositions()
@@ -101,7 +101,7 @@ bool USGBasicHandModelKismetLibrary::IsRight(const USGBasicHandModel* BasicHandM
TArray<FSGFloatArray> USGBasicHandModelKismetLibrary::GetFingerLengths(const USGBasicHandModel* BasicHandModel)
{
return FSGArrayUtils::ToBPNestedArray<float, FSGFloatArray>(BasicHandModel->GetFingerLengths());
return FSGArrayUtils::ToNestedBPArray<float, FSGFloatArray>(BasicHandModel->GetFingerLengths());
}
TArray<float> USGBasicHandModelKismetLibrary::GetFingerLengths_F(const USGBasicHandModel* BasicHandModel,
@@ -125,7 +125,7 @@ void USGBasicHandModelKismetLibrary::SetFingerLengths_uint8_F_L(USGBasicHandMode
TArray<FSGFloatArray> USGBasicHandModelKismetLibrary::GetFingerRatios(const USGBasicHandModel* BasicHandModel) const
{
return FSGArrayUtils::ToBPNestedArray<float, FSGFloatArray>(BasicHandModel->GetFingerRatios());
return FSGArrayUtils::ToNestedBPArray<float, FSGFloatArray>(BasicHandModel->GetFingerRatios());
}
TArray<float> USGBasicHandModelKismetLibrary::GetFingerRatios_F(const USGBasicHandModel* BasicHandModel,
@@ -89,14 +89,14 @@ TArray<FVector> USGHandInterpolatorKismetLibrary::InterpolateThumbAngles(
TArray<FSGVectorArray> USGHandInterpolatorKismetLibrary::InterpolateHandAngles(
const USGHandInterpolator* Interpolator, const TArray<FVector>& TotalAngles)
{
return FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(
return FSGArrayUtils::ToNestedBPArray<FVector, FSGVectorArray>(
USGHandInterpolator::InterpolateHandAngles(Interpolator, TotalAngles));
}
TArray<FSGInterpolationSetArray> USGHandInterpolatorKismetLibrary::GetJointInterpolations(
UObject* WorldContextObject, const USGHandInterpolator* HandInterpolator) const
{
return FSGArrayUtils::ToBPNestedArray<USGInterpolationSet, FSGInterpolationSetArray>(
return FSGArrayUtils::ToNestedBPArray<USGInterpolationSet, FSGInterpolationSetArray>(
HandInterpolator->GetJointInterpolations(WorldContextObject));
}
@@ -71,7 +71,7 @@ USGHandPose* USGHandPoseKismetLibrary::FromHandAngles_HA_bRH_HD(
const TArray<FSGVectorArray>& HandAngles, const bool bRightHanded, const USGBasicHandModel* HandDimensions)
{
TArray<TArray<FVector>> HandAnglesNestedArray{
FSGArrayUtils::FromBPNestedArray<FVector, FSGVectorArray, &FSGVectorArray::VectorArray>(HandAngles)
FSGArrayUtils::FromNestedBPArray<FVector, FSGVectorArray, &FSGVectorArray::VectorArray>(HandAngles)
};
return USGHandPose::FromHandAngles(WorldContextObject, MoveTemp(HandAnglesNestedArray), bRightHanded,
HandDimensions);
@@ -81,7 +81,7 @@ USGHandPose* USGHandPoseKismetLibrary::FromHandAngles_HA_bRH(
UObject* WorldContextObject, const TArray<FSGVectorArray>& HandAngles, const bool bRightHanded)
{
TArray<TArray<FVector>> HandAnglesNestedArray{
FSGArrayUtils::FromBPNestedArray<FVector, FSGVectorArray, &FSGVectorArray::VectorArray>(HandAngles)
FSGArrayUtils::FromNestedBPArray<FVector, FSGVectorArray, &FSGVectorArray::VectorArray>(HandAngles)
};
return USGHandPose::FromHandAngles(WorldContextObject, MoveTemp(HandAnglesNestedArray), bRightHanded);
}
@@ -137,22 +137,22 @@ bool USGHandPoseKismetLibrary::IsRight(const USGHandPose* HandPose)
TArray<FSGVectorArray> USGHandPoseKismetLibrary::GetJointPositions(const USGHandPose* HandPose)
{
return FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(HandPose->GetJointPositions());
return FSGArrayUtils::ToNestedBPArray<FVector, FSGVectorArray>(HandPose->GetJointPositions());
}
TArray<FSGQuatArray> USGHandPoseKismetLibrary::GetJointRotationsQ(const USGHandPose* HandPose)
{
return FSGArrayUtils::ToBPNestedArray<FQuat, FSGQuatArray>(HandPose->GetJointRotationsQ());
return FSGArrayUtils::ToNestedBPArray<FQuat, FSGQuatArray>(HandPose->GetJointRotationsQ());
}
TArray<FSGRotatorArray> USGHandPoseKismetLibrary::GetJointRotations(const USGHandPose* HandPose)
{
return FSGArrayUtils::ToBPNestedArray<FRotator, FSGRotatorArray>(HandPose->GetJointRotations());
return FSGArrayUtils::ToNestedBPArray<FRotator, FSGRotatorArray>(HandPose->GetJointRotations());
}
TArray<FSGVectorArray> USGHandPoseKismetLibrary::GetHandAngles(const USGHandPose* HandPose)
{
return FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(HandPose->GetHandAngles());
return FSGArrayUtils::ToNestedBPArray<FVector, FSGVectorArray>(HandPose->GetHandAngles());
}
bool USGHandPoseKismetLibrary::Equals(const USGHandPose* A, const USGHandPose* B)
@@ -54,9 +54,9 @@ void USGNovaGloveCalibrationKismetLibrary::ApplyInterpolationValues(const TArray
{
FSGNovaGloveCalibration::ApplyInterpolationValues(
RetractedValues, ExtendedValues,
FSGArrayUtils::FromBPNestedArray<
FSGArrayUtils::FromNestedBPArray<
FVector, FSGVectorArray, &FSGVectorArray::VectorArray>(RetractedAngles),
FSGArrayUtils::FromBPNestedArray<
FSGArrayUtils::FromNestedBPArray<
FVector, FSGVectorArray, &FSGVectorArray::VectorArray>(ExtendedAngles),
Profile);
}
@@ -144,7 +144,7 @@ TArray<FRotator> USGSenseGloveInfoKismetLibrary::GetStartRotations_TArrayFRotato
TArray<FSGVectorArray> USGSenseGloveInfoKismetLibrary::GetGloveLengths(const USGSenseGloveInfo* SenseGloveInfo)
{
return FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(SenseGloveInfo->GetGloveLengths());
return FSGArrayUtils::ToNestedBPArray<FVector, FSGVectorArray>(SenseGloveInfo->GetGloveLengths());
}
TArray<bool> USGSenseGloveInfoKismetLibrary::GetFunctions(const USGSenseGloveInfo* SenseGloveInfo)
@@ -180,11 +180,11 @@ TArray<FSGVectorArray> USGSenseGloveInfoKismetLibrary::ToGloveAngles(const USGSe
const TArray<FSGFloatArray>& SensorAngles)
{
TArray<TArray<float>> SensorAnglesNestedArray{
FSGArrayUtils::FromBPNestedArray<
FSGArrayUtils::FromNestedBPArray<
float, FSGFloatArray, &FSGFloatArray::FloatArray>(SensorAngles)
};
TArray<FSGVectorArray> GloveAngles{
FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(
FSGArrayUtils::ToNestedBPArray<FVector, FSGVectorArray>(
SenseGloveInfo->ToGloveAngles(MoveTemp(SensorAnglesNestedArray)))
};
return MoveTemp(GloveAngles);
@@ -62,7 +62,7 @@ USGSenseGlovePose* USGSenseGloveKismetLibrary::CalculateGlovePose_GA_GM(
const TArray<FSGVectorArray>& GloveAngles, const USGSenseGloveInfo* GloveModel)
{
TArray<TArray<FVector>> GloveAnglesNestedArray{
FSGArrayUtils::FromBPNestedArray<FVector, FSGVectorArray, &FSGVectorArray::VectorArray>(GloveAngles)
FSGArrayUtils::FromNestedBPArray<FVector, FSGVectorArray, &FSGVectorArray::VectorArray>(GloveAngles)
};
return USGSenseGlove::CalculateGlovePose(WorldContextObject, MoveTemp(GloveAnglesNestedArray), GloveModel);
}
@@ -80,24 +80,24 @@ bool USGSenseGlovePoseKismetLibrary::IsRight(const USGSenseGlovePose* SenseGlove
TArray<FSGVectorArray> USGSenseGlovePoseKismetLibrary::GetJointPositions(const USGSenseGlovePose* SenseGlovePose)
{
return FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(SenseGlovePose->GetJointPositions());
return FSGArrayUtils::ToNestedBPArray<FVector, FSGVectorArray>(SenseGlovePose->GetJointPositions());
}
TArray<FSGQuatArray> USGSenseGlovePoseKismetLibrary::GetJointRotations_TArrayFSGQuatArray(
const USGSenseGlovePose* SenseGlovePose)
{
return FSGArrayUtils::ToBPNestedArray<FQuat, FSGQuatArray>(SenseGlovePose->GetJointRotationsQ());
return FSGArrayUtils::ToNestedBPArray<FQuat, FSGQuatArray>(SenseGlovePose->GetJointRotationsQ());
}
TArray<FSGRotatorArray> USGSenseGlovePoseKismetLibrary::GetJointRotations_TArrayFSGRotatorArray(
const USGSenseGlovePose* SenseGlovePose)
{
return FSGArrayUtils::ToBPNestedArray<FRotator, FSGRotatorArray>(SenseGlovePose->GetJointRotations());
return FSGArrayUtils::ToNestedBPArray<FRotator, FSGRotatorArray>(SenseGlovePose->GetJointRotations());
}
TArray<FSGVectorArray> USGSenseGlovePoseKismetLibrary::GetGloveAngles(const USGSenseGlovePose* SenseGlovePose)
{
return FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(SenseGlovePose->GetGloveAngles());
return FSGArrayUtils::ToNestedBPArray<FVector, FSGVectorArray>(SenseGlovePose->GetGloveAngles());
}
TArray<FVector> USGSenseGlovePoseKismetLibrary::GetThimblePositions(const USGSenseGlovePose* SenseGlovePose)
@@ -81,7 +81,7 @@ USGSenseGloveSensorData* USGSenseGloveSensorDataKismetLibrary::Deserialize(UObje
TArray<FSGFloatArray> USGSenseGloveSensorDataKismetLibrary::GetSensorAngles(
const USGSenseGloveSensorData* SenseGloveSensorData)
{
return FSGArrayUtils::ToBPNestedArray<float, FSGFloatArray>(SenseGloveSensorData->GetSensorAngles());
return FSGArrayUtils::ToNestedBPArray<float, FSGFloatArray>(SenseGloveSensorData->GetSensorAngles());
}
FQuat USGSenseGloveSensorDataKismetLibrary::GetImuRotation_FQuat(const USGSenseGloveSensorData* SenseGloveSensorData)
@@ -70,7 +70,7 @@ TArray<FRotator> USGSenseGloveVarsKismetLibrary::GetStartRotations_TArrayFRotato
TArray<FSGVectorArray> USGSenseGloveVarsKismetLibrary::GetGloveLengths(const FString& HardwareVersion)
{
return FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(FSGSenseGloveVars::GetGloveLengths(HardwareVersion));
return FSGArrayUtils::ToNestedBPArray<FVector, FSGVectorArray>(FSGSenseGloveVars::GetGloveLengths(HardwareVersion));
}
int32 USGSenseGloveVarsKismetLibrary::GetSensors(const FString& HardwareVersion)