0

I want to create rtree with dynamic_quadratic and give it a range at contractor that it will use packing algorithm. Here my code for doing it with regular quadratic.

namespace bg = boost::geometry;
namespace bgi = boost::geometry::index;

typedef bg::model::point<double , 3, bg::cs::cartesian> BoostPoint;
typedef std::pair<BoostPoint, unsigned> PointValue;

std::vector<PointValue> points;
for(...)
{
//fill in the points vector
}

bgi::rtree< PointValue, bgi::quadratic<16> > rtree_points(points);

How I can do it with:
bgi::rtree< PointValue, bgi::dynamic_quadratic > rtree_points(points);?

Alredy look at this example:
packing algorithm in rtree in boost

1 Answer 1

1

When I post the answer, I search a little bit in the internet, and doesn't find a good answer. Then I realize I need to give a second parameter about the dynamic size i want to create the tree. So that how I did It.

bgi::rtree<PointValue, bgi::dynamic_quadratic> rtree_points(points, points.size());
Sign up to request clarification or add additional context in comments.

1 Comment

You have to pass bgi::dynamic_quadratic object as the second constructor parameter but the constructor of bgi::dynamic_quadratic takes max number of elements of a node of the rtree (this corresponds to bgi::quadratic template parameters). In your example the size of points std::vector is implicitly converted to bgi::dynamic_quadratic (this probably shouldn't be allowed at all) so you create rtree having only one huge node containing all of the elements. This rtree won't speed anything up. You should pass bgi::dynamic_quadratic(16) as the second parameter instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.