simulation/Vector.cpp

28 lines
406 B
C++
Raw Normal View History

2022-10-30 23:44:30 +01:00
#include "Vector.h"
#include <math.h>
Vec2 Vec2::operator+(const Vec2 right){
return {x + right.x, y + right.y};
}
Vec2 Vec2::operator*(const Vec2 right){
return {x * right.x, y * right.y};
}
Vec2 Vec2::operator*(const int right){
return {x * right, y * right};
}
Vec2 Vec2::operator/(const int right){
return {x / right, y / right};
}
int Vec2::norm(){
return sqrt(pow(x, 2) + pow(y,2));
}