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: Bryant <>
  • To:
  • Subject: Re: [cgal-discuss] Simple Polygon Difference Results in Non-Simple Polygon
  • Date: Thu, 21 Feb 2019 02:11:08 -0600 (CST)
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=SoftFail ; spf=Pass
  • Ironport-phdr: 9a23:5Moz9xz2qcQQFUzXCy+O+j09IxM/srCxBDY+r6Qd1OMRIJqq85mqBkHD//Il1AaPAd2Lraocw8Pt8InYEVQa5piAtH1QOLdtbDQizfssogo7HcSeAlf6JvO5JwYzHcBFSUM3tyrjaRsdF8nxfUDdrWOv5jAOBBr/KRB1JuPoEYLOksi7ze+/94HQbglSmDaxfa55IQmrownWqsQYm5ZpJLwryhvOrHtIeuBWyn1tKFmOgRvy5dq+8YB6/ShItP0v68BPUaPhf6QlVrNYFygpM3o05MLwqxbOSxaE62YGXWUXlhpIBBXF7A3/U5zsvCb2qvZx1S+HNsDwULs6Wymt771zRRHmiCkJKT03/2PZisJtg61UvB2vqgdjw4PWfI2ZKOZycr/Dcd4cWGFPXtxRVytEAo6kcoYPFeoAMvxer4nhulADqgCxBROsBez1zD9ImmP53bAg0+Q9FgHLxwMgH9cUv3TVqNX5LrsdUeewzKTRyzjIcv1Y2TD46IfScxAhp+mBXbRqfsXK0kYvEx3Kgk+MpoziOjOZzuUNs26B7+phT+2jkWAnqxtprjezyccjkI3JipgSylDe+iV0xps+K96gSENjfNKpFJ9duzuUOoZ1WM8vQGBltDw7x7AHv5OwYTIEx449xxHFbvyKa4iI7QznVOaWOTp4gn1odKi5hxmo6kev0en8Wdeu3FlWqSpFl8HAtnEL1xPN9siKUuZx80Ol1DqV2Q3e6ftILEM1mKbBKpMsw6Y8lp8JvkTCGi/2ll/2jKiTdkg84eeo8eTmba/gpp+AK4B0lxv+MrgpmsGkDuQ4NxIBX2mf+eimyLLj+kj5TK1QjvIqiqnZrIzaJcMDq6GlDA9ayIIj5w+iADeny9QXgWQHLEleeB+clIjoO1TOIOjiAvulglSsli1rx/HcMbH7DJXNNCuLrbH6YLwo61JA0BFhipdE9pdMA/cAJujyUwn/rpvDHxohOku1xejgT95y34dbVWOUCbKCK/DutgqD6esrZuWNf4QIoy3VKv4/5veog2Vqt0UaePyDx4oebmzwSv58MkyffXHxmMsGOWgPtws6CuftjQvRAnZoe3+uUvdktXkAA4W8ANKbH9H/sPm6xC6+W6ZuSCVDA1GIH23vctzdCfgJYSOWZMRml25fDOTze8oazRir8TTC5f9/NOONo38XsJvi0J5+4OiBzUhvpwwxNNyU1iS2d08xnm4MQGZrjqYj50p0wF2H3O5zhPkKTNE=

Thank you for your reply!

You were correct that I meant:

> The above code results in poly_set containing
/*
> a polygon with holes with the following outer boundary
*/
I'm still surprised that I never came across this fact while reading the
docs.

Nevertheless, do you know of a /built-in/ way of converting a relatively
simple polygon into a list of simple ones? I'm not finding anything online.


Efi Fogel wrote
> 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 &lt;

> bryantcurto@

> &gt; 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
>>
>>
>>
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://sympa.inria.fr/sympa/info/cgal-discuss





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



Archive powered by MHonArc 2.6.18.

Top of Page