Sanitising polygons before insertion into polygon set

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Sanitising polygons before insertion into polygon set

chgans
Hi there,

Every now and then when I join polygons into a polygon set, the
polygon set becomes invalid.

To make sure i am not inserting invalid polygon, i have tried to check
them all individually before calling join(), eg:

std::vector<Polygon_2> allPolygons;
buildPolygons(allPolygons);
Polygon_set_2 S;
for (const auto &poly: allPolygons)
   if (!CGAL::is_valid_unknown_polygon(poly, S.traits()))
     qWarning() << "Found invalid input polygon";
S.join(allPolygons.begin(), allPolygons.end());
if (!S.is_valid()) {
  qDebug() << "Polygon set invalid after inserting all polygons";
}

When i run the above code, i get no "Found invalid input polygon"
warning, yet i get a final "Polygon set invalid after inserting all
polygons" along with this CGAL message:

CGAL warning: check violation!
Expression : false
File : /usr/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h
Line : 1407
Explanation: An inner component is located in the wrong face.
Refer to the bug-reporting instructions at http://www.cgal.org/bug_report.html

Is this a bug, or am I not doing the right checks against the input polygons?

Chris

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


Reply | Threaded
Open this post in threaded view
|

Re: Sanitising polygons before insertion into polygon set

Efi Fogel
If you are using an exact predicate and exact construction kernel, then it seems like a bug; either in the union operation (join) or the validity check.

   ____  _        ____             _
  /_____/_) o    /__________  __  //
 (____ (   (    (    (_/ (_/-(-'_(/
                         _/



On 7 April 2017 at 04:51, Ch'Gans <[hidden email]> wrote:
Hi there,

Every now and then when I join polygons into a polygon set, the
polygon set becomes invalid.

To make sure i am not inserting invalid polygon, i have tried to check
them all individually before calling join(), eg:

std::vector<Polygon_2> allPolygons;
buildPolygons(allPolygons);
Polygon_set_2 S;
for (const auto &poly: allPolygons)
   if (!CGAL::is_valid_unknown_polygon(poly, S.traits()))
     qWarning() << "Found invalid input polygon";
S.join(allPolygons.begin(), allPolygons.end());
if (!S.is_valid()) {
  qDebug() << "Polygon set invalid after inserting all polygons";
}

When i run the above code, i get no "Found invalid input polygon"
warning, yet i get a final "Polygon set invalid after inserting all
polygons" along with this CGAL message:

CGAL warning: check violation!
Expression : false
File : /usr/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h
Line : 1407
Explanation: An inner component is located in the wrong face.
Refer to the bug-reporting instructions at http://www.cgal.org/bug_report.html

Is this a bug, or am I not doing the right checks against the input polygons?

Chris

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



Reply | Threaded
Open this post in threaded view
|

Re: Sanitising polygons before insertion into polygon set

Julia Fischer


On 7 April 2017 at 22:36, Efi Fogel <[hidden email]> wrote:
If you are using an exact predicate and exact construction kernel, then it seems like a bug; either in the union operation (join) or the validity check.

   ____  _        ____             _
  /_____/_) o    /__________  __  //
 (____ (   (    (    (_/ (_/-(-'_(/
                         _/



On 7 April 2017 at 04:51, Ch'Gans <[hidden email]> wrote:
Hi there,

Every now and then when I join polygons into a polygon set, the
polygon set becomes invalid.

To make sure i am not inserting invalid polygon, i have tried to check
them all individually before calling join(), eg:

std::vector<Polygon_2> allPolygons;
buildPolygons(allPolygons);
Polygon_set_2 S;
for (const auto &poly: allPolygons)
   if (!CGAL::is_valid_unknown_polygon(poly, S.traits()))
     qWarning() << "Found invalid input polygon";
S.join(allPolygons.begin(), allPolygons.end());
if (!S.is_valid()) {
  qDebug() << "Polygon set invalid after inserting all polygons";
}

When i run the above code, i get no "Found invalid input polygon"
warning, yet i get a final "Polygon set invalid after inserting all
polygons" along with this CGAL message:

CGAL warning: check violation!
Expression : false
File : /usr/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h
Line : 1407
Explanation: An inner component is located in the wrong face.
Refer to the bug-reporting instructions at http://www.cgal.org/bug_report.html

Is this a bug, or am I not doing the right checks against the input polygons?

Chris

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





signature.sig (15K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Sanitising polygons before insertion into polygon set

chgans
In reply to this post by Efi Fogel
On 8 April 2017 at 08:36, Efi Fogel <[hidden email]> wrote:
> If you are using an exact predicate and exact construction kernel, then it
> seems like a bug; either in the union operation (join) or the validity
> check.

I am using Epeck, so there's either a bug in my code, in the
validation or in the set.
I have tried to build a use case that show the problem without having
to insert thousands of polygons.
So far the simplest use case i found requires to insert ca. 100 circles.
Next step is to serialise these circles and write a simple program to
read them back and insert them into a set, if the problem is still
there, then i will open a ticket on github with the data file and the
simple program.

Chris

>
>    ____  _        ____             _
>   /_____/_) o    /__________  __  //
>  (____ (   (    (    (_/ (_/-(-'_(/
>                          _/
>
>
>
> On 7 April 2017 at 04:51, Ch'Gans <[hidden email]> wrote:
>>
>> Hi there,
>>
>> Every now and then when I join polygons into a polygon set, the
>> polygon set becomes invalid.
>>
>> To make sure i am not inserting invalid polygon, i have tried to check
>> them all individually before calling join(), eg:
>>
>> std::vector<Polygon_2> allPolygons;
>> buildPolygons(allPolygons);
>> Polygon_set_2 S;
>> for (const auto &poly: allPolygons)
>>    if (!CGAL::is_valid_unknown_polygon(poly, S.traits()))
>>      qWarning() << "Found invalid input polygon";
>> S.join(allPolygons.begin(), allPolygons.end());
>> if (!S.is_valid()) {
>>   qDebug() << "Polygon set invalid after inserting all polygons";
>> }
>>
>> When i run the above code, i get no "Found invalid input polygon"
>> warning, yet i get a final "Polygon set invalid after inserting all
>> polygons" along with this CGAL message:
>>
>> CGAL warning: check violation!
>> Expression : false
>> File : /usr/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h
>> Line : 1407
>> Explanation: An inner component is located in the wrong face.
>> Refer to the bug-reporting instructions at
>> http://www.cgal.org/bug_report.html
>>
>> Is this a bug, or am I not doing the right checks against the input
>> polygons?
>>
>> Chris
>>
>> --
>> 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


Reply | Threaded
Open this post in threaded view
|

Re: Sanitising polygons before insertion into polygon set

Efi Fogel
Thanks, please do. 

On Apr 12, 2017 03:58, "Ch'Gans" <[hidden email]> wrote:
On 8 April 2017 at 08:36, Efi Fogel <[hidden email]> wrote:
> If you are using an exact predicate and exact construction kernel, then it
> seems like a bug; either in the union operation (join) or the validity
> check.

I am using Epeck, so there's either a bug in my code, in the
validation or in the set.
I have tried to build a use case that show the problem without having
to insert thousands of polygons.
So far the simplest use case i found requires to insert ca. 100 circles.
Next step is to serialise these circles and write a simple program to
read them back and insert them into a set, if the problem is still
there, then i will open a ticket on github with the data file and the
simple program.

Chris

>
>    ____  _        ____             _
>   /_____/_) o    /__________  __  //
>  (____ (   (    (    (_/ (_/-(-'_(/
>                          _/
>
>
>
> On 7 April 2017 at 04:51, Ch'Gans <[hidden email]> wrote:
>>
>> Hi there,
>>
>> Every now and then when I join polygons into a polygon set, the
>> polygon set becomes invalid.
>>
>> To make sure i am not inserting invalid polygon, i have tried to check
>> them all individually before calling join(), eg:
>>
>> std::vector<Polygon_2> allPolygons;
>> buildPolygons(allPolygons);
>> Polygon_set_2 S;
>> for (const auto &poly: allPolygons)
>>    if (!CGAL::is_valid_unknown_polygon(poly, S.traits()))
>>      qWarning() << "Found invalid input polygon";
>> S.join(allPolygons.begin(), allPolygons.end());
>> if (!S.is_valid()) {
>>   qDebug() << "Polygon set invalid after inserting all polygons";
>> }
>>
>> When i run the above code, i get no "Found invalid input polygon"
>> warning, yet i get a final "Polygon set invalid after inserting all
>> polygons" along with this CGAL message:
>>
>> CGAL warning: check violation!
>> Expression : false
>> File : /usr/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h
>> Line : 1407
>> Explanation: An inner component is located in the wrong face.
>> Refer to the bug-reporting instructions at
>> http://www.cgal.org/bug_report.html
>>
>> Is this a bug, or am I not doing the right checks against the input
>> polygons?
>>
>> Chris
>>
>> --
>> 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