Added a way to output vec2d in an easy way
This commit is contained in:
parent
d0670178c0
commit
7a5bf13575
5
vec2d.h
5
vec2d.h
@ -2,6 +2,7 @@
|
|||||||
#define VEC2D_H_INCLUDED
|
#define VEC2D_H_INCLUDED
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
class vec2d {
|
class vec2d {
|
||||||
public:
|
public:
|
||||||
@ -67,6 +68,10 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline std::ostream& operator<<(std::ostream& os, vec2d& p) {
|
||||||
|
return os << '(' << p.x << ", " << p.y << ')';
|
||||||
|
}
|
||||||
|
|
||||||
static inline vec2d operator*(double l, const vec2d& v) {
|
static inline vec2d operator*(double l, const vec2d& v) {
|
||||||
return vec2d{v.x * l, v.y * l};
|
return vec2d{v.x * l, v.y * l};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user