/*
 * Author:          Patrick-Christopher Mattulat
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2022-08-05
 * Changed:         2022-08-05
 *
 * */

#include <ls-math/vector/Vector2.hpp>

ls::math::vector::Vector2::Vector2(const ls::math::core::type::vector2_component &_x, const ls::math::core::type::vector2_component &_y)
{
  this->components[0] = _x;
  this->components[1] = _y;
}

ls::math::vector::Vector2 ls::math::vector::Vector2::operator+(Vector2 _vector)
{
  ls::math::vector::Vector2 calculatedVector{0, 0};
  calculatedVector.setX(this->components[0] + _vector.getX());
  calculatedVector.setY(this->components[1] + _vector.getY());

  return calculatedVector;
}

ls::math::vector::Vector2 ls::math::vector::Vector2::operator-(ls::math::vector::Vector2 _vector)
{
  ls::math::vector::Vector2 calculatedVector{0, 0};
  calculatedVector.setX(this->components[0] - _vector.getX());
  calculatedVector.setY(this->components[1] - _vector.getY());

  return calculatedVector;
}

ls::math::core::type::vector2_component ls::math::vector::Vector2::getX()
{
  return this->components[0];
}

ls::math::core::type::vector2_component ls::math::vector::Vector2::getY()
{
  return this->components[1];
}

void ls::math::vector::Vector2::setX(const ls::math::core::type::vector2_component &_value)
{
  this->components[0] = _value;
}

void ls::math::vector::Vector2::setY(const ls::math::core::type::vector2_component &_value)
{
  this->components[1] = _value;
}
