|
Geometry : |
Subject: [ggl] space partitioning
From: Adam Wulkiewicz (adam.wulkiewicz)
Date: 2010-08-17 13:06:54
Barend Gehrels wrote:
> Hi Adam,
>
>
>
>> In the attachment there are:
>> runtime_point.cpp - geometry::point concept wrapper providing runtime
>> get(index) and set(index, value) methods used in one of the algorithms,
>> box.cpp - geometry::box algorithms
>> kd-tree.cpp - kd-tree implementation, there should be another tag
>> used, indicating type of objects (in this case point_tag).
> These are the .hpp files, perfect.
>
> Do you happen to have a test-project (cpp)?
Sorry, here it is.
Regards, Adam
-------------- next part --------------
#include <spar/kdtree.hpp>
#include <iostream>
// -------------------------------------------------------------------------------------- //
#include <boost/geometry/core/cs.hpp>
// -------------------------------------------------------------------------------------- //
int main()
{
using namespace boost::geometry;
typedef point<float, 2, cs::cartesian> point;
std::vector<point> vect(100);
for ( std::vector<point>::iterator it = vect.begin() ; it != vect.end() ; ++it )
{
it->set<0>(rand() % 100 - 50);
it->set<1>(rand() % 100 - 50);
}
typedef spar::runtime_point<point> runtime_point;
runtime_point rp;
point p;
box<point> b;
box<runtime_point> rb;
spar::good(b);
spar::good(rb);
spar::prepare_to_expand(b);
spar::prepare_to_expand(rb);
spar::expand(b, b);
spar::expand(rb, rb);
spar::expand(b, p);
spar::expand(rb, rp);
spar::left_aabb<0>(b, 0.0f);
spar::left_aabb(0, rb, 0.0f);
spar::kdtree<point> kdt(vect.begin(), vect.end());
spar::kdtree<point, spar::kdtree_biggest_dimension> kdt2(vect.begin(), vect.end());
/*
spar::kdtree<point>::iterator it = kdt.find(area());
for ( ; it != kdt.end() ; ++it )
*it;
*/
#if defined(_MSC_VER)
std::cin.get();
#endif
return 0;
}
Geometry list run by mateusz at loskot.net