summaryrefslogtreecommitdiff
path: root/include/llmr/util/rect.hpp
blob: 2e142c30185787cba620039b48a758559cc72b69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef LLMR_UTIL_RECT
#define LLMR_UTIL_RECT

namespace llmr {

template <typename T>
struct Rect {
    explicit Rect(T x, T y, T w, T h) : x(x), y(y), w(w), h(h) {}
    T x = 0, y = 0;
    T w = 0, h = 0;

    template <typename Number>
    Rect operator *(Number value) const {
        return Rect(x * value, y * value, w * value, h * value);
    }

    operator bool() const { return w == 0 || h == 0; }
};
}

#endif