#include "TransformT.h"

TransformT::TransformT()
    : rotation(0.f), position(), scale(1.f, 1.f)
{
}

bool TransformT::IsFast() const
{
    return scale.x == 1.f && scale.y == 1.f && rotation == 0.f;
}

bool TransformT::operator==(const TransformT &rhs) const
{
    return position == rhs.position && rotation == rhs.rotation && scale == rhs.scale;
}

// -------------------------- 加法运算符实现 --------------------------
TransformT TransformT::operator+(const TransformT &rhs) const
{
    TransformT result;
    result.rotation = this->rotation + rhs.rotation;
    result.position = this->position + rhs.position;
    result.scale = this->scale + rhs.scale;
    return result;
}

TransformT TransformT::operator-(const TransformT &rhs) const
{
    TransformT result;
    result.rotation = this->rotation - rhs.rotation;
    result.position = this->position - rhs.position;
    result.scale = this->scale - rhs.scale;
    return result;
}

// -------------------------- 复合赋值运算符实现 --------------------------
TransformT &TransformT::operator+=(const TransformT &rhs)
{
    this->rotation += rhs.rotation;
    this->position += rhs.position;
    this->scale += rhs.scale;
    return *this;
}

TransformT &TransformT::operator-=(const TransformT &rhs)
{
    this->rotation -= rhs.rotation;
    this->position -= rhs.position;
    this->scale -= rhs.scale;
    return *this;
}