COIN-OR::LEMON - Graph Library

Changeset 1426:91eb70983697 in lemon-0.x


Ignore:
Timestamp:
05/18/05 11:39:06 (19 years ago)
Author:
Akos Ladanyi
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1897
Message:
  • minor corrections in the docs
  • fixed indenting
Location:
src/lemon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/concept/graph.h

    r1367 r1426  
    3737
    3838
    39     /// \brief Modular builded static graph class.
     39    /// \brief Modular static graph class.
    4040    ///     
    4141    /// It should be the same as the \c StaticGraph class.
    4242    class _StaticGraph
    4343      :  virtual public BaseGraphComponent,
    44         public IterableGraphComponent, public MappableGraphComponent {
     44        public IterableGraphComponent, public MappableGraphComponent {
    4545    public:
    4646      typedef BaseGraphComponent::Node Node;
     
    4949      template <typename _Graph>
    5050      struct Constraints {
    51         void constraints() {
    52           checkConcept<IterableGraphComponent, _Graph>();
    53           checkConcept<MappableGraphComponent, _Graph>();
    54         }
     51        void constraints() {
     52          checkConcept<IterableGraphComponent, _Graph>();
     53          checkConcept<MappableGraphComponent, _Graph>();
     54        }
    5555      };
    5656    };
    5757
    58     /// \brief Modular builded extendable graph class.
     58    /// \brief Modular extendable graph class.
    5959    ///     
    6060    /// It should be the same as the \c ExtendableGraph class.
    6161    class _ExtendableGraph
    6262      :  virtual public BaseGraphComponent, public _StaticGraph,
    63         public ExtendableGraphComponent, public ClearableGraphComponent {
     63        public ExtendableGraphComponent, public ClearableGraphComponent {
    6464    public:
    6565      typedef BaseGraphComponent::Node Node;
     
    6868      template <typename _Graph>
    6969      struct Constraints {
    70         void constraints() {
    71           checkConcept<_StaticGraph, _Graph >();
    72           checkConcept<ExtendableGraphComponent, _Graph >();
    73           checkConcept<ClearableGraphComponent, _Graph >();
    74         }
     70        void constraints() {
     71          checkConcept<_StaticGraph, _Graph >();
     72          checkConcept<ExtendableGraphComponent, _Graph >();
     73          checkConcept<ClearableGraphComponent, _Graph >();
     74        }
    7575      };
    7676    };
    7777
    78     /// \brief Modular builded erasable graph class.
     78    /// \brief Modular erasable graph class.
    7979    ///     
    8080    /// It should be the same as the \c ErasableGraph class.
    8181    class _ErasableGraph
    8282      :  virtual public BaseGraphComponent, public _ExtendableGraph,
    83         public ErasableGraphComponent {
     83        public ErasableGraphComponent {
    8484    public:
    8585      typedef BaseGraphComponent::Node Node;
     
    8888      template <typename _Graph>
    8989      struct Constraints {
    90         void constraints() {
    91           checkConcept<_ExtendableGraph, _Graph >();
    92           checkConcept<ErasableGraphComponent, _Graph >();
    93         }
     90        void constraints() {
     91          checkConcept<_ExtendableGraph, _Graph >();
     92          checkConcept<ErasableGraphComponent, _Graph >();
     93        }
    9494      };
    9595    };
     
    136136      class Node {
    137137      public:
    138         /// Default constructor
    139 
    140         /// @warning The default constructor sets the iterator
    141         /// to an undefined value.
    142         Node() { }
    143         /// Copy constructor.
    144 
    145         /// Copy constructor.
    146         ///
    147         Node(const Node&) { }
    148 
    149         /// Invalid constructor \& conversion.
    150 
    151         /// This constructor initializes the iterator to be invalid.
    152         /// \sa Invalid for more details.
    153         Node(Invalid) { }
    154         /// Equality operator
    155 
    156         /// Two iterators are equal if and only if they point to the
    157         /// same object or both are invalid.
    158         bool operator==(Node) const { return true; }
    159 
    160         /// Inequality operator
    161        
    162         /// \sa operator==(Node n)
    163         ///
    164         bool operator!=(Node) const { return true; }
     138        /// Default constructor
     139
     140        /// @warning The default constructor sets the iterator
     141        /// to an undefined value.
     142        Node() { }
     143        /// Copy constructor.
     144
     145        /// Copy constructor.
     146        ///
     147        Node(const Node&) { }
     148
     149        /// Invalid constructor \& conversion.
     150
     151        /// This constructor initializes the iterator to be invalid.
     152        /// \sa Invalid for more details.
     153        Node(Invalid) { }
     154        /// Equality operator
     155
     156        /// Two iterators are equal if and only if they point to the
     157        /// same object or both are invalid.
     158        bool operator==(Node) const { return true; }
     159
     160        /// Inequality operator
     161       
     162        /// \sa operator==(Node n)
     163        ///
     164        bool operator!=(Node) const { return true; }
    165165
    166166      };
     
    173173      /// \code
    174174      /// int count=0;
    175       /// for (Graph::NodeIt n(g); n!=INVALID ++n) ++count;
     175      /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
    176176      /// \endcode
    177177      class NodeIt : public Node {
    178178      public:
    179         /// Default constructor
    180 
    181         /// @warning The default constructor sets the iterator
    182         /// to an undefined value.
    183         NodeIt() { }
    184         /// Copy constructor.
    185        
    186         /// Copy constructor.
    187         ///
    188         NodeIt(const NodeIt& n) : Node(n) { }
    189         /// Invalid constructor \& conversion.
    190 
    191         /// Initialize the iterator to be invalid.
    192         /// \sa Invalid for more details.
    193         NodeIt(Invalid) { }
    194         /// Sets the iterator to the first node.
    195 
    196         /// Sets the iterator to the first node of \c g.
    197         ///
    198         NodeIt(const StaticGraph&) { }
    199         /// Node -> NodeIt conversion.
    200 
    201         /// Sets the iterator to the node of \c g pointed by the trivial
    202         /// iterator n.
    203         /// This feature necessitates that each time we
    204         /// iterate the edge-set, the iteration order is the same.
    205         NodeIt(const StaticGraph& g, const Node& n) { }
    206         /// Next node.
    207 
    208         /// Assign the iterator to the next node.
    209         ///
    210         NodeIt& operator++() { return *this; }
     179        /// Default constructor
     180
     181        /// @warning The default constructor sets the iterator
     182        /// to an undefined value.
     183        NodeIt() { }
     184        /// Copy constructor.
     185       
     186        /// Copy constructor.
     187        ///
     188        NodeIt(const NodeIt& n) : Node(n) { }
     189        /// Invalid constructor \& conversion.
     190
     191        /// Initialize the iterator to be invalid.
     192        /// \sa Invalid for more details.
     193        NodeIt(Invalid) { }
     194        /// Sets the iterator to the first node.
     195
     196        /// Sets the iterator to the first node of \c g.
     197        ///
     198        NodeIt(const StaticGraph&) { }
     199        /// Node -> NodeIt conversion.
     200
     201        /// Sets the iterator to the node of \c g pointed by the trivial
     202        /// iterator n.
     203        /// This feature necessitates that each time we
     204        /// iterate the edge-set, the iteration order is the same.
     205        NodeIt(const StaticGraph& g, const Node& n) { }
     206        /// Next node.
     207
     208        /// Assign the iterator to the next node.
     209        ///
     210        NodeIt& operator++() { return *this; }
    211211      };
    212212   
     
    218218      class Edge {
    219219      public:
    220         /// Default constructor
    221 
    222         /// @warning The default constructor sets the iterator
    223         /// to an undefined value.
    224         Edge() { }
    225         /// Copy constructor.
    226 
    227         /// Copy constructor.
    228         ///
    229         Edge(const Edge&) { }
    230         /// Initialize the iterator to be invalid.
    231 
    232         /// Initialize the iterator to be invalid.
    233         ///
    234         Edge(Invalid) { }
    235         /// Equality operator
    236 
    237         /// Two iterators are equal if and only if they point to the
    238         /// same object or both are invalid.
    239         bool operator==(Edge) const { return true; }
    240         /// Inequality operator
    241 
    242         /// \sa operator==(Node n)
    243         ///
    244         bool operator!=(Edge) const { return true; }
     220        /// Default constructor
     221
     222        /// @warning The default constructor sets the iterator
     223        /// to an undefined value.
     224        Edge() { }
     225        /// Copy constructor.
     226
     227        /// Copy constructor.
     228        ///
     229        Edge(const Edge&) { }
     230        /// Initialize the iterator to be invalid.
     231
     232        /// Initialize the iterator to be invalid.
     233        ///
     234        Edge(Invalid) { }
     235        /// Equality operator
     236
     237        /// Two iterators are equal if and only if they point to the
     238        /// same object or both are invalid.
     239        bool operator==(Edge) const { return true; }
     240        /// Inequality operator
     241
     242        /// \sa operator==(Node n)
     243        ///
     244        bool operator!=(Edge) const { return true; }
    245245      };
    246246   
     
    259259      class OutEdgeIt : public Edge {
    260260      public:
    261         /// Default constructor
    262 
    263         /// @warning The default constructor sets the iterator
    264         /// to an undefined value.
    265         OutEdgeIt() { }
    266         /// Copy constructor.
    267 
    268         /// Copy constructor.
    269         ///
    270         OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
    271         /// Initialize the iterator to be invalid.
    272 
    273         /// Initialize the iterator to be invalid.
    274         ///
    275         OutEdgeIt(Invalid) { }
    276         /// This constructor sets the iterator to first outgoing edge.
    277    
    278         /// This constructor set the iterator to the first outgoing edge of
    279         /// node
    280         ///@param n the node
    281         ///@param g the graph
    282         OutEdgeIt(const StaticGraph&, const Node&) { }
    283         /// Edge -> OutEdgeIt conversion
    284 
    285         /// Sets the iterator to the value of the trivial iterator \c e.
    286         /// This feature necessitates that each time we
    287         /// iterate the edge-set, the iteration order is the same.
    288         OutEdgeIt(const StaticGraph& g, const Edge& e) { }
    289         ///Next outgoing edge
    290        
    291         /// Assign the iterator to the next
    292         /// outgoing edge of the corresponding node.
    293         OutEdgeIt& operator++() { return *this; }
     261        /// Default constructor
     262
     263        /// @warning The default constructor sets the iterator
     264        /// to an undefined value.
     265        OutEdgeIt() { }
     266        /// Copy constructor.
     267
     268        /// Copy constructor.
     269        ///
     270        OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
     271        /// Initialize the iterator to be invalid.
     272
     273        /// Initialize the iterator to be invalid.
     274        ///
     275        OutEdgeIt(Invalid) { }
     276        /// This constructor sets the iterator to the first outgoing edge.
     277   
     278        /// This constructor sets the iterator to the first outgoing edge of
     279        /// the node.
     280        ///@param n the node
     281        ///@param g the graph
     282        OutEdgeIt(const StaticGraph&, const Node&) { }
     283        /// Edge -> OutEdgeIt conversion
     284
     285        /// Sets the iterator to the value of the trivial iterator \c e.
     286        /// This feature necessitates that each time we
     287        /// iterate the edge-set, the iteration order is the same.
     288        OutEdgeIt(const StaticGraph& g, const Edge& e) { }
     289        ///Next outgoing edge
     290       
     291        /// Assign the iterator to the next
     292        /// outgoing edge of the corresponding node.
     293        OutEdgeIt& operator++() { return *this; }
    294294      };
    295295
     
    308308      class InEdgeIt : public Edge {
    309309      public:
    310         /// Default constructor
    311 
    312         /// @warning The default constructor sets the iterator
    313         /// to an undefined value.
    314         InEdgeIt() { }
    315         /// Copy constructor.
    316 
    317         /// Copy constructor.
    318         ///
    319         InEdgeIt(const InEdgeIt& e) : Edge(e) { }
    320         /// Initialize the iterator to be invalid.
    321 
    322         /// Initialize the iterator to be invalid.
    323         ///
    324         InEdgeIt(Invalid) { }
    325         /// This constructor sets the iterator to first incoming edge.
    326    
    327         /// This constructor set the iterator to the first incoming edge of
    328         /// node
    329         ///@param n the node
    330         ///@param g the graph
    331         InEdgeIt(const StaticGraph&, const Node&) { }
    332         /// Edge -> InEdgeIt conversion
    333 
    334         /// Sets the iterator to the value of the trivial iterator \c e.
    335         /// This feature necessitates that each time we
    336         /// iterate the edge-set, the iteration order is the same.
    337         InEdgeIt(const StaticGraph&, const Edge&) { }
    338         /// Next incoming edge
    339 
    340         /// Assign the iterator to the next inedge of the corresponding node.
    341         ///
    342         InEdgeIt& operator++() { return *this; }
     310        /// Default constructor
     311
     312        /// @warning The default constructor sets the iterator
     313        /// to an undefined value.
     314        InEdgeIt() { }
     315        /// Copy constructor.
     316
     317        /// Copy constructor.
     318        ///
     319        InEdgeIt(const InEdgeIt& e) : Edge(e) { }
     320        /// Initialize the iterator to be invalid.
     321
     322        /// Initialize the iterator to be invalid.
     323        ///
     324        InEdgeIt(Invalid) { }
     325        /// This constructor sets the iterator to first incoming edge.
     326   
     327        /// This constructor set the iterator to the first incoming edge of
     328        /// the node.
     329        ///@param n the node
     330        ///@param g the graph
     331        InEdgeIt(const StaticGraph&, const Node&) { }
     332        /// Edge -> InEdgeIt conversion
     333
     334        /// Sets the iterator to the value of the trivial iterator \c e.
     335        /// This feature necessitates that each time we
     336        /// iterate the edge-set, the iteration order is the same.
     337        InEdgeIt(const StaticGraph&, const Edge&) { }
     338        /// Next incoming edge
     339
     340        /// Assign the iterator to the next inedge of the corresponding node.
     341        ///
     342        InEdgeIt& operator++() { return *this; }
    343343      };
    344344      /// This iterator goes through each edge.
     
    353353      class EdgeIt : public Edge {
    354354      public:
    355         /// Default constructor
    356 
    357         /// @warning The default constructor sets the iterator
    358         /// to an undefined value.
    359         EdgeIt() { }
    360         /// Copy constructor.
    361 
    362         /// Copy constructor.
    363         ///
    364         EdgeIt(const EdgeIt& e) : Edge(e) { }
    365         /// Initialize the iterator to be invalid.
    366 
    367         /// Initialize the iterator to be invalid.
    368         ///
    369         EdgeIt(Invalid) { }
    370         /// This constructor sets the iterator to first edge.
    371    
    372         /// This constructor set the iterator to the first edge of
    373         /// node
    374         ///@param g the graph
    375         EdgeIt(const StaticGraph&) { }
    376         /// Edge -> EdgeIt conversion
    377 
    378         /// Sets the iterator to the value of the trivial iterator \c e.
    379         /// This feature necessitates that each time we
    380         /// iterate the edge-set, the iteration order is the same.
    381         EdgeIt(const StaticGraph&, const Edge&) { }
    382         ///Next edge
    383        
    384         /// Assign the iterator to the next
    385         /// edge of the corresponding node.
    386         EdgeIt& operator++() { return *this; }
     355        /// Default constructor
     356
     357        /// @warning The default constructor sets the iterator
     358        /// to an undefined value.
     359        EdgeIt() { }
     360        /// Copy constructor.
     361
     362        /// Copy constructor.
     363        ///
     364        EdgeIt(const EdgeIt& e) : Edge(e) { }
     365        /// Initialize the iterator to be invalid.
     366
     367        /// Initialize the iterator to be invalid.
     368        ///
     369        EdgeIt(Invalid) { }
     370        /// This constructor sets the iterator to the first edge.
     371   
     372        /// This constructor sets the iterator to the first edge of \c g.
     373        ///@param g the graph
     374        EdgeIt(const StaticGraph&) { }
     375        /// Edge -> EdgeIt conversion
     376
     377        /// Sets the iterator to the value of the trivial iterator \c e.
     378        /// This feature necessitates that each time we
     379        /// iterate the edge-set, the iteration order is the same.
     380        EdgeIt(const StaticGraph&, const Edge&) { }
     381        ///Next edge
     382       
     383        /// Assign the iterator to the next edge.
     384        EdgeIt& operator++() { return *this; }
    387385      };
    388386      ///Gives back the target node of an edge.
     
    408406      public:
    409407
    410         ///\e
    411         NodeMap(const StaticGraph&) { }
    412         ///\e
    413         NodeMap(const StaticGraph&, T) { }
    414 
    415         ///Copy constructor
    416         NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
    417         ///Assignment operator
    418         NodeMap& operator=(const NodeMap&) { return *this; }
    419         // \todo fix this concept
     408        ///\e
     409        NodeMap(const StaticGraph&) { }
     410        ///\e
     411        NodeMap(const StaticGraph&, T) { }
     412
     413        ///Copy constructor
     414        NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
     415        ///Assignment operator
     416        NodeMap& operator=(const NodeMap&) { return *this; }
     417        // \todo fix this concept
    420418      };
    421419
     
    432430      public:
    433431
    434         ///\e
    435         EdgeMap(const StaticGraph&) { }
    436         ///\e
    437         EdgeMap(const StaticGraph&, T) { }
    438         ///Copy constructor
    439         EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
    440         ///Assignment operator
    441         EdgeMap& operator=(const EdgeMap&) { return *this; }
    442         // \todo fix this concept   
     432        ///\e
     433        EdgeMap(const StaticGraph&) { }
     434        ///\e
     435        EdgeMap(const StaticGraph&, T) { }
     436        ///Copy constructor
     437        EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
     438        ///Assignment operator
     439        EdgeMap& operator=(const EdgeMap&) { return *this; }
     440        // \todo fix this concept   
    443441      };
    444442
     
    450448    /// An empty non-static graph class.
    451449   
    452     /// This class provides everything that \ref StaticGraph
    453     /// with additional functionality which enables to build a
    454     /// graph from scratch.
     450    /// This class provides everything that \ref StaticGraph does.
     451    /// Additionally it enables building graphs from scratch.
    455452    class ExtendableGraph : public StaticGraph
    456453    {
     
    487484    /// An empty erasable graph class.
    488485 
    489     /// This class is an extension of \ref ExtendableGraph. It also makes it
     486    /// This class is an extension of \ref ExtendableGraph. It makes it
    490487    /// possible to erase edges or nodes.
    491488    class ErasableGraph : public ExtendableGraph
  • src/lemon/xy.h

    r1420 r1426  
    3030///
    3131/// The class \ref lemon::BoundingBox "BoundingBox" can be used to determine
    32 /// the rectangular bounding box a set of \ref lemon::xy "xy"'s.
     32/// the rectangular bounding box of a set of \ref lemon::xy "xy"'s.
    3333///
    3434///\author Attila Bernath
     
    6868      ///Gives back the square of the norm of the vector
    6969      T normSquare() const {
    70         return x*x+y*y;
     70        return x*x+y*y;
    7171      }
    7272 
    7373      ///Increments the left hand side by u
    7474      xy<T>& operator +=(const xy<T>& u) {
    75         x += u.x;
    76         y += u.y;
    77         return *this;
     75        x += u.x;
     76        y += u.y;
     77        return *this;
    7878      }
    7979 
    8080      ///Decrements the left hand side by u
    8181      xy<T>& operator -=(const xy<T>& u) {
    82         x -= u.x;
    83         y -= u.y;
    84         return *this;
     82        x -= u.x;
     83        y -= u.y;
     84        return *this;
    8585      }
    8686
    8787      ///Multiplying the left hand side with a scalar
    8888      xy<T>& operator *=(const T &u) {
    89         x *= u;
    90         y *= u;
    91         return *this;
     89        x *= u;
     90        y *= u;
     91        return *this;
    9292      }
    9393
    9494      ///Dividing the left hand side by a scalar
    9595      xy<T>& operator /=(const T &u) {
    96         x /= u;
    97         y /= u;
    98         return *this;
     96        x /= u;
     97        y /= u;
     98        return *this;
    9999      }
    100100 
    101101      ///Returns the scalar product of two vectors
    102102      T operator *(const xy<T>& u) const {
    103         return x*u.x+y*u.y;
     103        return x*u.x+y*u.y;
    104104      }
    105105 
    106106      ///Returns the sum of two vectors
    107107      xy<T> operator+(const xy<T> &u) const {
    108         xy<T> b=*this;
    109         return b+=u;
     108        xy<T> b=*this;
     109        return b+=u;
    110110      }
    111111
    112112      ///Returns the neg of the vectors
    113113      xy<T> operator-() const {
    114         xy<T> b=*this;
    115         b.x=-b.x; b.y=-b.y;
    116         return b;
     114        xy<T> b=*this;
     115        b.x=-b.x; b.y=-b.y;
     116        return b;
    117117      }
    118118
    119119      ///Returns the difference of two vectors
    120120      xy<T> operator-(const xy<T> &u) const {
    121         xy<T> b=*this;
    122         return b-=u;
     121        xy<T> b=*this;
     122        return b-=u;
    123123      }
    124124
    125125      ///Returns a vector multiplied by a scalar
    126126      xy<T> operator*(const T &u) const {
    127         xy<T> b=*this;
    128         return b*=u;
     127        xy<T> b=*this;
     128        return b*=u;
    129129      }
    130130
    131131      ///Returns a vector divided by a scalar
    132132      xy<T> operator/(const T &u) const {
    133         xy<T> b=*this;
    134         return b/=u;
     133        xy<T> b=*this;
     134        return b/=u;
    135135      }
    136136
    137137      ///Testing equality
    138138      bool operator==(const xy<T> &u) const {
    139         return (x==u.x) && (y==u.y);
     139        return (x==u.x) && (y==u.y);
    140140      }
    141141
    142142      ///Testing inequality
    143143      bool operator!=(xy u) const {
    144         return  (x!=u.x) || (y!=u.y);
     144        return  (x!=u.x) || (y!=u.y);
    145145      }
    146146
     
    230230    public:
    231231     
    232       ///Default constructor: an empty bounding box
     232      ///Default constructor: creates an empty bounding box
    233233      BoundingBox() { _empty = true; }
    234234
     
    236236      BoundingBox(xy<T> a) { bottom_left=top_right=a; _empty = false; }
    237237
    238       ///Is there any point added
     238      ///Were any points added?
    239239      bool empty() const {
    240         return _empty;
     240        return _empty;
    241241      }
    242242
    243243      ///Makes the BoundingBox empty
    244244      void clear() {
    245         _empty=1;
     245        _empty=1;
    246246      }
    247247
    248248      ///Gives back the bottom left corner (if the bounding box is empty, then the return value is not defined)
    249249      xy<T> bottomLeft() const {
    250         return bottom_left;
     250        return bottom_left;
    251251      }
    252252
    253253      ///Gives back the top right corner (if the bounding box is empty, then the return value is not defined)
    254254      xy<T> topRight() const {
    255         return top_right;
     255        return top_right;
    256256      }
    257257
    258258      ///Gives back the bottom right corner (if the bounding box is empty, then the return value is not defined)
    259259      xy<T> bottomRight() const {
    260         return xy<T>(top_right.x,bottom_left.y);
     260        return xy<T>(top_right.x,bottom_left.y);
    261261      }
    262262
    263263      ///Gives back the top left corner (if the bounding box is empty, then the return value is not defined)
    264264      xy<T> topLeft() const {
    265         return xy<T>(bottom_left.x,top_right.y);
     265        return xy<T>(bottom_left.x,top_right.y);
    266266      }
    267267
    268268      ///Gives back the bottom of the box (if the bounding box is empty, then the return value is not defined)
    269269      T bottom() const {
    270         return bottom_left.y;
     270        return bottom_left.y;
    271271      }
    272272
    273273      ///Gives back the top of the box (if the bounding box is empty, then the return value is not defined)
    274274      T top() const {
    275         return top_right.y;
     275        return top_right.y;
    276276      }
    277277
    278278      ///Gives back the left side of the box (if the bounding box is empty, then the return value is not defined)
    279279      T left() const {
    280         return bottom_left.x;
     280        return bottom_left.x;
    281281      }
    282282
    283283      ///Gives back the right side of the box (if the bounding box is empty, then the return value is not defined)
    284284      T right() const {
    285         return top_right.x;
     285        return top_right.x;
    286286      }
    287287
    288288      ///Gives back the height of the box (if the bounding box is empty, then the return value is not defined)
    289289      T height() const {
    290         return top_right.y-bottom_left.y;
     290        return top_right.y-bottom_left.y;
    291291      }
    292292
    293293      ///Gives back the width of the box (if the bounding box is empty, then the return value is not defined)
    294294      T width() const {
    295         return top_right.x-bottom_left.x;
     295        return top_right.x-bottom_left.x;
    296296      }
    297297
    298298      ///Checks whether a point is inside a bounding box
    299299      bool inside(const xy<T>& u){
    300         if (_empty)
    301           return false;
    302         else{
    303           return ((u.x-bottom_left.x)*(top_right.x-u.x) >= 0 &&
    304                   (u.y-bottom_left.y)*(top_right.y-u.y) >= 0 );
    305         }
     300        if (_empty)
     301          return false;
     302        else{
     303          return ((u.x-bottom_left.x)*(top_right.x-u.x) >= 0 &&
     304              (u.y-bottom_left.y)*(top_right.y-u.y) >= 0 );
     305        }
    306306      }
    307307 
    308308      ///Increments a bounding box with a point
    309309      BoundingBox& operator +=(const xy<T>& u){
    310         if (_empty){
    311           bottom_left=top_right=u;
    312           _empty = false;
    313         }
    314         else{
    315           if (bottom_left.x > u.x) bottom_left.x = u.x;
    316           if (bottom_left.y > u.y) bottom_left.y = u.y;
    317           if (top_right.x < u.x) top_right.x = u.x;
    318           if (top_right.y < u.y) top_right.y = u.y;
    319         }
    320         return *this;
     310        if (_empty){
     311          bottom_left=top_right=u;
     312          _empty = false;
     313        }
     314        else{
     315          if (bottom_left.x > u.x) bottom_left.x = u.x;
     316          if (bottom_left.y > u.y) bottom_left.y = u.y;
     317          if (top_right.x < u.x) top_right.x = u.x;
     318          if (top_right.y < u.y) top_right.y = u.y;
     319        }
     320        return *this;
    321321      }
    322322 
    323323      ///Sums a bounding box and a point
    324324      BoundingBox operator +(const xy<T>& u){
    325         BoundingBox b = *this;
    326         return b += u;
     325        BoundingBox b = *this;
     326        return b += u;
    327327      }
    328328
    329329      ///Increments a bounding box with an other bounding box
    330330      BoundingBox& operator +=(const BoundingBox &u){
    331         if ( !u.empty() ){
    332           *this += u.bottomLeft();
    333           *this += u.topRight();
    334         }
    335         return *this;
     331        if ( !u.empty() ){
     332          *this += u.bottomLeft();
     333          *this += u.topRight();
     334        }
     335        return *this;
    336336      }
    337337 
    338338      ///Sums two bounding boxes
    339339      BoundingBox operator +(const BoundingBox& u){
    340         BoundingBox b = *this;
    341         return b += u;
     340        BoundingBox b = *this;
     341        return b += u;
    342342      }
    343343
Note: See TracChangeset for help on using the changeset viewer.