boost::geometry union & difference &r-tree error
I want to "union" or "clipper" two rectangle but I always get the wrong output.
so I used "fsanitize=undefined" command to check my code, and it report a overflow error.
I think the all points of the tow rectangle in the integer range,so my question is if the points range
will be "long long" How do I define the type of point_xy to make sure it doesn't overflow when I used the function "union_" "difference" , and some time I used boost r-tree will also get the error.
Yes, this is caused by the fact that too small coordinate_type is used. And currently Boost.Geometry does nothing about it. You could try passing a CalculationType of greater size only for the purpose of calculation with the strategy explicitly, e.g.:
bg::difference(blue, green, output,
bg::strategy::intersection::cartesian_segments<long long>());
I can imagine that by default the library could care about overflow though. So my question is: @barendgehrels do we consider it a bug?
@ChenI-Hsuan Do you have a test case for the R-tree?