Hi,I tested it using VS. To compile under GCC the overloaded bg::intersects() must be defined before the rtree is included. Otherwise the compiler tries to use the original version. Let me know if this works:
Michael Nett wrote:
Hi again,
sorry for the confusion. I tried your example at work (with Boost 1.48) and now at home (using 1.54) and both produce the same errors.
#include <boost/geometry.hpp>// This will be called for Nodes and Values!
struct MyFrustum
{
MyFrustum(int d) : dummy(d) {}
int dummy;
};
namespace boost { namespace geometry {
#include <boost/geometry/index/rtree.hpp>
template <typename Box> inline
bool intersects(Box const& b, MyFrustum const& f)
{
std::cout << "checking the intersection with " << f.dummy << std::endl;
return true;
}
}}
int main()
{
namespace bg = boost::geometry;
namespace bgi = bg::index;
namespace bgm = bg::model;
typedef bgm::point<float, 2, bg::cs::cartesian> pt;
typedef bgm::box<pt> box;
// check your implementation
bool ok = bg::intersects(box(pt(0, 0), pt(1, 1)), MyFrustum(5));
std::cout << "-------------------" << std::endl;
// now use the rtree
bgi::rtree<box, bgi::rstar<8> > rt;
// insert some values
rt.insert(box(pt(0, 0), pt(1, 1)));
rt.insert(box(pt(2, 2), pt(3, 3)));
// performa a query
std::vector<box> vec;
rt.query(bgi::intersects(MyFrustum(10)), std::back_inserter(vec));
std::cout << vec.size() << std::endl;
}
Regards,
Adam
_______________________________________________
Geometry mailing list
Geometry@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/geometry