**Subject:** [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon

**From:** Boost C++ Libraries (*noreply_at_[hidden]*)

**Date:** 2013-04-03 13:13:46

**Next message:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8375: sym_difference of non-closed polygons returns closed polygon"**Previous message:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8361: Linking problems with MSVC"**Next in thread:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"**Reply:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"**Reply:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"**Reply:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"**Reply:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"**Reply:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"**Reply:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"**Reply:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"

#8376: difference of non-closed polygons returns closed polygon

-----------------------------------------------------------------------+----

Reporter: Volker SchÃ¶ch <vschoech@â€¦> | Owner: barendgehrels

Type: Bugs | Status: new

Milestone: To Be Determined | Component: geometry

Version: Boost 1.52.0 | Severity: Problem

Keywords: difference, multi-polygon, polygon, closed, open, correct |

-----------------------------------------------------------------------+----

The output multi-polygon from boost::geometry::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.

''Note: The sym_difference algorithm has the same problem which I filed as

a separate ticket #8375.''

This is the data used as input to difference:

{{{

_TPolygon<int> const polygon =

_TPolygon<int>("MULTIPOLYGON(((1920 1462,3720 1462,3720 3262,1920

3262)))")

- _TPolygon<int>("MULTIPOLYGON(((1918 1957,1918 1657,2218

2189)),((3718 1957,3360 2233,3718 1561)),((3360 2233,2818 3253,2218

2189,2818 2653)))");

}}}

This is the resulting multi-polygon, with the first contained polygon

being closed:

{{{

MULTIPOLYGON(((1920 1660,1920 1462,3720 1462,3720 3262,1920 3262,1920

1958,2218 2189,1920 1660),(3718 1561,3360 2233,3718 1957),(2818 2653,2218

2189,2818 3253,3360 2233)))

}}}

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

{

// should not be necessary

//if( boost::geometry::area(geometry)==0 ) return *this;

_TPolygon< T > polygonOut;

boost::geometry::difference(*this, geometry, polygonOut);

// should not be necessary

//boost::geometry::correct( polygonOut );

return polygonOut;

}

}}}

-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/8376> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.

**Next message:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8375: sym_difference of non-closed polygons returns closed polygon"**Previous message:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8361: Linking problems with MSVC"**Next in thread:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"**Reply:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"**Reply:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"**Reply:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"**Reply:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"**Reply:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"**Reply:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"**Reply:**Boost C++ Libraries: "Re: [Boost-bugs] [Boost C++ Libraries] #8376: difference of non-closed polygons returns closed polygon"

*
This archive was generated by hypermail 2.1.7
: 2017-02-16 18:50:12 UTC
*