Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81528 - in sandbox-branches/geometry/index_dev: boost/geometry/extensions/index/rtree/visitors doc/rtree/images tests
From: adam.wulkiewicz_at_[hidden]
Date: 2012-11-25 12:28:13


Author: awulkiew
Date: 2012-11-25 12:28:12 EST (Sun, 25 Nov 2012)
New Revision: 81528
URL: http://svn.boost.org/trac/boost/changeset/81528

Log:
Modified glut_vis additional test and added generated rtree images.
Added:
   sandbox-branches/geometry/index_dev/doc/rtree/images/
   sandbox-branches/geometry/index_dev/doc/rtree/images/disjoint.png (contents, props changed)
   sandbox-branches/geometry/index_dev/doc/rtree/images/intersects.png (contents, props changed)
   sandbox-branches/geometry/index_dev/doc/rtree/images/knn.png (contents, props changed)
   sandbox-branches/geometry/index_dev/doc/rtree/images/knn_cover.png (contents, props changed)
   sandbox-branches/geometry/index_dev/doc/rtree/images/knn_inters.png (contents, props changed)
   sandbox-branches/geometry/index_dev/doc/rtree/images/linear.png (contents, props changed)
   sandbox-branches/geometry/index_dev/doc/rtree/images/overlaps.png (contents, props changed)
   sandbox-branches/geometry/index_dev/doc/rtree/images/quadratic.png (contents, props changed)
   sandbox-branches/geometry/index_dev/doc/rtree/images/rstar.png (contents, props changed)
   sandbox-branches/geometry/index_dev/doc/rtree/images/within.png (contents, props changed)
Text files modified:
   sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp | 20 ++++++++----
   sandbox-branches/geometry/index_dev/tests/additional_glut_vis.cpp | 59 +++++++++++++++++++++++++++++++++------
   2 files changed, 62 insertions(+), 17 deletions(-)

Modified: sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp
==============================================================================
--- sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp (original)
+++ sandbox-branches/geometry/index_dev/boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp 2012-11-25 12:28:12 EST (Sun, 25 Nov 2012)
@@ -122,17 +122,17 @@
             size_t level_rel = level - level_f;
 
             if ( level_rel == 0 )
- glColor3f(1.0f, 0.0f, 0.0f);
+ glColor3f(0.75f, 0.0f, 0.0f);
             else if ( level_rel == 1 )
- glColor3f(0.0f, 1.0f, 0.0f);
+ glColor3f(0.0f, 0.75f, 0.0f);
             else if ( level_rel == 2 )
- glColor3f(0.0f, 0.0f, 1.0f);
+ glColor3f(0.0f, 0.0f, 0.75f);
             else if ( level_rel == 3 )
- glColor3f(1.0f, 1.0f, 0.0f);
+ glColor3f(0.75f, 0.75f, 0.0f);
             else if ( level_rel == 4 )
- glColor3f(1.0f, 0.0f, 1.0f);
+ glColor3f(0.75f, 0.0f, 0.75f);
             else if ( level_rel == 5 )
- glColor3f(0.0f, 1.0f, 1.0f);
+ glColor3f(0.0f, 0.75f, 0.75f);
             else
                 glColor3f(0.5f, 0.5f, 0.5f);
 
@@ -167,7 +167,7 @@
         {
             size_t level_rel = level - level_f;
 
- glColor3f(1.0f, 1.0f, 1.0f);
+ glColor3f(0.25f, 0.25f, 0.25f);
 
             for (typename elements_type::const_iterator it = elements.begin();
                 it != elements.end(); ++it)
@@ -204,6 +204,12 @@
     typedef typename rtree_type::box_type box_type;
     typedef typename rtree_type::allocators_type allocators_type;
 
+ if ( !tree.empty() )
+ {
+ glColor3f(0.75f, 0.75f, 0.75f);
+ detail::rtree::visitors::detail::gl_draw_indexable(tree.box(), 0);
+ }
+
     detail::rtree::visitors::gl_draw<value_type, options_type, translator_type, box_type, allocators_type>
         gl_draw_v(tree.translator(), level_first, level_last, z_coord_level_multiplier);
 

Added: sandbox-branches/geometry/index_dev/doc/rtree/images/disjoint.png
==============================================================================
Binary file. No diff available.

Added: sandbox-branches/geometry/index_dev/doc/rtree/images/intersects.png
==============================================================================
Binary file. No diff available.

Added: sandbox-branches/geometry/index_dev/doc/rtree/images/knn.png
==============================================================================
Binary file. No diff available.

Added: sandbox-branches/geometry/index_dev/doc/rtree/images/knn_cover.png
==============================================================================
Binary file. No diff available.

Added: sandbox-branches/geometry/index_dev/doc/rtree/images/knn_inters.png
==============================================================================
Binary file. No diff available.

Added: sandbox-branches/geometry/index_dev/doc/rtree/images/linear.png
==============================================================================
Binary file. No diff available.

Added: sandbox-branches/geometry/index_dev/doc/rtree/images/overlaps.png
==============================================================================
Binary file. No diff available.

Added: sandbox-branches/geometry/index_dev/doc/rtree/images/quadratic.png
==============================================================================
Binary file. No diff available.

Added: sandbox-branches/geometry/index_dev/doc/rtree/images/rstar.png
==============================================================================
Binary file. No diff available.

Added: sandbox-branches/geometry/index_dev/doc/rtree/images/within.png
==============================================================================
Binary file. No diff available.

Modified: sandbox-branches/geometry/index_dev/tests/additional_glut_vis.cpp
==============================================================================
--- sandbox-branches/geometry/index_dev/tests/additional_glut_vis.cpp (original)
+++ sandbox-branches/geometry/index_dev/tests/additional_glut_vis.cpp 2012-11-25 12:28:12 EST (Sun, 25 Nov 2012)
@@ -9,6 +9,8 @@
 
 #include <gl/glut.h>
 
+#define BOOST_GEOMETRY_INDEX_ENABLE_DEBUG_INTERFACE
+
 #include <boost/geometry/extensions/index/rtree/rtree.hpp>
 
 #include <boost/geometry/extensions/index/rtree/visitors/gl_draw.hpp>
@@ -31,9 +33,9 @@
 
 size_t found_count = 0;
 P search_point;
-float min_distance = 20;
+float min_distance = 10;
 float max_distance = 30;
-size_t count = 10;
+size_t count = 5;
 std::vector<B> nearest_boxes;
 B search_box;
 
@@ -50,11 +52,11 @@
 
     search_point = P(x, y);
     nearest_boxes.clear();
- found_count = t.nearest(
+ found_count = t.nearest_query(
         bgi::bounded(
             search_point,
- bgi::far(min_distance),
- bgi::near(max_distance)
+ bgi::to_furthest(min_distance),
+ bgi::to_nearest(max_distance)
         ),
         count,
         std::back_inserter(nearest_boxes)
@@ -87,13 +89,13 @@
 
         search_box = B(P(x - w, y - h), P(x + w, y + h));
         nearest_boxes.clear();
- found_count = t.query(Predicate(search_box), std::back_inserter(nearest_boxes) );
+ found_count = t.spatial_query(Predicate(search_box), std::back_inserter(nearest_boxes) );
     }
     else
     {
         search_box = t.box();
         nearest_boxes.clear();
- found_count = t.query(Predicate(search_box), std::back_inserter(nearest_boxes) );
+ found_count = t.spatial_query(Predicate(search_box), std::back_inserter(nearest_boxes) );
     }
 
     if ( found_count > 0 )
@@ -220,13 +222,23 @@
 
     glViewport(0, 0, w, h);
 
- gluPerspective(45, ratio, 1, 1000);
+ //gluPerspective(45, ratio, 1, 1000);
+ glOrtho(-150, 150, -150, 150, -150, 150);
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
- gluLookAt(
+ /*gluLookAt(
         120.0f, 120.0f, 120.0f,
         50.0f, 50.0f, -1.0f,
+ 0.0f, 1.0f, 0.0f);*/
+ gluLookAt(
+ 50.0f, 50.0f, 75.0f,
+ 50.0f, 50.0f, -1.0f,
         0.0f, 1.0f, 0.0f);
+
+ glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+ glLineWidth(1.5f);
+
+ srand(1);
 }
 
 void mouse(int button, int state, int x, int y)
@@ -292,6 +304,33 @@
         {
             std::cout << "\n" << t << "\n";
         }
+ else if ( current_line == "rand" )
+ {
+ for ( size_t i = 0 ; i < 35 ; ++i )
+ {
+ float x = ( rand() % 100 );
+ float y = ( rand() % 100 );
+ float w = ( rand() % 2 ) + 1;
+ float h = ( rand() % 2 ) + 1;
+
+ B b(P(x - w, y - h),P(x + w, y + h));
+
+ boost::geometry::index::insert(t, b);
+ vect.push_back(b);
+
+ std::cout << "inserted: ";
+ bgi::detail::rtree::visitors::detail::print_indexable(std::cout, b);
+ std::cout << '\n';
+ }
+
+ std::cout << ( bgi::are_boxes_ok(t) ? "boxes OK\n" : "WRONG BOXES!\n" );
+ std::cout << ( bgi::are_levels_ok(t) ? "levels OK\n" : "WRONG LEVELS!\n" );
+ std::cout << "\n";
+
+ search_valid = false;
+
+ glutPostRedisplay();
+ }
         else
         {
             if ( current_line == "knn" )
@@ -338,7 +377,7 @@
     glutInit(&argc, argv);
     glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
     glutInitWindowPosition(100,100);
- glutInitWindowSize(800, 600);
+ glutInitWindowSize(600, 600);
     glutCreateWindow("boost::geometry::index::rtree GLUT test");
 
     glutDisplayFunc(render_scene);


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