28 lines
406 B
C++
28 lines
406 B
C++
|
#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));
|
||
|
}
|
||
|
|