26 #ifndef __SYNFIG_RECT_H
27 #define __SYNFIG_RECT_H
45 class Rect :
public etl::rect<Real>
49 using etl::rect<Real>::set_point;
50 using etl::rect<Real>::expand;
51 using etl::rect<Real>::set;
86 Rect(
const value_type &x1,
const value_type &y1,
87 const value_type &x2,
const value_type &y2)
97 Rect&
expand(
const Real& r) { minx-=r; miny-=r; maxx+=r; maxy+=r;
return *
this; }
103 Rect&
set(
const Point& min,
const Point& max) {
set(min[0],min[1],max[0],max[1]);
return *
this; }
108 bool is_inside(
const Point& x) {
return x[0]>minx && x[0]<maxx && x[1]>miny && x[1]<maxy; }
112 return (maxx-minx)*(maxy-miny);
119 minx+=rhs[0]; miny+=rhs[1];
120 maxx+=rhs[0]; maxy+=rhs[1];
126 minx-=rhs[0]; miny-=rhs[1];
127 maxx-=rhs[0]; maxy-=rhs[1];
133 minx*=rhs; miny*=rhs;
134 maxx*=rhs; maxy*=rhs;
141 minx*=rhs; miny*=rhs;
142 maxx*=rhs; maxy*=rhs;
148 if(rhs.
area()>0.00000001 &&
area()>0.00000001)
149 etl::set_intersect(*
this,*
this,rhs);
157 if(rhs.
area()>0.00000001 &&
area()>0.00000001)
158 etl::set_union(*
this,*
this,rhs);
188 {
return Rect(minx*rhs[0], miny*rhs[1], maxx*rhs[0], maxy*rhs[1]); }
190 {
return Rect(minx/rhs[0], miny/rhs[1], maxx/rhs[0], maxy/rhs[1]); }