189 lines
9.7 KiB
C++
189 lines
9.7 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
|
|
*
|
|
*
|
|
*/
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "SGKismet/SGBlueprintFunctionLibrary.h"
|
|
#include "SGCore/SGFloatArray.h"
|
|
#include "SGTypes/SGCoreTypes.h"
|
|
|
|
#include "SGBasicHandModelKismetLibrary.generated.h"
|
|
|
|
class USGBasicHandModel;
|
|
|
|
UCLASS(meta=(ScriptName = "SesneGloveBasicHandModelKismetLibrary"))
|
|
class SENSEGLOVECOREKISMET_API USGBasicHandModelKismetLibrary final : public USGBlueprintFunctionLibrary
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGBasicHandModel* MakeBasicHandModel(UObject* WorldContextObject);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Make Basic Hand Model",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGBasicHandModel* MakeBasicHandModel_bRH_L_SP(
|
|
UObject* WorldContextObject,
|
|
bool bRightHanded, const TArray<FSGFloatArray>& Lengths, const TArray<FVector>& StartPositions);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Make Basic Hand Model",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGBasicHandModel* MakeBasicHandModel_bRH_L_SP_TArrayFQuat_SR(
|
|
UObject* WorldContextObject,
|
|
bool bRightHanded, const TArray<FSGFloatArray>& Lengths,
|
|
const TArray<FVector>& StartPositions, const TArray<FQuat>& StartRotations);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Make Basic Hand Model",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGBasicHandModel* MakeBasicHandModel_bRH_L_SP_TArrayFRotator_SR(
|
|
UObject* WorldContextObject,
|
|
bool bRightHanded, const TArray<FSGFloatArray>& Lengths,
|
|
const TArray<FVector>& StartPositions, const TArray<FRotator>& StartRotations);
|
|
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGBasicHandModel* Default(UObject* WorldContextObject, bool bRightHanded);
|
|
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model",
|
|
meta=(WorldContext="WorldContextObject"))
|
|
static USGBasicHandModel* Deserialize(UObject* WorldContextObject, const FString& SerializedString);
|
|
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static TArray<FSGFloatArray> GetBaseFingerLengths();
|
|
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static TArray<FVector> GetBaseJointPositions();
|
|
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static TArray<FVector> GetBaseJointRotations();
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static bool IsRight(const USGBasicHandModel* BasicHandModel);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static TArray<FSGFloatArray> GetFingerLengths(const USGBasicHandModel* BasicHandModel);
|
|
|
|
UFUNCTION(BlueprintPure, DisplayName="Get Finger Lengths",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static TArray<float> GetFingerLengths_F(const USGBasicHandModel* BasicHandModel, ESGFinger Finger);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Set Finger Lengths",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static void SetFingerLengths_ESGFinger_F_L(UPARAM(ref) USGBasicHandModel* BasicHandModel, ESGFinger Finger,
|
|
const TArray<float>& Lengths);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Set Finger Lengths",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static void SetFingerLengths_uint8_F_L(UPARAM(ref) USGBasicHandModel* BasicHandModel, uint8 Finger,
|
|
const TArray<float>& Lengths);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
TArray<FSGFloatArray> GetFingerRatios(const USGBasicHandModel* BasicHandModel) const;
|
|
|
|
UFUNCTION(BlueprintPure, DisplayName="Get Finger Ratios",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static TArray<float> GetFingerRatios_F(const USGBasicHandModel* BasicHandModel, ESGFinger Finger);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static TArray<FVector> GetStartJointPositions(const USGBasicHandModel* BasicHandModel);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Set Start Joint Position",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static void SetStartJointPosition_ESGFinger_F_P(UPARAM(ref) USGBasicHandModel* BasicHandModel, ESGFinger Finger,
|
|
const FVector& Position);
|
|
|
|
UFUNCTION(BlueprintPure, DisplayName="Set Start Joint Position",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static void SetStartJointPosition_uint8_F_P(UPARAM(ref) USGBasicHandModel* BasicHandModel, uint8 Finger,
|
|
const FVector& Position);
|
|
|
|
UFUNCTION(BlueprintPure, DisplayName="Get Start Joint Rotations",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static TArray<FQuat> GetStartJointRotations_TArrayFQuat(const USGBasicHandModel* BasicHandModel);
|
|
|
|
UFUNCTION(BlueprintPure, DisplayName="Get Start Joint Rotations",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static TArray<FRotator> GetStartJointRotations_TArrayFRotator(const USGBasicHandModel* BasicHandModel);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static FVector GetJointPosition(const USGBasicHandModel* BasicHandModel, ESGFinger Finger);
|
|
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static void SetJointPosition(UPARAM(ref) USGBasicHandModel* BasicHandModel, const FVector& NewPosition,
|
|
ESGFinger Finger);
|
|
|
|
UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotation",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static FQuat GetJointRotation_FQuat(const USGBasicHandModel* BasicHandModel, ESGFinger Finger);
|
|
|
|
UFUNCTION(BlueprintPure, DisplayName="Get Joint Rotation",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static FRotator GetJointRotation_FRotator(const USGBasicHandModel* BasicHandModel, ESGFinger Finger);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Set Joint Rotation",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static void SetJointRotation_FQuat_NR_F(
|
|
UPARAM(ref) USGBasicHandModel* BasicHandModel, const FQuat& NewRotation, ESGFinger Finger);
|
|
|
|
UFUNCTION(BlueprintCallable, DisplayName="Set Joint Rotation",
|
|
Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static void SetJointRotation_FRotator_NR_F(
|
|
UPARAM(ref) USGBasicHandModel* BasicHandModel, const FRotator& NewRotation, ESGFinger Finger);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static TArray<float> GetTotalLengths(const USGBasicHandModel* BasicHandModel);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static float GetTotalLength(const USGBasicHandModel* BasicHandModel, ESGFinger Finger);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static TArray<FVector> Get3DLengths(const USGBasicHandModel* BasicHandModel, ESGFinger Finger);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static bool Equals(const USGBasicHandModel* A, const USGBasicHandModel* B);
|
|
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static FString ToString(const USGBasicHandModel* BasicHandModel);
|
|
|
|
UFUNCTION(BlueprintPure, DisplayName="To String", Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static FString ToString_bLO(const USGBasicHandModel* BasicHandModel, bool bLengthsOnly);
|
|
|
|
UFUNCTION(BlueprintPure, DisplayName="Serialize", Category="SenseGlove | Core | Kinematics | Basic Hand Model")
|
|
static FString SGSerialize(const USGBasicHandModel* BasicHandModel);
|
|
}; |