X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=ETL%2Ftrunk%2FETL%2F_rect.h;h=0153f2a76a5351ec0648391407f22b534d8ac0a2;hb=cee5940bae97612105db8b7e1ffcf513f9d9150c;hp=d19959b9af4dfcab4d69c54e2babc51f2ff1c1d8;hpb=dee84efa006428fdfbf0e84b66ee94eb23113ad9;p=synfig.git diff --git a/ETL/trunk/ETL/_rect.h b/ETL/trunk/ETL/_rect.h index d19959b..0153f2a 100644 --- a/ETL/trunk/ETL/_rect.h +++ b/ETL/trunk/ETL/_rect.h @@ -47,48 +47,48 @@ public: //type niceties typedef T value_type; public: //representation - + value_type minx,maxx,miny,maxy; public: //interface - + rect() {} - + rect(const value_type &x1,const value_type &y1) { set_point(x1,y1); } - + rect(const value_type &x1,const value_type &y1, const value_type &x2,const value_type &y2) { set_point(x1,y1); expand(x2,y2); } - + rect(const rect &o) :minx(o.minx),maxx(o.maxx),miny(o.miny),maxy(o.maxy) {} - + template < typename U > rect(const rect &o) :minx(o.minx),maxx(o.maxx),miny(o.miny),maxy(o.maxy) {} - + void set_point(const value_type &x1,const value_type &y1) { minx = maxx = x1; - miny = maxy = y1; + miny = maxy = y1; } - + void expand(const value_type &x1,const value_type &y1) { minx = std::min(minx,x1); maxx = std::max(maxx,x1); miny = std::min(miny,y1); - maxy = std::max(maxy,y1); + maxy = std::max(maxy,y1); } - + void set(const value_type &x1,const value_type &y1, const value_type &x2,const value_type &y2) { @@ -101,7 +101,7 @@ public: //interface { return valid(std::less()); } - + template < typename F > bool valid(const F & func) const { @@ -113,18 +113,18 @@ template < typename T, typename F > inline bool intersect(const rect &r1, const rect &r2, const F & func) { /* We wan to do the edge compare test - |-----| + |-----| |------| intersecting - + |-----| |-----| not intersecting - + So we want to compare the mins of the one against the maxs of the other, and visa versa - + by default (exclude edge sharing) less will not be true if they are equal... */ - + return func(r1.minx,r2.maxx) && func(r2.minx,r1.maxx) && func(r1.miny,r2.maxy) &&