Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76195 - in sandbox/gtl: boost/polygon/detail libs/polygon/voronoi_example/input_data/polygon libs/polygon/voronoi_example/output_data/polygon
From: sydorchuk.andriy_at_[hidden]
Date: 2011-12-26 14:57:40


Author: asydorchuk
Date: 2011-12-26 14:57:39 EST (Mon, 26 Dec 2011)
New Revision: 76195
URL: http://svn.boost.org/trac/boost/changeset/76195

Log:
Doing better packaging of internal members of site_event structure (removing boolean flag).
Input/output test examples renaming.
Added:
   sandbox/gtl/libs/polygon/voronoi_example/input_data/polygon/polygon_011.txt
      - copied unchanged from r76157, /sandbox/gtl/libs/polygon/voronoi_example/input_data/polygon/polygon_11.txt
   sandbox/gtl/libs/polygon/voronoi_example/input_data/polygon/polygon_012.txt
      - copied unchanged from r76157, /sandbox/gtl/libs/polygon/voronoi_example/input_data/polygon/polygon_12.txt
   sandbox/gtl/libs/polygon/voronoi_example/output_data/polygon/polygon_011.png
      - copied unchanged from r76157, /sandbox/gtl/libs/polygon/voronoi_example/output_data/polygon/polygon_11.png
   sandbox/gtl/libs/polygon/voronoi_example/output_data/polygon/polygon_012.png
      - copied unchanged from r76157, /sandbox/gtl/libs/polygon/voronoi_example/output_data/polygon/polygon_12.png
Removed:
   sandbox/gtl/libs/polygon/voronoi_example/input_data/polygon/polygon_11.txt
   sandbox/gtl/libs/polygon/voronoi_example/input_data/polygon/polygon_12.txt
   sandbox/gtl/libs/polygon/voronoi_example/output_data/polygon/polygon_11.png
   sandbox/gtl/libs/polygon/voronoi_example/output_data/polygon/polygon_12.png
Text files modified:
   sandbox/gtl/boost/polygon/detail/voronoi_structures.hpp | 55 ++++++++++++++++++---------------------
   1 files changed, 26 insertions(+), 29 deletions(-)

Modified: sandbox/gtl/boost/polygon/detail/voronoi_structures.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/detail/voronoi_structures.hpp (original)
+++ sandbox/gtl/boost/polygon/detail/voronoi_structures.hpp 2011-12-26 14:57:39 EST (Mon, 26 Dec 2011)
@@ -76,8 +76,9 @@
     // type preceed sites of the second type for the same segment.
     // Variables: point0_ - point site or segment's startpoint;
     // point1_ - segment's endpoint if site is a segment;
- // index_ - site event index among other sites;
- // is_inverse_ - defines type of the segment site.
+ // index_ - the last bit encodes if the site is inverse,
+ // all the other bits encode site event index among
+ // the other site events.
     // Note: for all the sites is_inverse_ flag is equal to false by default.
     template <typename T>
     class site_event {
@@ -88,47 +89,40 @@
         site_event() :
             point0_(0, 0),
             point1_(0, 0),
- site_index_(0),
- is_inverse_(false) {}
+ site_index_(0) {}
 
         site_event(coordinate_type x, coordinate_type y) :
             point0_(x, y),
             point1_(x, y),
- site_index_(0),
- is_inverse_(false) {}
+ site_index_(0) {}
 
         site_event(const point_type &point) :
             point0_(point),
             point1_(point),
- site_index_(0),
- is_inverse_(false) {}
+ site_index_(0) {}
 
         site_event(coordinate_type x1, coordinate_type y1,
                    coordinate_type x2, coordinate_type y2):
             point0_(x1, y1),
             point1_(x2, y2),
- site_index_(0),
- is_inverse_(false) {}
+ site_index_(0) {}
 
         site_event(const point_type &point1,
                    const point_type &point2) :
             point0_(point1),
             point1_(point2),
- site_index_(0),
- is_inverse_(false) {}
+ site_index_(0) {}
 
         bool operator==(const site_event &that) const {
             return (this->point0_ == that.point0_) &&
                    (this->point1_ == that.point1_) &&
- (this->site_index_ == that.site_index_) &&
- (this->is_inverse_ == that.is_inverse_);
+ (this->site_index_ == that.site_index_);
         }
 
         bool operator!=(const site_event &that) const {
             return (this->point0_ != that.point0_) ||
                    (this->point1_ != that.point1_) ||
- (this->site_index_ != that.site_index_) ||
- (this->is_inverse_ != that.is_inverse_);
+ (this->site_index_ != that.site_index_);
         }
 
         coordinate_type x(bool oriented = false) const {
@@ -142,51 +136,51 @@
         coordinate_type x0(bool oriented = false) const {
             if (!oriented)
                 return point0_.x();
- return is_inverse_ ? point1_.x() : point0_.x();
+ return is_inverse() ? point1_.x() : point0_.x();
         }
 
         coordinate_type y0(bool oriented = false) const {
             if (!oriented)
                 return point0_.y();
- return is_inverse_ ? point1_.y() : point0_.y();
+ return is_inverse() ? point1_.y() : point0_.y();
         }
 
         coordinate_type x1(bool oriented = false) const {
             if (!oriented)
                 return point1_.x();
- return is_inverse_ ? point0_.x() : point1_.x();
+ return is_inverse() ? point0_.x() : point1_.x();
         }
 
         coordinate_type y1(bool oriented = false) const {
             if (!oriented)
                 return point1_.y();
- return is_inverse_ ? point0_.y() : point1_.y();
+ return is_inverse() ? point0_.y() : point1_.y();
         }
 
         const point_type &point0(bool oriented = false) const {
             if (!oriented)
                 return point0_;
- return is_inverse_ ? point1_ : point0_;
+ return is_inverse() ? point1_ : point0_;
         }
 
         const point_type &point1(bool oriented = false) const {
             if (!oriented)
                 return point1_;
- return is_inverse_ ? point0_ : point1_;
+ return is_inverse() ? point0_ : point1_;
         }
 
         site_event& index(int index) {
- site_index_ = index;
+ site_index_ = index << 1;
             return *this;
         }
 
         site_event& inverse() {
- is_inverse_ ^= true;
+ site_index_ ^= IS_INVERSE;
             return *this;
         }
 
- int index() const {
- return site_index_;
+ size_t index() const {
+ return site_index_ >> 1;
         }
 
         bool is_point() const {
@@ -198,14 +192,17 @@
         }
 
         bool is_inverse() const {
- return is_inverse_;
+ return site_index_ & IS_INVERSE;
         }
 
     private:
+ enum kBits {
+ IS_INVERSE = 1
+ };
+
         point_type point0_;
         point_type point1_;
- int site_index_;
- bool is_inverse_;
+ unsigned int site_index_;
     };
 
     // Circle event type.

Deleted: sandbox/gtl/libs/polygon/voronoi_example/input_data/polygon/polygon_11.txt
==============================================================================
--- sandbox/gtl/libs/polygon/voronoi_example/input_data/polygon/polygon_11.txt 2011-12-26 14:57:39 EST (Mon, 26 Dec 2011)
+++ (empty file)
@@ -1,11 +0,0 @@
-0
-9
-0 0 1 10
-1 10 4 9
-4 9 4 2
-4 2 0 0
-5 5 6 8
-6 8 10 10
-10 10 9 1
-9 1 6 2
-6 2 5 5
\ No newline at end of file

Deleted: sandbox/gtl/libs/polygon/voronoi_example/input_data/polygon/polygon_12.txt
==============================================================================
--- sandbox/gtl/libs/polygon/voronoi_example/input_data/polygon/polygon_12.txt 2011-12-26 14:57:39 EST (Mon, 26 Dec 2011)
+++ (empty file)
@@ -1,14 +0,0 @@
-0
-12
-0 0 100 0
-100 0 100 100
-100 100 0 100
-0 100 0 0
-15 15 60 20
-60 20 87 23
-60 20 57 47
-15 85 30 80
-30 80 25 65
-30 80 60 70
-60 70 75 65
-60 70 65 85
\ No newline at end of file

Deleted: sandbox/gtl/libs/polygon/voronoi_example/output_data/polygon/polygon_11.png
==============================================================================
Binary file. No diff available.

Deleted: sandbox/gtl/libs/polygon/voronoi_example/output_data/polygon/polygon_12.png
==============================================================================
Binary file. No diff available.


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk