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

#pragma once

#include "SCW_FQuat.h"
#include "SCW_FVector.h"

namespace Sourcify
{
	struct SCW_FTransform
	{
		SCW_FQuat Rotation;
		SCW_FVector Translation;
		SCW_FVector Scale;

		SCW_FTransform() : Rotation(SCW_FQuat::Identity()), Translation(SCW_FVector::Zero()), Scale(SCW_FVector::One()) {}
		SCW_FTransform(const SCW_FQuat& InRotation, const SCW_FVector& InTranslation, const SCW_FVector& InScale) : Rotation(InRotation), Translation(InTranslation), Scale(InScale) {}

		bool operator==(const SCW_FTransform& Other) const
		{
			return Rotation == Other.Rotation && Translation == Other.Translation && Scale == Other.Scale;
		}

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

		bool Equals(const SCW_FTransform& Other, double Tolerance = 1.e-4) const
		{
			return Rotation.Equals(Other.Rotation, Tolerance) && Translation.Equals(Other.Translation, Tolerance) && Scale.Equals(Other.Scale, Tolerance);
		}

		static SCW_FTransform Identity() { return SCW_FTransform{ SCW_FQuat::Identity(), SCW_FVector::Zero(), SCW_FVector::One() }; }

		const SCW_FVector& GetTranslation() const { return Translation; }
		const SCW_FQuat& GetRotation() const { return Rotation; }
		const SCW_FVector& GetScale3D() const { return Scale; }
	};
} // namespace Sourcify
