lemon/dim2.h
changeset 2517 d9cfac072869
parent 2391 14a343be7a5a
child 2553 bfced05fa852
equal deleted inserted replaced
4:b570b31559ed 5:4ad3e6d305f3
   270   /// A class to calculate or store the bounding box of plainvectors.
   270   /// A class to calculate or store the bounding box of plainvectors.
   271 
   271 
   272   /// A class to calculate or store the bounding box of plainvectors.
   272   /// A class to calculate or store the bounding box of plainvectors.
   273   ///
   273   ///
   274   ///\author Attila Bernath
   274   ///\author Attila Bernath
   275   template<typename T>
   275     template<typename T>
   276     class BoundingBox {
   276     class BoundingBox {
   277       Point<T> bottom_left, top_right;
   277       Point<T> bottom_left, top_right;
   278       bool _empty;
   278       bool _empty;
   279     public:
   279     public:
   280       
   280       
   281       ///Default constructor: creates an empty bounding box
   281       ///Default constructor: creates an empty bounding box
   282       BoundingBox() { _empty = true; }
   282       BoundingBox() { _empty = true; }
   283 
   283 
   284       ///Construct an instance from one point
   284       ///Construct an instance from one point
   285       BoundingBox(Point<T> a) { bottom_left=top_right=a; _empty = false; }
   285       BoundingBox(Point<T> a) { bottom_left=top_right=a; _empty = false; }
   286 
   286       
       
   287       ///Construct an instance from two points
       
   288       
       
   289       ///Construct an instance from two points
       
   290       ///\warning The coordinates of the bottom-left corner must be no more
       
   291       ///than those of the top-right one
       
   292       BoundingBox(Point<T> a,Point<T> b)
       
   293       {
       
   294 	bottom_left=a;
       
   295 	top_right=b;
       
   296 	_empty = false;
       
   297       }
       
   298       
       
   299       ///Construct an instance from four numbers
       
   300 
       
   301       ///Construct an instance from four numbers
       
   302       ///\warning The coordinates of the bottom-left corner must be no more
       
   303       ///than those of the top-right one
       
   304       BoundingBox(T l,T b,T r,T t)
       
   305       {
       
   306 	bottom_left=Point<T>(l,b);
       
   307 	top_right=Point<T>(r,t);
       
   308 	_empty = false;
       
   309       }
       
   310       
   287       ///Were any points added?
   311       ///Were any points added?
   288       bool empty() const {
   312       bool empty() const {
   289         return _empty;
   313         return _empty;
   290       }
   314       }
   291 
   315       
   292       ///Make the BoundingBox empty
   316       ///Make the BoundingBox empty
   293       void clear() {
   317       void clear() {
   294         _empty=1;
   318         _empty=1;
   295       }
   319       }
   296 
   320