]> git.tdb.fi Git - libs/math.git/blob - source/geometry/rectangle.h
Add basic description for all classes
[libs/math.git] / source / geometry / rectangle.h
1 #ifndef MSP_GEOMETRY_RECTANGLE_H_
2 #define MSP_GEOMETRY_RECTANGLE_H_
3
4 #include "hyperbox.h"
5
6 namespace Msp {
7 namespace Geometry {
8
9 /**
10 The two-dimensional special case of a HyperBox.  This class exists for
11 convenience only and does not provide any extra functionality over the base
12 class.
13 */
14 template<typename T>
15 class Rectangle: public HyperBox<T, 2>
16 {
17 public:
18         Rectangle() { }
19         explicit Rectangle(const LinAl::Vector<T, 2> &d): HyperBox<T, 2>(d) { }
20         Rectangle(T w, T h): HyperBox<T, 2>(LinAl::Vector<T, 2>(w, h)) { }
21
22         T get_width() const { return this->get_dimension(0); }
23         T get_height() const { return this->get_dimension(1); }
24 };
25
26 } // namespace Geometry
27 } // namespace Msp
28
29 #endif