36 Rect(
const T &x_in,
const T &y_in,
const T &width_in,
const T &height_in)
56 p.
x = this->
x + this->
width / 2;
62 this->
x = p.
x - this->
width / 2;
70 ss <<
"[ " <<
width <<
" x " <<
height <<
" ] from ( " <<
x <<
" , " <<
y
77 T r1_xmax = rect1.
x + rect1.
width;
79 T r1_ymax = rect1.
y + rect1.
height;
81 T r2_xmax = rect2.
x + rect2.
width;
83 T r2_ymax = rect2.
y + rect2.
height;
84 if (r2_xmin <= r1_xmax && r2_xmax >= r1_xmin && r2_ymin <= r1_ymax &&
86 T xmin = std::max(r1_xmin, r2_xmin);
87 T ymin = std::max(r1_ymin, r2_ymin);
88 T xmax = std::min(r1_xmax, r2_xmax);
89 T ymax = std::min(r1_ymax, r2_ymax);
90 return Rect<T>(xmin, ymin, xmax - xmin, ymax - ymin);
98 ret.
x = std::min(rect1.
x, rect2.
x);
99 ret.
y = std::min(rect1.
y, rect2.
y);
114 return !(rect1 == rect2);
127 BBox2D(
const T &xmin_in,
const T &ymin_in,
const T &xmax_in,
const T &ymax_in)
std::enable_if< std::is_integral< T >::value, bool >::type Equal(const T &lhs, const T &rhs)
BBox2D(const Rect< T > &rect)
BBox2D< T > & operator=(const Rect< T > &rect)
Point2D< T > Center() const
BBox2D(const T &xmin_in, const T &ymin_in, const T &xmax_in, const T &ymax_in)
Rect(const T &x_in, const T &y_in, const T &width_in, const T &height_in)
friend bool operator==(const Rect &rect1, const Rect &rect2)
void SetCenter(Point2D< T > p)
Rect(const BBox2D< T > &bbox)
Point2D< T > Center() const
Rect< T > & operator=(const BBox2D< T > &bbox)
std::string ToStr() const
friend Rect< T > operator&(const Rect< T > &rect1, const Rect< T > &rect2)
friend Rect< T > operator|(const Rect< T > &rect1, const Rect< T > &rect2)
friend bool operator!=(const Rect &rect1, const Rect &rect2)