// Copyright (c) 2024 Codemongous LLC. All Rights Reserved.

#pragma once
#include <cmath>

namespace Sourcify
{
	struct SCW_FQuat
	{
		double X;
		double Y;
		double Z;
		double W;

		SCW_FQuat() : X(0.0), Y(0.0), Z(0.0), W(1.0) {}
		SCW_FQuat(double InX, double InY, double InZ, double InW) : X(InX), Y(InY), Z(InZ), W(InW) {}

		bool operator==(const SCW_FQuat& Other) const
		{
			return X == Other.X && Y == Other.Y && Z == Other.Z && W == Other.W;
		}

		bool operator!=(const SCW_FQuat& Other) const
		{
			return !(*this == Other);
		}

		bool Equals(const SCW_FQuat& Other, double Tolerance = 1.e-4) const
		{
			return std::abs(X - Other.X) <= Tolerance && std::abs(Y - Other.Y) <= Tolerance && std::abs(Z - Other.Z) <= Tolerance && std::abs(W - Other.W) <= Tolerance;
		}

		static SCW_FQuat Identity() { return SCW_FQuat{ 0.0, 0.0, 0.0, 1.0 }; }
	};
} // namespace Sourcify
