36 #include <boost/archive/text_oarchive.hpp> 37 #include <boost/archive/text_iarchive.hpp> 42 friend class boost::serialization::access;
43 template<
typename Archive>
60 minX = std::min(p1.
x, p2.
x);
61 minY = std::min(p1.
y, p2.
y);
62 maxX = std::max(p1.
x, p2.
x);
63 maxY = std::max(p1.
y, p2.
y);
81 , maxX(minCoord.x + width)
82 , maxY(minCoord.y + height)
88 return basic_rect<T>(minX + dx, minY + dy, maxX + dx, maxY + dy);
93 return basic_rect<T>(minX - dx, minY - dy, maxX + dx, maxY + dy);
98 minX = std::min(minX, other.
minX);
99 maxX = std::max(maxX, other.
maxX);
100 minY = std::min(minY, other.
minY);
101 maxY = std::max(maxY, other.
maxY);
106 minX = std::min(minX, other.
x);
107 maxX = std::max(maxX, other.
x);
108 minY = std::min(minY, other.
y);
109 maxY = std::max(maxY, other.
y);
113 return (maxY - minY) * (maxX -
minX);
121 T x0 = std::max(other.
minX, minX);
122 T y0 = std::max(other.
minY, minY);
123 T x1 = std::min(other.
maxX, maxX);
124 T y1 = std::min(other.
maxY, maxY);
125 if (x0 >= x1 || y0 >= y1)
155 return (maxX - minX);
159 return (maxY - minY);
163 inline bool between(
const T& min,
const T& value,
const T& max)
const 166 return (min <= value && value <= max);
basic_rect< double > FloatRect
basic_rect< coord_t > FixedRect
void serialize(Archive &ar, const unsigned int version)
bool intersects(const basic_rect< T > &bounding) const
void enclose(const basic_vector2< T > &other)
bool contains(const basic_vector2< T > &p) const
bool contains(const basic_rect< T > &other) const
bool operator==(const basic_rect< T > &a, const basic_rect< T > &b)
basic_rect(const basic_vector2< T > &minCoord, T width, T height)
basic_rect< T > grow(T dx, T dy) const
basic_rect(T minX, T minY, T maxX, T maxY)
void enclose(const basic_rect< T > &other)
basic_rect< T > translate(T dx, T dy) const
bool between(const T &min, const T &value, const T &max) const
basic_rect< T > getIntersection(const basic_rect< T > &other) const
bool operator!=(const basic_rect< T > &a, const basic_rect< T > &b)
basic_rect(const basic_vector2< T > &p1, const basic_vector2< T > &p2)
basic_vector2< T > getCenter() const