Functions added to set the edges/corners of the bounding box directly.
authoralpar
Mon, 30 Jan 2006 09:31:15 +0000
changeset 192712f289d6187f
parent 1926 6a30ef4d10f1
child 1928 2e957d67d7b9
Functions added to set the edges/corners of the bounding box directly.
lemon/xy.h
     1.1 --- a/lemon/xy.h	Sun Jan 29 23:46:05 2006 +0000
     1.2 +++ b/lemon/xy.h	Mon Jan 30 09:31:15 2006 +0000
     1.3 @@ -245,52 +245,112 @@
     1.4          _empty=1;
     1.5        }
     1.6  
     1.7 -      ///Gives back the bottom left corner (if the bounding box is empty, then the return value is not defined) 
     1.8 +      ///\brief Gives back the bottom left corner
     1.9 +      ///(if the bounding box is empty, then the return value is not defined) 
    1.10        xy<T> bottomLeft() const {
    1.11          return bottom_left;
    1.12        }
    1.13  
    1.14 -      ///Gives back the top right corner (if the bounding box is empty, then the return value is not defined) 
    1.15 +      ///\brief Sets the bottom left corner
    1.16 +      ///(should only bee used for non-empty box) 
    1.17 +      void bottomLeft(xy<T> p) {
    1.18 +	bottom_left = p;
    1.19 +      }
    1.20 +
    1.21 +      ///\brief Gives back the top right corner
    1.22 +      ///(if the bounding box is empty, then the return value is not defined) 
    1.23        xy<T> topRight() const {
    1.24          return top_right;
    1.25        }
    1.26  
    1.27 -      ///Gives back the bottom right corner (if the bounding box is empty, then the return value is not defined) 
    1.28 +      ///\brief Sets the top right corner
    1.29 +      ///(should only bee used for non-empty box) 
    1.30 +      void topRight(xy<T> p) {
    1.31 +	top_right = p;
    1.32 +      }
    1.33 +
    1.34 +      ///\brief Gives back the bottom right corner
    1.35 +      ///(if the bounding box is empty, then the return value is not defined) 
    1.36        xy<T> bottomRight() const {
    1.37          return xy<T>(top_right.x,bottom_left.y);
    1.38        }
    1.39  
    1.40 -      ///Gives back the top left corner (if the bounding box is empty, then the return value is not defined) 
    1.41 +      ///\brief Sets the bottom right corner
    1.42 +      ///(should only bee used for non-empty box) 
    1.43 +      void bottomRight(xy<T> p) {
    1.44 +	top_right.x = p.x;
    1.45 +	bottom_left.y = p.y;
    1.46 +      }
    1.47 +
    1.48 +      ///\brief Gives back the top left corner
    1.49 +      ///(if the bounding box is empty, then the return value is not defined) 
    1.50        xy<T> topLeft() const {
    1.51          return xy<T>(bottom_left.x,top_right.y);
    1.52        }
    1.53  
    1.54 -      ///Gives back the bottom of the box (if the bounding box is empty, then the return value is not defined) 
    1.55 +      ///\brief Sets the top left corner
    1.56 +      ///(should only bee used for non-empty box) 
    1.57 +      void topLeft(xy<T> p) {
    1.58 +	top_right.y = p.y;
    1.59 +	bottom_left.x = p.x;
    1.60 +      }
    1.61 +
    1.62 +      ///\brief Gives back the bottom of the box
    1.63 +      ///(if the bounding box is empty, then the return value is not defined) 
    1.64        T bottom() const {
    1.65          return bottom_left.y;
    1.66        }
    1.67  
    1.68 -      ///Gives back the top of the box (if the bounding box is empty, then the return value is not defined) 
    1.69 +      ///\brief Sets the bottom of the box
    1.70 +      ///(should only bee used for non-empty box) 
    1.71 +      void bottom(T t) {
    1.72 +	bottom_left.y = t;
    1.73 +      }
    1.74 +
    1.75 +      ///\brief Gives back the top of the box
    1.76 +      ///(if the bounding box is empty, then the return value is not defined) 
    1.77        T top() const {
    1.78          return top_right.y;
    1.79        }
    1.80  
    1.81 -      ///Gives back the left side of the box (if the bounding box is empty, then the return value is not defined) 
    1.82 +      ///\brief Sets the top of the box
    1.83 +      ///(should only bee used for non-empty box) 
    1.84 +      void top(T t) {
    1.85 +	top_right.y = t;
    1.86 +      }
    1.87 +
    1.88 +      ///\brief Gives back the left side of the box
    1.89 +      ///(if the bounding box is empty, then the return value is not defined) 
    1.90        T left() const {
    1.91          return bottom_left.x;
    1.92        }
    1.93  
    1.94 -      ///Gives back the right side of the box (if the bounding box is empty, then the return value is not defined) 
    1.95 +      ///\brief Sets the left side of the box
    1.96 +      ///(should only bee used for non-empty box) 
    1.97 +      void left(T t) {
    1.98 +	bottom_left.x = t;
    1.99 +      }
   1.100 +
   1.101 +      ///\brief Gives back the right side of the box
   1.102 +      ///(if the bounding box is empty, then the return value is not defined) 
   1.103        T right() const {
   1.104          return top_right.x;
   1.105        }
   1.106  
   1.107 -      ///Gives back the height of the box (if the bounding box is empty, then the return value is not defined) 
   1.108 +      ///\brief Sets the right side of the box
   1.109 +      ///(should only bee used for non-empty box) 
   1.110 +      void right(T t) {
   1.111 +	top_right.x = t;
   1.112 +      }
   1.113 +
   1.114 +      ///\brief Gives back the height of the box
   1.115 +      ///(if the bounding box is empty, then the return value is not defined) 
   1.116        T height() const {
   1.117          return top_right.y-bottom_left.y;
   1.118        }
   1.119  
   1.120 -      ///Gives back the width of the box (if the bounding box is empty, then the return value is not defined) 
   1.121 +      ///\brief Gives back the width of the box
   1.122 +      ///(if the bounding box is empty, then the return value is not defined) 
   1.123        T width() const {
   1.124          return top_right.x-bottom_left.x;
   1.125        }