Opened 10 years ago
Closed 8 years ago
#8375 closed Bugs (fixed)
sym_difference of non-closed polygons returns closed polygon
Reported by: | Owned by: | Barend Gehrels | |
---|---|---|---|
Milestone: | Boost 1.56.0 | Component: | geometry |
Version: | Boost 1.55.0 | Severity: | Problem |
Keywords: | sym_difference, multi-polygon, polygon, closed, open, correct | Cc: |
Description
The output multi-polygon from boost::geometry::sym_difference should have the same orientation, closed-ness and underlying scalar data type, as the input (multi-)polygons. My polygon type is oriented counter-clockwise and not closed, my point type is based on int. Please find below some code that results in a closed polygon.
This is the data used as input to sym_difference:
_TPolygon<int> const polygonB = _TPolygon<int>("MULTIPOLYGON(((813 277,1341 319,1863 361,2391 571,2913 361,3441 319,3963 277,3963 32767,813 32767)))") ^ _TPolygon<int>("MULTIPOLYGON(((813 277,1341 319,1863 571,2391 571,2913 571,3441 319,3963 277,3963 32767,813 32767)))");
This is the resulting multi-polygon, consisting of two closed polygons:
polygonB: MULTIPOLYGON(((2391 571,1863 571,1341 319,1863 361,2391 571)),((2391 571,2913 361,3441 319,2913 571,2391 571)))
This is my code that wraps boost::geometry to implement the operator used above:
template<typename T> template<typename Geometry> _TPolygon< T > _TPolygon< T >::operator^(Geometry const& geometry) const { _TPolygon< T > polygonOut; boost::geometry::sym_difference(*this, geometry, polygonOut); // should not be necessary //boost::geometry::correct( polygonOut ); return polygonOut; }
Attachments (2)
Change History (11)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
The difference algorithm has the same problem which I filed as a separate ticket #8376.
comment:3 by , 9 years ago
Status: | new → assigned |
---|
comment:4 by , 9 years ago
Version: | Boost 1.52.0 → Boost 1.55.0 |
---|
Still reproducible with boost 1.55.0.
comment:6 by , 8 years ago
See attached test program and output, as well as comments in ticket #9828
by , 8 years ago
Attachment: | ticket_8375.cpp added |
---|
stand-along program for reproducing ticket #8375
comment:7 by , 8 years ago
Resolution: | → worksforme |
---|---|
Status: | assigned → closed |
by , 8 years ago
Attachment: | ticket_8375.out added |
---|
output of test program for ticket #8375 (corrected)
comment:8 by , 8 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
comment:9 by , 8 years ago
Milestone: | To Be Determined → Boost 1.56.0 |
---|---|
Resolution: | → fixed |
Status: | reopened → closed |
Our conversation on the geometry mailing list regarding this issue in 1.48.0: http://lists.boost.org/geometry/2012/02/1857.php