-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsize2.h
More file actions
25 lines (20 loc) · 843 Bytes
/
size2.h
File metadata and controls
25 lines (20 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once
#include <iostream>
#include "math.h"
namespace libMesh {
struct Size2 {
public:
Size2(float width, float height) : width(width), height(height) {}
Size2(const Size2& other) : Size2(other.width, other.height) {}
float width;
float height;
Size2 scale(float scale) {
return Size2(width * scale, height * scale);
}
bool operator ==(const Size2& other) const { return Math::Equals(width, other.width) && Math::Equals(height, other.height); }
bool operator !=(const Size2& other) const { return !(*this == other); }
friend std::ostream& operator <<(std::ostream& os, const Size2& size) {
return os << "Size2(" << size.width << ", " << size.height << ")";
}
};
}