X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=ETL%2Ftrunk%2FETL%2F_rect.h;h=6f506a578144b0a5efdb566b4657f4ab73df5380;hb=e0dedc46e8ab6b258be81887689b0c0fd60def0c;hp=d19959b9af4dfcab4d69c54e2babc51f2ff1c1d8;hpb=b3016b249333ac0ab0008d8c6c4d9029b2ff30c9;p=synfig.git diff --git a/ETL/trunk/ETL/_rect.h b/ETL/trunk/ETL/_rect.h index d19959b..6f506a5 100644 --- a/ETL/trunk/ETL/_rect.h +++ b/ETL/trunk/ETL/_rect.h @@ -1,7 +1,7 @@ /*! ======================================================================== ** Extended Template Library ** Rectangle Basic Class Implementation -** $Id: _rect.h,v 1.1.1.1 2005/01/04 01:31:48 darco Exp $ +** $Id$ ** ** Copyright (c) 2002 Adrian Bentley ** @@ -24,8 +24,8 @@ /* === S T A R T =========================================================== */ -#ifndef __ETL_RECT_H -#define __ETL_RECT_H +#ifndef __ETL__RECT_H +#define __ETL__RECT_H /* === H E A D E R S ======================================================= */ @@ -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) &&