The spica renderer
bounds2d.h
1 #ifdef _MSC_VER
2 #pragma once
3 #endif
4 
5 #ifndef _SPICA_BOUNDS2D_H_
6 #define _SPICA_BOUNDS2D_H_
7 
8 #include <type_traits>
9 
10 #include "common.h"
11 #include "point2d.h"
12 
13 namespace spica {
14 
15 template <class T>
16 class Bounds2_ {
17 public:
18  // Public methods
19  Bounds2_();
20  Bounds2_(T minx, T miny, T maxx, T maxy);
21  Bounds2_(const Bounds2_<T>& b);
22  ~Bounds2_();
23 
24  Bounds2_<T>& operator=(const Bounds2_<T>& b);
25  inline const Point2_<T>& posMin() const { return posMin_; }
26  inline const Point2_<T>& posMax() const { return posMax_; }
27  inline T width() const { return posMax_.x() - posMin_.x(); }
28  inline T height() const { return posMax_.y() - posMin_.y(); }
29 
30 private:
31  // Private fields
32  Point2_<T> posMin_, posMax_;
33 
34  static_assert(std::is_arithmetic<T>::value,
35  "Template type must be arithmetic!!");
36 
37 }; // class Bounds2_
38 
39 using Bounds2i = Bounds2_<int>;
42 
43 } // namespace spica
44 
45 #include "bounds2d_detail.h"
46 
47 #endif // _SPICA_BOUNDS2D_H_
Definition: core.hpp:62
Definition: bounds2d.h:16