Open
Description
The sample code:
static const char p1_wkt[] = "POLYGON((-124.19999999845255 51.901455507812500, -124.19999999460376 51.935823093966235, -123.99999999648789 51.935823093966235, -123.99999999317222 51.902564290309876, -124.19999999845255 51.901455507812500))";
static const char p2_wkt[] = "POLYGON((-123.99999999367975 51.907655109375000, -123.99999999291659 51.900000006653443, -124.19999999861555 51.900000005468293, -124.19999999792353 51.906179355468751, -123.99999999367975 51.907655109375000))";
TEST_F( SpatialOperationF, t3_double )
{
using point = boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>;
using polygon = boost::geometry::model::polygon<point>;
using polygon_vector = std::vector<polygon>;
auto left = boost::geometry::from_wkt<polygon>( p1_wkt );
auto right = boost::geometry::from_wkt<polygon>( p2_wkt );
{
THIS_IS_A_BUG();
polygon_vector actual;
boost::geometry::difference( left, right, actual );
EXPECT_EQ( 0, actual.size() );
}
{
polygon_vector actual;
boost::geometry::intersection( left, right, actual );
EXPECT_EQ( 1, actual.size() );
}
{
polygon_vector actual;
/* swap arguments */
boost::geometry::difference( right, left, actual );
EXPECT_EQ( 1, actual.size() );
}
}
The same code ran with float
data type produces expected results (1 polygon in difference results)