Added == operator to vec2d

This commit is contained in:
Karma Riuk 2023-04-25 12:03:41 +02:00
parent 699490fefc
commit 02f60aaa8a

View File

@ -1,7 +1,10 @@
#ifndef VEC2D_H_INCLUDED
#define VEC2D_H_INCLUDED
#include "cairo.h"
#include <cmath>
#include <iostream>
#include <ostream>
class vec2d {
@ -53,6 +56,10 @@ class vec2d {
return vec2d{x / a, y / a};
}
bool operator==(vec2d& o) const {
return x == o.x && y == o.y;
}
vec2d& rotate(double angle) {
double sin_a = sin(angle);
double cos_a = cos(angle);