COIN-OR::LEMON - Graph Library

Changeset 1588:b79bcba43661 in lemon-0.x for lemon/xy.h


Ignore:
Timestamp:
07/26/05 16:31:29 (15 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2092
Message:

BoundingBox?<T>::operator+=() -> BoundingBox?<T>::add() ->

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/xy.h

    r1435 r1588  
    307307 
    308308      ///Increments a bounding box with a point
    309       BoundingBox& operator +=(const xy<T>& u){
     309      BoundingBox& add(const xy<T>& u){
    310310        if (_empty){
    311311          bottom_left=top_right=u;
     
    321321      }
    322322 
    323       ///Sums a bounding box and a point
    324       BoundingBox operator +(const xy<T>& u){
    325         BoundingBox b = *this;
    326         return b += u;
    327       }
     323//       ///Sums a bounding box and a point
     324//       BoundingBox operator +(const xy<T>& u){
     325//         BoundingBox b = *this;
     326//         return b += u;
     327//       }
    328328
    329329      ///Increments a bounding box with an other bounding box
    330       BoundingBox& operator +=(const BoundingBox &u){
     330      BoundingBox& add(const BoundingBox &u){
    331331        if ( !u.empty() ){
    332           *this += u.bottomLeft();
    333           *this += u.topRight();
     332          this->add(u.bottomLeft());
     333          this->add(u.topRight());
    334334        }
    335335        return *this;
     
    339339      BoundingBox operator +(const BoundingBox& u){
    340340        BoundingBox b = *this;
    341         return b += u;
     341        return b.add(u);
     342      }
     343
     344
     345      ///Intersection of two bounding boxes
     346      BoundingBox operator &(const BoundingBox& u){
     347        BoundingBox b;
     348        b.bottom_left.x=std::max(this->bottom_left.x,u.bottom_left.x);
     349        b.bottom_left.y=std::max(this->bottom_left.y,u.bottom_left.y);
     350        b.top_right.x=std::min(this->top_right.x,u.top_right.x);
     351        b.top_right.y=std::min(this->top_right.y,u.top_right.y);
     352        b._empty = this->_empty || u._empty ||
     353          b.bottom_left.x>top_right.x && b.bottom_left.y>top_right.y;
     354        return b;
    342355      }
    343356
Note: See TracChangeset for help on using the changeset viewer.