Index: lemon/dim2.h
===================================================================
--- lemon/dim2.h	(revision 241)
+++ lemon/dim2.h	(revision 220)
@@ -21,4 +21,5 @@
 
 #include <iostream>
+#include <lemon/core.h>
 
 ///\ingroup misc
@@ -45,7 +46,7 @@
   /// @{
 
-  /// A simple two dimensional vector (plain vector) implementation
-
-  /// A simple two dimensional vector (plain vector) implementation
+  /// A simple two dimensional vector (plainvector) implementation
+
+  /// A simple two dimensional vector (plainvector) implementation
   /// with the usual vector operations.
   template<typename T>
@@ -186,7 +187,7 @@
   }
 
-  ///Read a plain vector from a stream
-
-  ///Read a plain vector from a stream.
+  ///Read a plainvector from a stream
+
+  ///Read a plainvector from a stream.
   ///\relates Point
   ///
@@ -214,7 +215,7 @@
   }
 
-  ///Write a plain vector to a stream
-
-  ///Write a plain vector to a stream.
+  ///Write a plainvector to a stream
+
+  ///Write a plainvector to a stream.
   ///\relates Point
   ///
@@ -261,11 +262,11 @@
 
 
-    /// A class to calculate or store the bounding box of plain vectors.
-
-    /// A class to calculate or store the bounding box of plain vectors.
-    ///
+  /// A class to calculate or store the bounding box of plainvectors.
+
+  /// A class to calculate or store the bounding box of plainvectors.
+  ///
     template<typename T>
     class BoundingBox {
-      Point<T> _bottom_left, _top_right;
+      Point<T> bottom_left, top_right;
       bool _empty;
     public:
@@ -275,8 +276,5 @@
 
       ///Construct an instance from one point
-      BoundingBox(Point<T> a) {
-        _bottom_left = _top_right = a;
-        _empty = false;
-      }
+      BoundingBox(Point<T> a) { bottom_left=top_right=a; _empty = false; }
 
       ///Construct an instance from two points
@@ -289,6 +287,6 @@
       BoundingBox(Point<T> a,Point<T> b)
       {
-        _bottom_left = a;
-        _top_right = b;
+        bottom_left=a;
+        top_right=b;
         _empty = false;
       }
@@ -305,6 +303,6 @@
       BoundingBox(T l,T b,T r,T t)
       {
-        _bottom_left=Point<T>(l,b);
-        _top_right=Point<T>(r,t);
+        bottom_left=Point<T>(l,b);
+        top_right=Point<T>(r,t);
         _empty = false;
       }
@@ -323,5 +321,5 @@
       ///Make the BoundingBox empty
       void clear() {
-        _empty = true;
+        _empty=1;
       }
 
@@ -331,5 +329,5 @@
       ///If the bounding box is empty, then the return value is not defined.
       Point<T> bottomLeft() const {
-        return _bottom_left;
+        return bottom_left;
       }
 
@@ -337,7 +335,7 @@
 
       ///Set the bottom left corner of the box.
-      ///\pre The box must not be empty.
+      ///It should only be used for non-empty box.
       void bottomLeft(Point<T> p) {
-        _bottom_left = p;
+        bottom_left = p;
       }
 
@@ -347,5 +345,5 @@
       ///If the bounding box is empty, then the return value is not defined.
       Point<T> topRight() const {
-        return _top_right;
+        return top_right;
       }
 
@@ -353,7 +351,7 @@
 
       ///Set the top right corner of the box.
-      ///\pre The box must not be empty.
+      ///It should only be used for non-empty box.
       void topRight(Point<T> p) {
-        _top_right = p;
+        top_right = p;
       }
 
@@ -363,5 +361,5 @@
       ///If the bounding box is empty, then the return value is not defined.
       Point<T> bottomRight() const {
-        return Point<T>(_top_right.x,_bottom_left.y);
+        return Point<T>(top_right.x,bottom_left.y);
       }
 
@@ -369,8 +367,8 @@
 
       ///Set the bottom right corner of the box.
-      ///\pre The box must not be empty.
+      ///It should only be used for non-empty box.
       void bottomRight(Point<T> p) {
-        _top_right.x = p.x;
-        _bottom_left.y = p.y;
+        top_right.x = p.x;
+        bottom_left.y = p.y;
       }
 
@@ -380,5 +378,5 @@
       ///If the bounding box is empty, then the return value is not defined.
       Point<T> topLeft() const {
-        return Point<T>(_bottom_left.x,_top_right.y);
+        return Point<T>(bottom_left.x,top_right.y);
       }
 
@@ -386,8 +384,8 @@
 
       ///Set the top left corner of the box.
-      ///\pre The box must not be empty.
+      ///It should only be used for non-empty box.
       void topLeft(Point<T> p) {
-        _top_right.y = p.y;
-        _bottom_left.x = p.x;
+        top_right.y = p.y;
+        bottom_left.x = p.x;
       }
 
@@ -397,5 +395,5 @@
       ///If the bounding box is empty, then the return value is not defined.
       T bottom() const {
-        return _bottom_left.y;
+        return bottom_left.y;
       }
 
@@ -403,7 +401,7 @@
 
       ///Set the bottom of the box.
-      ///\pre The box must not be empty.
+      ///It should only be used for non-empty box.
       void bottom(T t) {
-        _bottom_left.y = t;
+        bottom_left.y = t;
       }
 
@@ -413,5 +411,5 @@
       ///If the bounding box is empty, then the return value is not defined.
       T top() const {
-        return _top_right.y;
+        return top_right.y;
       }
 
@@ -419,7 +417,7 @@
 
       ///Set the top of the box.
-      ///\pre The box must not be empty.
+      ///It should only be used for non-empty box.
       void top(T t) {
-        _top_right.y = t;
+        top_right.y = t;
       }
 
@@ -429,5 +427,5 @@
       ///If the bounding box is empty, then the return value is not defined.
       T left() const {
-        return _bottom_left.x;
+        return bottom_left.x;
       }
 
@@ -435,7 +433,7 @@
 
       ///Set the left side of the box.
-      ///\pre The box must not be empty.
+      ///It should only be used for non-empty box.
       void left(T t) {
-        _bottom_left.x = t;
+        bottom_left.x = t;
       }
 
@@ -445,5 +443,5 @@
       ///If the bounding box is empty, then the return value is not defined.
       T right() const {
-        return _top_right.x;
+        return top_right.x;
       }
 
@@ -451,7 +449,7 @@
 
       ///Set the right side of the box.
-      ///\pre The box must not be empty.
+      ///It should only be used for non-empty box.
       void right(T t) {
-        _top_right.x = t;
+        top_right.x = t;
       }
 
@@ -461,5 +459,5 @@
       ///If the bounding box is empty, then the return value is not defined.
       T height() const {
-        return _top_right.y-_bottom_left.y;
+        return top_right.y-bottom_left.y;
       }
 
@@ -469,5 +467,5 @@
       ///If the bounding box is empty, then the return value is not defined.
       T width() const {
-        return _top_right.x-_bottom_left.x;
+        return top_right.x-bottom_left.x;
       }
 
@@ -476,7 +474,7 @@
         if (_empty)
           return false;
-        else {
-          return ( (u.x-_bottom_left.x)*(_top_right.x-u.x) >= 0 &&
-                   (u.y-_bottom_left.y)*(_top_right.y-u.y) >= 0 );
+        else{
+          return ((u.x-bottom_left.x)*(top_right.x-u.x) >= 0 &&
+              (u.y-bottom_left.y)*(top_right.y-u.y) >= 0 );
         }
       }
@@ -487,13 +485,13 @@
       ///
       BoundingBox& add(const Point<T>& u){
-        if (_empty) {
-          _bottom_left = _top_right = u;
+        if (_empty){
+          bottom_left=top_right=u;
           _empty = false;
         }
-        else {
-          if (_bottom_left.x > u.x) _bottom_left.x = u.x;
-          if (_bottom_left.y > u.y) _bottom_left.y = u.y;
-          if (_top_right.x < u.x) _top_right.x = u.x;
-          if (_top_right.y < u.y) _top_right.y = u.y;
+        else{
+          if (bottom_left.x > u.x) bottom_left.x = u.x;
+          if (bottom_left.y > u.y) bottom_left.y = u.y;
+          if (top_right.x < u.x) top_right.x = u.x;
+          if (top_right.y < u.y) top_right.y = u.y;
         }
         return *this;
@@ -506,6 +504,6 @@
       BoundingBox& add(const BoundingBox &u){
         if ( !u.empty() ){
-          add(u._bottom_left);
-          add(u._top_right);
+          this->add(u.bottomLeft());
+          this->add(u.topRight());
         }
         return *this;
@@ -518,13 +516,13 @@
       BoundingBox operator&(const BoundingBox& u) const {
         BoundingBox b;
-        if (_empty || u._empty) {
+        if (this->_empty || u._empty) {
           b._empty = true;
         } else {
-          b._bottom_left.x = std::max(_bottom_left.x, u._bottom_left.x);
-          b._bottom_left.y = std::max(_bottom_left.y, u._bottom_left.y);
-          b._top_right.x = std::min(_top_right.x, u._top_right.x);
-          b._top_right.y = std::min(_top_right.y, u._top_right.y);
-          b._empty = b._bottom_left.x > b._top_right.x ||
-                     b._bottom_left.y > b._top_right.y;
+          b.bottom_left.x = std::max(this->bottom_left.x,u.bottom_left.x);
+          b.bottom_left.y = std::max(this->bottom_left.y,u.bottom_left.y);
+          b.top_right.x = std::min(this->top_right.x,u.top_right.x);
+          b.top_right.y = std::min(this->top_right.y,u.top_right.y);
+          b._empty = b.bottom_left.x > b.top_right.x ||
+                     b.bottom_left.y > b.top_right.y;
         }
         return b;
Index: test/dim_test.cc
===================================================================
--- test/dim_test.cc	(revision 242)
+++ test/dim_test.cc	(revision 209)
@@ -59,28 +59,24 @@
   box1.add(b);
 
-  check(box1.left()==1 && box1.bottom()==2 &&
-        box1.right()==3 && box1.top()==4,
+  check(box1.bottomLeft().x==1 &&
+        box1.bottomLeft().y==2 &&
+        box1.topRight().x==3 &&
+        box1.topRight().y==4,
         "Wrong addition of points to dim2::BoundingBox.");
 
-  check(box1.inside(Point(2,3)), "Wrong inside() in dim2::BoundingBox.");
-  check(box1.inside(Point(1,3)), "Wrong inside() in dim2::BoundingBox.");
-  check(!box1.inside(Point(0,3)), "Wrong inside() in dim2::BoundingBox.");
+  p.x=2; p.y=3;
+  check(box1.inside(p), "Wrong inside() in dim2::BoundingBox.");
 
-  BB box2(Point(2,2));
+  p.x=1; p.y=3;
+  check(box1.inside(p), "Wrong inside() in dim2::BoundingBox.");
+
+  p.x=0; p.y=3;
+  check(!box1.inside(p), "Wrong inside() in dim2::BoundingBox.");
+
+  BB box2(p);
   check(!box2.empty(), "Wrong empty() in dim2::BoundingBox.");
-  
-  box2.bottomLeft(Point(2,0));
-  box2.topRight(Point(5,3));
-  BB box3 = box1 & box2;
-  check(!box3.empty() &&
-        box3.left()==2 && box3.bottom()==2 && 
-        box3.right()==3 && box3.top()==3,
-        "Wrong intersection of two dim2::BoundingBox objects.");
-  
-  box1.add(box2);
-  check(!box1.empty() &&
-        box1.left()==1 && box1.bottom()==0 &&
-        box1.right()==5 && box1.top()==4,
-        "Wrong addition of two dim2::BoundingBox objects.");
+
+  box2.add(box1);
+  check(box2.inside(p), "Wrong inside() in dim2::BoundingBox.");
 
   return 0;
