|
@@ -16,19 +16,19 @@ ls::math::vector::Vector2::Vector2(const ls::math::core::type::vector2_component
|
|
|
this->components[1] = _y;
|
|
|
}
|
|
|
|
|
|
-ls::math::vector::Vector2 ls::math::vector::Vector2::operator+(const ls::math::vector::Vector2& _vector)
|
|
|
+ls::math::vector::Vector2 ls::math::vector::Vector2::operator+(const ls::math::vector::Vector2& _vector) const
|
|
|
{
|
|
|
- return ls::math::vector::Vector2{this->components[0] + _vector.components[0], this->components[1] + _vector.components[1]};
|
|
|
+ return ls::math::vector::Vector2::_add(*this, _vector);
|
|
|
}
|
|
|
|
|
|
-ls::math::vector::Vector2 ls::math::vector::Vector2::operator-(const ls::math::vector::Vector2& _vector)
|
|
|
+ls::math::vector::Vector2 ls::math::vector::Vector2::operator-(const ls::math::vector::Vector2& _vector) const
|
|
|
{
|
|
|
- return ls::math::vector::Vector2{this->components[0] - _vector.components[0], this->components[1] - _vector.components[1]};
|
|
|
+ return ls::math::vector::Vector2::_subtract(*this, _vector);
|
|
|
}
|
|
|
|
|
|
-ls::math::core::type::vector_scalar ls::math::vector::Vector2::operator*(const ls::math::vector::Vector2& _vector)
|
|
|
+ls::math::core::type::vector_scalar ls::math::vector::Vector2::operator*(const ls::math::vector::Vector2& _vector) const
|
|
|
{
|
|
|
- return this->components[0] * _vector.components[0] + this->components[1] * _vector.components[1];
|
|
|
+ return ls::math::vector::Vector2::_dot(*this, _vector);
|
|
|
}
|
|
|
|
|
|
ls::math::vector::Vector2 ls::math::vector::Vector2::operator*(double _value)
|
|
@@ -51,6 +51,16 @@ bool ls::math::vector::Vector2::operator!=(const ls::math::vector::Vector2 &_vec
|
|
|
return this->components[0] != _vector.components[0] || this->components[1] != _vector.components[1];
|
|
|
}
|
|
|
|
|
|
+ls::math::vector::Vector2 ls::math::vector::Vector2::add(const ls::math::vector::Vector2 &_leftAddend, const ls::math::vector::Vector2 &_rightAddend)
|
|
|
+{
|
|
|
+ return ls::math::vector::Vector2::_add(_leftAddend, _rightAddend);
|
|
|
+}
|
|
|
+
|
|
|
+ls::math::core::type::vector_scalar ls::math::vector::Vector2::dot(const ls::math::vector::Vector2 &_leftAddend, const ls::math::vector::Vector2 &_rightAddend)
|
|
|
+{
|
|
|
+ return ls::math::vector::Vector2::_dot(_leftAddend, _rightAddend);
|
|
|
+}
|
|
|
+
|
|
|
double ls::math::vector::Vector2::getLength()
|
|
|
{
|
|
|
return ls::math::vector::Vector2::_getLength(this->components[0], this->components[1]);
|
|
@@ -82,6 +92,26 @@ void ls::math::vector::Vector2::setY(const ls::math::core::type::vector2_compone
|
|
|
this->components[1] = _value;
|
|
|
}
|
|
|
|
|
|
+ls::math::vector::Vector2 ls::math::vector::Vector2::subtract(const ls::math::vector::Vector2 &_leftAddend, const ls::math::vector::Vector2 &_rightAddend)
|
|
|
+{
|
|
|
+ return ls::math::vector::Vector2::_subtract(_leftAddend, _rightAddend);
|
|
|
+}
|
|
|
+
|
|
|
+ls::math::vector::Vector2 ls::math::vector::Vector2::_add(const ls::math::vector::Vector2 &_leftAddend, const ls::math::vector::Vector2 &_rightAddend)
|
|
|
+{
|
|
|
+ return ls::math::vector::Vector2{_leftAddend.components[0] + _rightAddend.components[0], _leftAddend.components[1] + _rightAddend.components[1]};
|
|
|
+}
|
|
|
+
|
|
|
+ls::math::core::type::vector_scalar ls::math::vector::Vector2::_dot(const ls::math::vector::Vector2 &_leftAddend, const ls::math::vector::Vector2 &_rightAddend)
|
|
|
+{
|
|
|
+ return _leftAddend.components[0] * _rightAddend.components[0] + _leftAddend.components[1] * _rightAddend.components[1];
|
|
|
+}
|
|
|
+
|
|
|
+ls::math::vector::Vector2 ls::math::vector::Vector2::_subtract(const ls::math::vector::Vector2 &_leftAddend, const ls::math::vector::Vector2 &_rightAddend)
|
|
|
+{
|
|
|
+ return ls::math::vector::Vector2{_leftAddend.components[0] - _rightAddend.components[0], _leftAddend.components[1] - _rightAddend.components[1]};
|
|
|
+}
|
|
|
+
|
|
|
double ls::math::vector::Vector2::_getLength(const ls::math::core::type::vector2_component& _x, const ls::math::core::type::vector2_component& _y)
|
|
|
{
|
|
|
return sqrt(_x * _x + _y * _y);
|