|
Geometry : |
Subject: Re: [geometry] Accuray issue with geometry::difference() in version Boost 1.57
From: Mikkel B. Stegmann (mikkel.stegmann_at_[hidden])
Date: 2015-04-20 03:04:30
Dear Geometry list,
the difference issue persists in v1.58. Apparently, it is related to the
rescaling policy introduced in v1.56 (if I read previous posts correct).
Although I'm reluctant to do so, I can mitigate the issue be defining
the BOOST_GEOMETRY_NO_ROBUSTNESS:
difference polygon: (249232.00000000003, 761089) (249232, 760980)
(265886.20000000001, 760980) (265886.20000000001, 729219) (94021,
729219) (94021, 761089)
Should this be elevated to a ticket?
Best regards,
Mikkel B. Stegmann
On 17/04/15 10:47, Mikkel B. Stegmann wrote:
> Hi Menalaos,
>
> somehow the results and code (including input data) got stripped in the
> mail-version of my post. Here it is without raw-tags:
>
> Result using Boost v1.55:
>
> 249.232 761.09
> 249.232 760.98
> 265.89 760.98
> 265.89 729.219
> 94.021 729.219
> 94.021 761.09
> 249.232 761.09
>
>
> Result using Boost v1.57:
>
> 249.232003466816 761.09
> 249.232 760.98
> 265.89 760.979984987659
> 265.89 729.219
> 94.021 729.219
> 94.021 761.09
> 249.232003466816 761.09
>
> ----
>
> #include <boost/foreach.hpp>
> #include <boost/geometry/geometries/point_xy.hpp>
> #include <boost/geometry.hpp>
>
> #include <cstdio>
> #include <assert.h>
>
> int main() {
>
> // 2D point with double precision
> typedef boost::geometry::model::d2::point_xy<double> BoostPoint;
>
> // 2D polygon, ring type: clockwise, closed ("the first point must be
> spatially equal to the last point")
> typedef boost::geometry::model::polygon<BoostPoint> BoostPolygon;
>
> BoostPolygon rectangleA;
> rectangleA.outer().push_back(BoostPoint( 94.021, 729.219)); // clock-wise
> points
> rectangleA.outer().push_back(BoostPoint( 94.021, 761.090));
> rectangleA.outer().push_back(BoostPoint(265.890, 761.090));
> rectangleA.outer().push_back(BoostPoint(265.890, 729.219));
> rectangleA.outer().push_back(BoostPoint( 94.021, 729.219)); // close
>
> BoostPolygon rectangleB;
> rectangleB.outer().push_back(BoostPoint(249.232, 760.980)); // clock-wise
> points
> rectangleB.outer().push_back(BoostPoint(249.232, 780.980));
> rectangleB.outer().push_back(BoostPoint(319.232, 780.980));
> rectangleB.outer().push_back(BoostPoint(319.232, 760.980));
> rectangleB.outer().push_back(BoostPoint(249.232, 760.980)); // close
>
> std::list<BoostPolygon> differencePolygons;
> boost::geometry::difference(rectangleA, rectangleB, differencePolygons);
> assert(differencePolygons.size()==1);
>
> BOOST_FOREACH(const BoostPoint &point, differencePolygons.front().outer())
> {
> printf("%16.15g %16.15g\n", point.x(), point.y());
> }
>
> return 0;
> }
>
>
>
>
> --
> View this message in context: http://boost-geometry.203548.n3.nabble.com/Accuray-issue-with-geometry-difference-in-version-Boost-1-57-tp4026545p4026547.html
> Sent from the Boost Geometry mailing list archive at Nabble.com.
> _______________________________________________
> Geometry mailing list
> Geometry_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/geometry
Geometry list run by mateusz at loskot.net