diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-01-20 11:35:29 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-01-20 11:35:29 +0100 |
commit | 15d43272290901fd7ddd8a67c5e2197adc8c15b7 (patch) | |
tree | d3f0b55d9aa4666a7ba10d20e0ce53d1e3040793 /include/llmr/util/vec.hpp | |
parent | 5aa22b9c3248a235efb36a062d10e8a59fb434f9 (diff) | |
download | qtlocation-mapboxgl-15d43272290901fd7ddd8a67c5e2197adc8c15b7.tar.gz |
rename + move to c++
Diffstat (limited to 'include/llmr/util/vec.hpp')
-rw-r--r-- | include/llmr/util/vec.hpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/llmr/util/vec.hpp b/include/llmr/util/vec.hpp new file mode 100644 index 0000000000..782573d7fd --- /dev/null +++ b/include/llmr/util/vec.hpp @@ -0,0 +1,49 @@ +#ifndef llmr_util_vec2_ +#define llmr_util_vec2_ + +namespace llmr { + +template <typename T = double> +struct vec2 { + T x, y; + + inline vec2() {} + inline vec2(const vec2& o) : x(o.x), y(o.y) {} + inline vec2(T x, T y) : x(x), y(y) {} + inline bool operator==(const vec2& rhs) const { + return x == rhs.x && y == rhs.y; + } +}; + +template <typename T = double> +struct vec3 { + T x, y, z; + + inline vec3() {} + inline vec3(const vec3& o) : x(o.x), y(o.y), z(o.z) {} + inline vec3(T x, T y, T z) : x(x), y(y), z(z) {} + inline bool operator==(const vec3& rhs) const { + return x == rhs.x && y == rhs.y && z == rhs.z; + } +}; + +template <typename T = double> +struct vec4 { + T x, y, z, w; + + inline vec4() {} + inline vec4(const vec4& o) : x(o.x), y(o.y), z(o.z), w(o.w) {} + inline vec4(T x, T y, T z, T w) : x(x), y(y), z(z), w(w) {} + inline bool operator==(const vec4& rhs) const { + return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w; + } +}; + + +struct box { + vec2<double> tl, tr, bl, br; +}; + +} + +#endif |