]> git.tdb.fi Git - libs/math.git/blobdiff - source/geometry/rectangle.h
Beginnings of a geometry library
[libs/math.git] / source / geometry / rectangle.h
diff --git a/source/geometry/rectangle.h b/source/geometry/rectangle.h
new file mode 100644 (file)
index 0000000..296ba6c
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef MSP_GEOMETRY_RECTANGLE_H_
+#define MSP_GEOMETRY_RECTANGLE_H_
+
+#include <msp/linal/vector2.h>
+#include "hyperbox.h"
+
+namespace Msp {
+namespace Geometry {
+
+template<typename T>
+class Rectangle: public HyperBox<T, 2>
+{
+public:
+       Rectangle() { }
+       explicit Rectangle(const LinAl::Vector<T, 2> &d): HyperBox<T, 2>(d) { }
+       Rectangle(T w, T h): HyperBox<T, 2>(LinAl::Vector2<T>(w, h)) { }
+
+       T get_width() const { return this->get_dimension(0); }
+       T get_height() const { return this->get_dimension(1); }
+};
+
+} // namespace Geometry
+} // namespace Msp
+
+#endif