Boost logo

Geometry :

Subject: [ggl] geometry::intersection
From: Adam Wulkiewicz (adam.wulkiewicz)
Date: 2011-03-27 09:47:28


Hi,

I noticed that geometry::intersection(box1, box2, out_box) don't
modifies out_box if boxes don't overlap. E.g. for following code:

typedef boost::geometry::model::point<float, 2,
boost::geometry::cs::cartesian> P;
typedef boost::geometry::model::box<P> B;

B b1(P(1, 1),P(3, 3));
B b2(P(4, 4),P(5, 5));
B inters;
boost::geometry::intersection(b1, b2, inters);

Is this intentional? Shouldn't this produce box 0,0 x 0,0 ?

If boxes do overlap the intersection is calculated properly.

E.g.

B b1(P(1, 1),P(4, 4));
B b2(P(4, 4),P(5, 5));

produces 4, 4 x 4, 4.

Tested on vs2010 and g++ 4.5.2.

Btw this is the reason of std::length_exception throwing or heap
corruption in rtree. I've commited a patch.

Regards,
Adam


Geometry list run by mateusz at loskot.net