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