mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-09-19 01:38:22 +00:00
added vector2d
This commit is contained in:
29
src/helpers/Vector2D.hpp
Normal file
29
src/helpers/Vector2D.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <math.h>
|
||||
|
||||
class Vector2D {
|
||||
public:
|
||||
Vector2D(double, double);
|
||||
Vector2D();
|
||||
~Vector2D();
|
||||
|
||||
double x = 0;
|
||||
double y = 0;
|
||||
|
||||
// returns the scale
|
||||
double normalize();
|
||||
|
||||
Vector2D operator+(Vector2D a) {
|
||||
return Vector2D(this->x + a.x, this->y + a.y);
|
||||
}
|
||||
Vector2D operator-(Vector2D a) {
|
||||
return Vector2D(this->x - a.x, this->y - a.y);
|
||||
}
|
||||
Vector2D operator*(float a) {
|
||||
return Vector2D(this->x * a, this->y * a);
|
||||
}
|
||||
Vector2D operator/(float a) {
|
||||
return Vector2D(this->x / a, this->y / a);
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user