First Commit
This commit is contained in:
27
Vector.cpp
Normal file
27
Vector.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#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));
|
||||
}
|
||||
|
Reference in New Issue
Block a user