|
Boost-Commit : |
From: mariano.consoni_at_[hidden]
Date: 2008-06-17 10:34:59
Author: mconsoni
Date: 2008-06-17 10:34:59 EDT (Tue, 17 Jun 2008)
New Revision: 46449
URL: http://svn.boost.org/trac/boost/changeset/46449
Log:
- some code reorganization.
Text files modified:
sandbox/SOC/2008/spacial_indexing/boost/spatial_index/helpers.hpp | 27 +++++++++++++++++++++++++++
sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree.hpp | 14 ++++++++------
sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_node.hpp | 28 +---------------------------
3 files changed, 36 insertions(+), 33 deletions(-)
Modified: sandbox/SOC/2008/spacial_indexing/boost/spatial_index/helpers.hpp
==============================================================================
--- sandbox/SOC/2008/spacial_indexing/boost/spatial_index/helpers.hpp (original)
+++ sandbox/SOC/2008/spacial_indexing/boost/spatial_index/helpers.hpp 2008-06-17 10:34:59 EDT (Tue, 17 Jun 2008)
@@ -11,6 +11,33 @@
namespace spatial_index {
+ /// given two boxes, create the minimal box that contains them
+ template<typename Point>
+ geometry::box<Point> enlarge_box(const geometry::box<Point> &b1, const geometry::box<Point> &b2)
+ {
+ Point min(
+ geometry::get<0>(b1.min()) < geometry::get<0>(b2.min()) ? geometry::get<0>(b1.min()) : geometry::get<0>(b2.min()),
+ geometry::get<1>(b1.min()) < geometry::get<1>(b2.min()) ? geometry::get<1>(b1.min()) : geometry::get<1>(b2.min())
+ );
+
+ Point max(
+ geometry::get<0>(b1.max()) > geometry::get<0>(b2.max()) ? geometry::get<0>(b1.max()) : geometry::get<0>(b2.max()),
+ geometry::get<1>(b1.max()) > geometry::get<1>(b2.max()) ? geometry::get<1>(b1.max()) : geometry::get<1>(b2.max())
+ );
+
+ return geometry::box<Point>(min, max);
+ }
+
+ /// compute the area of the union of b1 and b2
+ template<typename Point>
+ double compute_union_area(const geometry::box<Point> &b1, const geometry::box<Point> &b2)
+ {
+ geometry::box<Point> enlarged_box = enlarge_box(b1, b2);
+ return geometry::area(enlarged_box);
+ }
+
+
+
template<typename Point>
bool overlaps(const geometry::box<Point> &b1, const geometry::box<Point> &b2)
{
Modified: sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree.hpp
==============================================================================
--- sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree.hpp (original)
+++ sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree.hpp 2008-06-17 10:34:59 EDT (Tue, 17 Jun 2008)
@@ -21,6 +21,7 @@
class rtree : public spatial_index<Point, Value>
{
private:
+ // numbers of elements in the tree
unsigned int element_count;
// minimum number of elements per node
@@ -63,12 +64,6 @@
}
}
- void condense_tree(const boost::shared_ptr<rtree_node<Point,Value> > &l)
- {
- std::cerr << "Condensing tree." << std::endl;
- /// TODO: implement
- }
-
virtual void print(void) const
{
std::cerr << "===================================" << std::endl;
@@ -149,6 +144,13 @@
private:
+ void condense_tree(const boost::shared_ptr<rtree_node<Point,Value> > &l)
+ {
+ std::cerr << "Condensing tree." << std::endl;
+ /// TODO: implement
+ }
+
+
void adjust_tree(boost::shared_ptr<rtree_node<Point, Value> > &n)
{
if(n->is_root()) {
Modified: sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_node.hpp
==============================================================================
--- sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_node.hpp (original)
+++ sandbox/SOC/2008/spacial_indexing/boost/spatial_index/rtree_node.hpp 2008-06-17 10:34:59 EDT (Tue, 17 Jun 2008)
@@ -130,10 +130,9 @@
virtual void remove(const geometry::box<Point> &k)
{
- // TODO
+ throw std::logic_error("Remove from a node, not a leaf");
}
-
/// replace the node in the nodes_ vector and recompute the box
void replace_node(const boost::shared_ptr<rtree_node<Point, Value> > &l, boost::shared_ptr<rtree_node<Point, Value> > &new_l)
{
@@ -270,31 +269,6 @@
};
- /// given two boxes, create the minimal box that contains them
- template<typename Point>
- geometry::box<Point> enlarge_box(const geometry::box<Point> &b1, const geometry::box<Point> &b2)
- {
- Point min(
- geometry::get<0>(b1.min()) < geometry::get<0>(b2.min()) ? geometry::get<0>(b1.min()) : geometry::get<0>(b2.min()),
- geometry::get<1>(b1.min()) < geometry::get<1>(b2.min()) ? geometry::get<1>(b1.min()) : geometry::get<1>(b2.min())
- );
-
- Point max(
- geometry::get<0>(b1.max()) > geometry::get<0>(b2.max()) ? geometry::get<0>(b1.max()) : geometry::get<0>(b2.max()),
- geometry::get<1>(b1.max()) > geometry::get<1>(b2.max()) ? geometry::get<1>(b1.max()) : geometry::get<1>(b2.max())
- );
-
- return geometry::box<Point>(min, max);
- }
-
- /// compute the area of the union of b1 and b2
- template<typename Point>
- double compute_union_area(const geometry::box<Point> &b1, const geometry::box<Point> &b2)
- {
- geometry::box<Point> enlarged_box = enlarge_box(b1, b2);
- return geometry::area(enlarged_box);
- }
-
} // namespace spatial_index
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