Two new constructors added to dim2::BoundingBox
authoralpar
Tue, 05 Jun 2007 17:29:46 +0000
changeset 2451d7b7048e045b
parent 2450 719220885b90
child 2452 24887f3a35ec
Two new constructors added to dim2::BoundingBox
lemon/dim2.h
     1.1 --- a/lemon/dim2.h	Tue Jun 05 17:27:54 2007 +0000
     1.2 +++ b/lemon/dim2.h	Tue Jun 05 17:29:46 2007 +0000
     1.3 @@ -272,7 +272,7 @@
     1.4    /// A class to calculate or store the bounding box of plainvectors.
     1.5    ///
     1.6    ///\author Attila Bernath
     1.7 -  template<typename T>
     1.8 +    template<typename T>
     1.9      class BoundingBox {
    1.10        Point<T> bottom_left, top_right;
    1.11        bool _empty;
    1.12 @@ -283,12 +283,36 @@
    1.13  
    1.14        ///Construct an instance from one point
    1.15        BoundingBox(Point<T> a) { bottom_left=top_right=a; _empty = false; }
    1.16 +      
    1.17 +      ///Construct an instance from two points
    1.18 +      
    1.19 +      ///Construct an instance from two points
    1.20 +      ///\warning The coordinates of the bottom-left corner must be no more
    1.21 +      ///than those of the top-right one
    1.22 +      BoundingBox(Point<T> a,Point<T> b)
    1.23 +      {
    1.24 +	bottom_left=a;
    1.25 +	top_right=b;
    1.26 +	_empty = false;
    1.27 +      }
    1.28 +      
    1.29 +      ///Construct an instance from four numbers
    1.30  
    1.31 +      ///Construct an instance from four numbers
    1.32 +      ///\warning The coordinates of the bottom-left corner must be no more
    1.33 +      ///than those of the top-right one
    1.34 +      BoundingBox(T l,T b,T r,T t)
    1.35 +      {
    1.36 +	bottom_left=Point<T>(l,b);
    1.37 +	top_right=Point<T>(r,t);
    1.38 +	_empty = false;
    1.39 +      }
    1.40 +      
    1.41        ///Were any points added?
    1.42        bool empty() const {
    1.43          return _empty;
    1.44        }
    1.45 -
    1.46 +      
    1.47        ///Make the BoundingBox empty
    1.48        void clear() {
    1.49          _empty=1;