minor code improvements and clean up

This commit is contained in:
Mamadou Babaei
2023-04-20 15:54:59 +02:00
parent a54d252971
commit da7bc22ed7
@@ -50,18 +50,18 @@ public:
static FORCEINLINE float TransformToSenseGlove(const int32 Movement, const float Direction) static FORCEINLINE float TransformToSenseGlove(const int32 Movement, const float Direction)
{ {
// 0 = twist, 1 = flexion/extension, 2 = abduction // 0 = twist, 1 = flexion/extension, 2 = abduction
return FMath::DegreesToRadians(Movement != 1 ? Direction * -1.0f : Direction); return FMath::DegreesToRadians(Movement != 1 ? -Direction : Direction);
} }
static FORCEINLINE FVector TransformToSenseGlove(const FVector& Vector) static FORCEINLINE FVector TransformToSenseGlove(const FVector& Vector)
{ {
return FMath::DegreesToRadians(FVector(Vector.Y * -1.0f, Vector.X, Vector.Z)); return FMath::DegreesToRadians(FVector(-Vector.Y, Vector.X, Vector.Z));
} }
template<typename V> template<typename V>
static FORCEINLINE V TransformToSenseGlove(const FVector& Vector) static FORCEINLINE V TransformToSenseGlove(const FVector& Vector)
{ {
return FMath::DegreesToRadians(V(Vector.Y * -1.0f, Vector.X, Vector.Z)); return FMath::DegreesToRadians(V(-Vector.Y, Vector.X, Vector.Z));
} }
static FORCEINLINE float TransformToUnreal(const float Radians) static FORCEINLINE float TransformToUnreal(const float Radians)
@@ -75,7 +75,7 @@ public:
/// values require validation. /// values require validation.
// 0 = twist, 1 = flexion/extension, 2 = abduction // 0 = twist, 1 = flexion/extension, 2 = abduction
return Movement != 1 ? Direction * -1.0f : Direction; return Movement != 1 ? -Direction : Direction;
} }
static FORCEINLINE constexpr float TransformToUnreal(const ESGFingerMovement Movement, const float Direction) static FORCEINLINE constexpr float TransformToUnreal(const ESGFingerMovement Movement, const float Direction)
@@ -90,7 +90,7 @@ public:
/// Which flexions should be ignored? /// Which flexions should be ignored?
return (Movement != ESGFingerMovement::McpFlexion && Movement != ESGFingerMovement::PipFlexion && Movement != return (Movement != ESGFingerMovement::McpFlexion && Movement != ESGFingerMovement::PipFlexion && Movement !=
ESGFingerMovement::PipFlexion) ESGFingerMovement::PipFlexion)
? Direction * -1.0f ? -Direction
: Direction; : Direction;
} }
@@ -108,19 +108,19 @@ public:
Movement != ESGThumbMovement::CmcFlexion Movement != ESGThumbMovement::CmcFlexion
&& Movement != ESGThumbMovement::McpFlexion && Movement != ESGThumbMovement::McpFlexion
&& Movement != ESGThumbMovement::IpFlexion && Movement != ESGThumbMovement::IpFlexion
? Direction * -1.0f ? -Direction
: Direction); : Direction);
} }
static FORCEINLINE FVector TransformToUnreal(const FVector& Vector) static FORCEINLINE FVector TransformToUnreal(const FVector& Vector)
{ {
return FMath::RadiansToDegrees(FVector(Vector.Y * -1.0f, Vector.X, Vector.Z)); return FMath::RadiansToDegrees(FVector(-Vector.Y, Vector.X, Vector.Z));
} }
template<typename V> template<typename V>
static FORCEINLINE FVector TransformToUnreal(const V& Vector) static FORCEINLINE FVector TransformToUnreal(const V& Vector)
{ {
return FMath::RadiansToDegrees(FVector(Vector.GetY() * -1.0f, Vector.GetX(), Vector.GetZ())); return FMath::RadiansToDegrees(FVector(-Vector.GetY(), Vector.GetX(), Vector.GetZ()));
} }
public: public: