Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Simple Polygon Difference Results in Non-Simple Polygon

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Simple Polygon Difference Results in Non-Simple Polygon


Chronological Thread 
  • From: Efi Fogel <>
  • To:
  • Subject: Re: [cgal-discuss] Simple Polygon Difference Results in Non-Simple Polygon
  • Date: Wed, 20 Feb 2019 12:00:54 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:h3r88hfJpEP6e4n07TZhQznelGMj4u6mDksu8pMizoh2WeGdxcS7bR7h7PlgxGXEQZ/co6odzbaO4+a4ASQp2tWoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7Ovr6GpLIj8Swyuu+54Dfbx9HiTahYr5+Ngm6oRnMvcQKnIVuLbo8xAHUqXVSYeRWwm1oJVOXnxni48q74YBu/SdNtf8/7sBMSar1cbg2QrxeFzQmLns65Nb3uhnZTAuA/WUTX2MLmRdVGQfF7RX6XpDssivms+d2xSeXMdHqQb0yRD+v6bpgRh31hycdLzM2/2/Xhc5wgqxVoxyvugJxzJLPbY6PKPZzZLnQcc8GSWdDWMtaSixPApm7b4sKF+cPMuhYr4jgrFUOqhu+ChejBOfywTJPmHD206w60+omEQHJwgMgG8kDsHvRrNrvNacSVfq5w7XPzTXGdv5b3yr25obPchAku/6MXLRwfNLXyUY1DAzKlVGQppL/MzyJ0eQNtnCX7+tmVeK1im4osRt9oja1xss0lobJiZgaylTe+SV+2oY1Ktu1Q1N4b968CJZcqT2WOo9sTs4hQ2xkojg2xqAatZKhYSQHyokryhjCYPKdaYeI+AjsVOOJLDd4mn1lfLW/ig638Ue6y+38UtC40E5EriZYi9XMuG0B2h7O5sSdRft9+UCh2TmL1w/N8O1LPUc0la/DJ54gxL4/iIYTvFzdEiPqnEj6lqybe0U+9uS29ujrfq/qqoKeOoNpkg3+N74hms27AeQ2KAgOWG2b9Pyi273t/E35TrJKjvIonandq53aKsEbqbS4Aw9RyIos9xG/DzK+3NQCgXYHNE5FeA6Aj4XxJ17OL+r3DfOmj1uxkTdr3OzJPqD6ApXWNXXDi7fgfbNl60FG0gYzzNZf54hVCr4bOv7zVFXx55TlCAQkOVm03/r/E4c6kZgPXHqGRK6fKqLb91GSofk+JvGFI44TtjG6IPcs47vijGQyhEQGLpWuiJAYYXT9EvV9KFiCelLthM0AGCEEpFkQVuvv3XCMUHZ9YHm/W+po6z86BoWpAIPrSYWkgbjH1yC+SM4FLltaA0yBRC+7P76PXO0BPXrLc51R1wccXL3kcLcPkBSntQv00b1id7OG9SgRtJal399wtbSKyUMCsAdsBsHY6FmjCnlulzpRFTAz1aF750d6zwXbiPUqs7ljDdVWoshxfEI6OJrblbIoDtnzXkfZcI7MRg/5G5OpBjY+St93yNgLMR5w

I haven't tested it myself, but if you meant to say:

The above code results in poly_set containing a polygon with holes with the following outer boundary:
(0, 1), (1, 1), (1, 0), (2, 0), (2, 1), (1, 1), (1, 2), (0, 2)

Then there is no problem, cause according to the rules the boundary is a relatively simple polygon; see https://doc.cgal.org/latest/Boolean_set_operations_2/index.html
   ____  _        ____             _
  /_____/_) o    /__________  __  //
 (____ (   (    (    (_/ (_/-(-'_(/
                         _/




On Wed, 20 Feb 2019 at 06:17, Bryant <> wrote:
When taking the difference between a /simple/ Polygon_set_2 and a /simple/
Polygon_2, the result may be non-simple. This appears to occur when one
would expect the difference to result in two polygons with holes that share
a point.

I use the following definitions:
- A Polygon_set_2 is simple if the Polygon_with_holes_2s composing it are
simple.
- A Polygon_with_holes_2 is simple if its outer boundary and holes are
simple.

Here's a minimum working example:
        CGAL::Polygon_2<K> poly1;
        poly1.push_back(CGAL::Point_2<K>(0, 0));
        poly1.push_back(CGAL::Point_2<K>(2, 0));
        poly1.push_back(CGAL::Point_2<K>(2, 1));
        poly1.push_back(CGAL::Point_2<K>(1, 1));
        poly1.push_back(CGAL::Point_2<K>(1, 2));
        poly1.push_back(CGAL::Point_2<K>(0, 2));
        CGAL::Polygon_set_2<K> poly_set(poly1);

        CGAL::Polygon_2<K> hole;
        hole.push_back(CGAL::Point_2<K>(0, 0));
        hole.push_back(CGAL::Point_2<K>(1, 0));
        hole.push_back(CGAL::Point_2<K>(1, 1));
        hole.push_back(CGAL::Point_2<K>(0, 1));

        poly_set.difference(hole);

Note: I have only tested with the EPEC Kernel.

The above code results in poly_set containing the following polygon:
(0, 1), (1, 1), (1, 0), (2, 0), (2, 1), (1, 1), (1, 2), (0, 2)

I would expect it to contain the following polygons:
(1, 0), (2, 0), (2, 1), (1, 1)
        and
(0, 1), (1, 1), (1, 2), (0, 2)




--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss





Archive powered by MHonArc 2.6.18.

Top of Page