148 lines
5.6 KiB
C++
148 lines
5.6 KiB
C++
/**
|
|
* @file
|
|
*
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @section LICENSE
|
|
*
|
|
* (The MIT License)
|
|
*
|
|
* Copyright (c) 2020 - 2022 SenseGlove
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
* copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
*
|
|
* @section DESCRIPTION
|
|
*
|
|
*
|
|
*/
|
|
|
|
|
|
#include "SGCoreKismet/SGSenseGlovePoseKismetLibrary.h"
|
|
|
|
#include "SGCore/SGSenseGlovePose.h"
|
|
#include "SGUtils/SGArrayUtils.h"
|
|
|
|
USGSenseGlovePose* USGSenseGlovePoseKismetLibrary::MakeSenseGlovePose(UObject* WorldContextObject)
|
|
{
|
|
return USGSenseGlovePose::NewSenseGlovePose(WorldContextObject);
|
|
}
|
|
|
|
USGSenseGlovePose* USGSenseGlovePoseKismetLibrary::MakeSenseGlovePose_bRH_JP_TArrayFSGQuatArray_JR_GA(
|
|
UObject* WorldContextObject, const bool bRightHanded,
|
|
const TArray<FSGVectorArray>& JointPositions, const TArray<FSGQuatArray>& JointRotations,
|
|
const TArray<FSGVectorArray>& GloveAngles)
|
|
{
|
|
return USGSenseGlovePose::NewSenseGlovePose(WorldContextObject, bRightHanded,
|
|
JointPositions, JointRotations, GloveAngles);
|
|
}
|
|
|
|
USGSenseGlovePose* USGSenseGlovePoseKismetLibrary::MakeSenseGlovePose_bRH_JP_TArrayFSGRotatorArray_JR_GA(
|
|
UObject* WorldContextObject, const bool bRightHanded,
|
|
const TArray<FSGVectorArray>& JointPositions, const TArray<FSGRotatorArray>& JointRotations,
|
|
const TArray<FSGVectorArray>& GloveAngles)
|
|
{
|
|
return USGSenseGlovePose::NewSenseGlovePose(WorldContextObject, bRightHanded,
|
|
JointPositions, JointRotations, GloveAngles);
|
|
}
|
|
|
|
USGSenseGlovePose* USGSenseGlovePoseKismetLibrary::IdlePose(UObject* WorldContextObject,
|
|
const USGSenseGloveInfo* GloveInfo)
|
|
{
|
|
return USGSenseGlovePose::IdlePose(WorldContextObject, GloveInfo);
|
|
}
|
|
|
|
USGSenseGlovePose* USGSenseGlovePoseKismetLibrary::Deserialize(UObject* WorldContextObject,
|
|
const FString& SerializedString)
|
|
{
|
|
return USGSenseGlovePose::Deserialize(WorldContextObject, SerializedString);
|
|
}
|
|
|
|
bool USGSenseGlovePoseKismetLibrary::IsRight(const USGSenseGlovePose* SenseGlovePose)
|
|
{
|
|
return SenseGlovePose->IsRight();
|
|
}
|
|
|
|
TArray<FSGVectorArray> USGSenseGlovePoseKismetLibrary::GetJointPositions(const USGSenseGlovePose* SenseGlovePose)
|
|
{
|
|
return FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(SenseGlovePose->GetJointPositions());
|
|
}
|
|
|
|
TArray<FSGQuatArray> USGSenseGlovePoseKismetLibrary::GetJointRotations_TArrayFSGQuatArray(
|
|
const USGSenseGlovePose* SenseGlovePose)
|
|
{
|
|
return FSGArrayUtils::ToBPNestedArray<FQuat, FSGQuatArray>(SenseGlovePose->GetJointRotationsQ());
|
|
}
|
|
|
|
TArray<FSGRotatorArray> USGSenseGlovePoseKismetLibrary::GetJointRotations_TArrayFSGRotatorArray(
|
|
const USGSenseGlovePose* SenseGlovePose)
|
|
{
|
|
return FSGArrayUtils::ToBPNestedArray<FRotator, FSGRotatorArray>(SenseGlovePose->GetJointRotations());
|
|
}
|
|
|
|
TArray<FSGVectorArray> USGSenseGlovePoseKismetLibrary::GetGloveAngles(const USGSenseGlovePose* SenseGlovePose)
|
|
{
|
|
return FSGArrayUtils::ToBPNestedArray<FVector, FSGVectorArray>(SenseGlovePose->GetGloveAngles());
|
|
}
|
|
|
|
TArray<FVector> USGSenseGlovePoseKismetLibrary::GetThimblePositions(const USGSenseGlovePose* SenseGlovePose)
|
|
{
|
|
return SenseGlovePose->GetThimblePositions();
|
|
}
|
|
|
|
TArray<FQuat> USGSenseGlovePoseKismetLibrary::GetThimbleRotations_FQuat(const USGSenseGlovePose* SenseGlovePose)
|
|
{
|
|
return SenseGlovePose->GetThimbleRotationsQ();
|
|
}
|
|
|
|
TArray<FRotator> USGSenseGlovePoseKismetLibrary::GetThimbleRotations_FRotator(const USGSenseGlovePose* SenseGlovePose)
|
|
{
|
|
return SenseGlovePose->GetThimbleRotations();
|
|
}
|
|
|
|
TArray<FVector> USGSenseGlovePoseKismetLibrary::GetTotalGloveAngles(const USGSenseGlovePose* SenseGlovePose)
|
|
{
|
|
return SenseGlovePose->GetTotalGloveAngles();
|
|
}
|
|
|
|
TArray<FVector> USGSenseGlovePoseKismetLibrary::CalculateFingerTips_SenseGloveHandProfileImpl(
|
|
const USGSenseGlovePose* SenseGlovePose, const USGSenseGloveHandProfile* SenseGloveHandProfile)
|
|
{
|
|
return SenseGlovePose->CalculateFingerTips(SenseGloveHandProfile);
|
|
}
|
|
|
|
TArray<FVector> USGSenseGlovePoseKismetLibrary::CalculateFingerTips_FingerOffsets(
|
|
const USGSenseGlovePose* SenseGlovePose, const TArray<FVector>& FingerOffsets)
|
|
{
|
|
return SenseGlovePose->CalculateFingerTips(FingerOffsets);
|
|
}
|
|
|
|
bool USGSenseGlovePoseKismetLibrary::Equals(const USGSenseGlovePose* A, const USGSenseGlovePose* B)
|
|
{
|
|
return A->Equals(B);
|
|
}
|
|
|
|
FString USGSenseGlovePoseKismetLibrary::ToString(const USGSenseGlovePose* SenseGlovePose, const bool bShortFormat)
|
|
{
|
|
return SenseGlovePose->ToString(bShortFormat);
|
|
}
|
|
|
|
FString USGSenseGlovePoseKismetLibrary::SGSerialize(const USGSenseGlovePose* SenseGlovePose)
|
|
{
|
|
return SenseGlovePose->SGSerialize();
|
|
} |