[Lemon-commits] Peter Kovacs: Rename BoundingBox to Box (ticket ...

Lemon HG hg at lemon.cs.elte.hu
Tue Sep 2 11:23:50 CEST 2008


details:   http://lemon.cs.elte.hu/hg/lemon/rev/dbe309b5e855
changeset: 253:dbe309b5e855
user:      Peter Kovacs <kpeter [at] inf.elte.hu>
date:      Sat Aug 30 22:19:43 2008 +0200
description:
	Rename BoundingBox to Box (ticket #126)

diffstat:

3 files changed, 71 insertions(+), 72 deletions(-)
lemon/dim2.h         |  103 ++++++++++++++++++++++++--------------------------
lemon/graph_to_eps.h |    8 +--
test/dim_test.cc     |   32 +++++++--------

diffs (truncated from 382 to 300 lines):

diff -r d0aae16df1bb -r dbe309b5e855 lemon/dim2.h
--- a/lemon/dim2.h	Wed Aug 27 10:50:04 2008 +0200
+++ b/lemon/dim2.h	Sat Aug 30 22:19:43 2008 +0200
@@ -28,8 +28,7 @@
 /// The class \ref lemon::dim2::Point "dim2::Point" implements
 /// a two dimensional vector with the usual operations.
 ///
-/// The class \ref lemon::dim2::BoundingBox "dim2::BoundingBox"
-/// can be used to determine
+/// The class \ref lemon::dim2::Box "dim2::Box" can be used to determine
 /// the rectangular bounding box of a set of
 /// \ref lemon::dim2::Point "dim2::Point"'s.
 
@@ -44,7 +43,7 @@
   /// \addtogroup misc
   /// @{
 
-  /// A simple two dimensional vector (plain vector) implementation
+  /// Two dimensional vector (plain vector)
 
   /// A simple two dimensional vector (plain vector) implementation
   /// with the usual vector operations.
@@ -260,67 +259,67 @@
 
 
 
-    /// A class to calculate or store the bounding box of plain vectors.
+  /// Bounding box of plain vectors (\ref Point points).
 
-    /// A class to calculate or store the bounding box of plain vectors.
-    ///
-    template<typename T>
-    class BoundingBox {
+  /// A class to calculate or store the bounding box of plain vectors
+  /// (\ref Point points).
+  template<typename T>
+  class Box {
       Point<T> _bottom_left, _top_right;
       bool _empty;
     public:
 
-      ///Default constructor: creates an empty bounding box
-      BoundingBox() { _empty = true; }
+      ///Default constructor: creates an empty box
+      Box() { _empty = true; }
 
-      ///Construct an instance from one point
-      BoundingBox(Point<T> a) {
+      ///Construct a box from one point
+      Box(Point<T> a) {
         _bottom_left = _top_right = a;
         _empty = false;
       }
 
-      ///Construct an instance from two points
+      ///Construct a box from two points
 
-      ///Construct an instance from two points.
+      ///Construct a box from two points.
       ///\param a The bottom left corner.
       ///\param b The top right corner.
       ///\warning The coordinates of the bottom left corner must be no more
       ///than those of the top right one.
-      BoundingBox(Point<T> a,Point<T> b)
+      Box(Point<T> a,Point<T> b)
       {
         _bottom_left = a;
         _top_right = b;
         _empty = false;
       }
 
-      ///Construct an instance from four numbers
+      ///Construct a box from four numbers
 
-      ///Construct an instance from four numbers.
+      ///Construct a box from four numbers.
       ///\param l The left side of the box.
       ///\param b The bottom of the box.
       ///\param r The right side of the box.
       ///\param t The top of the box.
       ///\warning The left side must be no more than the right side and
       ///bottom must be no more than the top.
-      BoundingBox(T l,T b,T r,T t)
+      Box(T l,T b,T r,T t)
       {
         _bottom_left=Point<T>(l,b);
         _top_right=Point<T>(r,t);
         _empty = false;
       }
 
-      ///Return \c true if the bounding box is empty.
+      ///Return \c true if the box is empty.
 
-      ///Return \c true if the bounding box is empty (i.e. return \c false
+      ///Return \c true if the box is empty (i.e. return \c false
       ///if at least one point was added to the box or the coordinates of
       ///the box were set).
       ///
-      ///The coordinates of an empty bounding box are not defined.
+      ///The coordinates of an empty box are not defined.
       bool empty() const {
         return _empty;
       }
 
-      ///Make the BoundingBox empty
+      ///Make the box empty
       void clear() {
         _empty = true;
       }
@@ -328,7 +327,7 @@
       ///Give back the bottom left corner of the box
 
       ///Give back the bottom left corner of the box.
-      ///If the bounding box is empty, then the return value is not defined.
+      ///If the box is empty, then the return value is not defined.
       Point<T> bottomLeft() const {
         return _bottom_left;
       }
@@ -344,7 +343,7 @@
       ///Give back the top right corner of the box
 
       ///Give back the top right corner of the box.
-      ///If the bounding box is empty, then the return value is not defined.
+      ///If the box is empty, then the return value is not defined.
       Point<T> topRight() const {
         return _top_right;
       }
@@ -360,7 +359,7 @@
       ///Give back the bottom right corner of the box
 
       ///Give back the bottom right corner of the box.
-      ///If the bounding box is empty, then the return value is not defined.
+      ///If the box is empty, then the return value is not defined.
       Point<T> bottomRight() const {
         return Point<T>(_top_right.x,_bottom_left.y);
       }
@@ -377,7 +376,7 @@
       ///Give back the top left corner of the box
 
       ///Give back the top left corner of the box.
-      ///If the bounding box is empty, then the return value is not defined.
+      ///If the box is empty, then the return value is not defined.
       Point<T> topLeft() const {
         return Point<T>(_bottom_left.x,_top_right.y);
       }
@@ -394,7 +393,7 @@
       ///Give back the bottom of the box
 
       ///Give back the bottom of the box.
-      ///If the bounding box is empty, then the return value is not defined.
+      ///If the box is empty, then the return value is not defined.
       T bottom() const {
         return _bottom_left.y;
       }
@@ -410,7 +409,7 @@
       ///Give back the top of the box
 
       ///Give back the top of the box.
-      ///If the bounding box is empty, then the return value is not defined.
+      ///If the box is empty, then the return value is not defined.
       T top() const {
         return _top_right.y;
       }
@@ -426,7 +425,7 @@
       ///Give back the left side of the box
 
       ///Give back the left side of the box.
-      ///If the bounding box is empty, then the return value is not defined.
+      ///If the box is empty, then the return value is not defined.
       T left() const {
         return _bottom_left.x;
       }
@@ -442,7 +441,7 @@
       /// Give back the right side of the box
 
       /// Give back the right side of the box.
-      ///If the bounding box is empty, then the return value is not defined.
+      ///If the box is empty, then the return value is not defined.
       T right() const {
         return _top_right.x;
       }
@@ -458,7 +457,7 @@
       ///Give back the height of the box
 
       ///Give back the height of the box.
-      ///If the bounding box is empty, then the return value is not defined.
+      ///If the box is empty, then the return value is not defined.
       T height() const {
         return _top_right.y-_bottom_left.y;
       }
@@ -466,12 +465,12 @@
       ///Give back the width of the box
 
       ///Give back the width of the box.
-      ///If the bounding box is empty, then the return value is not defined.
+      ///If the box is empty, then the return value is not defined.
       T width() const {
         return _top_right.x-_bottom_left.x;
       }
 
-      ///Checks whether a point is inside a bounding box
+      ///Checks whether a point is inside the box
       bool inside(const Point<T>& u) const {
         if (_empty)
           return false;
@@ -481,11 +480,11 @@
         }
       }
 
-      ///Increments a bounding box with a point
+      ///Increments the box with a point
 
-      ///Increments a bounding box with a point.
+      ///Increments the box with a point.
       ///
-      BoundingBox& add(const Point<T>& u){
+      Box& add(const Point<T>& u){
         if (_empty) {
           _bottom_left = _top_right = u;
           _empty = false;
@@ -499,11 +498,11 @@
         return *this;
       }
 
-      ///Increments a bounding box to contain another bounding box
+      ///Increments the box to contain another box
 
-      ///Increments a bounding box to contain another bounding box.
+      ///Increments the box to contain another box.
       ///
-      BoundingBox& add(const BoundingBox &u){
+      Box& add(const Box &u){
         if ( !u.empty() ){
           add(u._bottom_left);
           add(u._top_right);
@@ -511,12 +510,12 @@
         return *this;
       }
 
-      ///Intersection of two bounding boxes
+      ///Intersection of two boxes
 
-      ///Intersection of two bounding boxes.
+      ///Intersection of two boxes.
       ///
-      BoundingBox operator&(const BoundingBox& u) const {
-        BoundingBox b;
+      Box operator&(const Box& u) const {
+        Box b;
         if (_empty || u._empty) {
           b._empty = true;
         } else {
@@ -530,15 +529,15 @@
         return b;
       }
 
-    };//class Boundingbox
+  };//class Box
 
 
-  ///Read a bounding box from a stream
+  ///Read a box from a stream
 
-  ///Read a bounding box from a stream.
-  ///\relates BoundingBox
+  ///Read a box from a stream.
+  ///\relates Box
   template<typename T>
-  inline std::istream& operator>>(std::istream &is, BoundingBox<T>& b) {
+  inline std::istream& operator>>(std::istream &is, Box<T>& b) {
     char c;
     Point<T> p;
     if (is >> c) {
@@ -563,12 +562,12 @@
     return is;
   }
 
-  ///Write a bounding box to a stream
+  ///Write a box to a stream
 
-  ///Write a bounding box to a stream.
-  ///\relates BoundingBox
+  ///Write a box to a stream.
+  ///\relates Box
   template<typename T>
-  inline std::ostream& operator<<(std::ostream &os, const BoundingBox<T>& b)
+  inline std::ostream& operator<<(std::ostream &os, const Box<T>& b)
   {
     os << "(" << b.bottomLeft() << "," << b.topRight() << ")";
     return os;
diff -r d0aae16df1bb -r dbe309b5e855 lemon/graph_to_eps.h
--- a/lemon/graph_to_eps.h	Wed Aug 27 10:50:04 2008 +0200
+++ b/lemon/graph_to_eps.h	Sat Aug 30 22:19:43 2008 +0200
@@ -725,10 +725,10 @@
 
     double diag_len = 1;
     if(!(_absoluteNodeSizes&&_absoluteArcWidths)) {
-      dim2::BoundingBox<double> bb;
+      dim2::Box<double> bb;
       for(NodeIt n(g);n!=INVALID;++n) bb.add(mycoords[n]);



More information about the Lemon-commits mailing list