CGAL fails with insertion operation in 2D arrangements

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

CGAL fails with insertion operation in 2D arrangements

Dinesh
When I switched to CGAL 4.12-beta2 from CGAL-4.4, I get following exception thrown
Exception: CGAL ERROR: precondition violation!
Expr: (m_traits.compare_y_at_x_2_object()(p, cv) == EQUAL) && compare_xy(cv.left(), p) == SMALLER && compare_xy(cv.right(), p) == LARGER
File: D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Arr_segment_traits_2.h
Line: 714

Any help appreciated..

On stackExchange
Reply | Threaded
Open this post in threaded view
|

Re: CGAL fails with insertion operation in 2D arrangements

Efi Fogel
Please provide a test case that reproduces the problem.

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



On 24 April 2018 at 17:32, Dinesh Shetty <[hidden email]> wrote:
When I switched to CGAL 4.12-beta2 from CGAL-4.4, I get following exception thrown
Exception: CGAL ERROR: precondition violation!
Expr: (m_traits.compare_y_at_x_2_object()(p, cv) == EQUAL) && compare_xy(cv.left(), p) == SMALLER && compare_xy(cv.right(), p) == LARGER
File: D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Arr_segment_traits_2.h
Line: 714

Any help appreciated..

On stackExchange

Reply | Threaded
Open this post in threaded view
|

Re: CGAL fails with insertion operation in 2D arrangements

Dinesh
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT                                        Number_type;

typedef CGAL::Arr_segment_traits_2<Kernel>              Traits;
typedef Traits::Point_2                                 Point;
typedef Traits::X_monotone_curve_2                      Segment;

typedef CGAL::Arrangement_2<Traits>                     Arrangement;
typedef Arrangement::Vertex_handle                      Vertex_handle;
typedef Arrangement::Halfedge_handle                    Halfedge_handle;
typedef Arrangement::Face_handle                        Face_handle;
typedef Arrangement::Vertex_const_handle                Vertex_const_handle;
typedef Arrangement::Halfedge_const_handle              Halfedge_const_handle;


typedef CGAL::Arr_consolidated_curve_data_traits_2<Traits, int>
Data_traits;
typedef Data_traits::Curve_2                               Numbered_segment;
typedef CGAL::Arrangement_2<Data_traits>                   Numbered_arr;

Numbered_arr   arr;


insert(arr, Numbered_segment(Segment(Point(1.6831200000000E+02,-1.3992000000000E+01), Point( 1.2253100000000E+02, -2.0889000000000E+01)), 6));
insert(arr, Numbered_segment(Segment(Point(1.6490200000000E+02, 1.0314000000000E+01), Point( 1.0342400000000E+02, 4.2850000000000E+00)), 11));
insert(arr, Numbered_segment(Segment(Point(1.7217000000000E+02,-3.2611000000000E+01), Point( 9.9756000000000E+01, -4.3728000000000E+01)), 16));
insert(arr, Numbered_segment(Segment(Point(1.4197300000000E+02, 5.4490000000000E+00), Point( 1.4887000000000E+02, -4.0331000000000E+01)), 51));
std::stringstream ss;
Numbered_arr::Vertex_const_iterator   vit;
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) 
{
std::map<int, int> Frequency;
Numbered_arr::Halfedge_around_vertex_const_circulator eit, first;
eit = first = vit->incident_halfedges();
do 
{

++Frequency[eit->curve().data().front()];

} while (++eit != first);

ss << "@ ( " << vit->point() << ")" <<std::endl;
for(auto & itr : Frequency)
{
ss<<itr.first<<" apprears "<<itr.second<<"\n";
}

}


Numbered_arr::Edge_const_iterator eit;
std::vector<int> Pid;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) 
{
Data_traits::Data_container::const_iterator  it;

if(eit->curve().data().size()> 1)
{
Pid.clear();
Pid.reserve(eit->curve().data().size());
for (it = eit->curve().data().begin(); it != eit->curve().data().end(); ++it)
{
Pid.push_back(*it);
}
ss<<"Overlap detected : ";
for(auto & itr : Pid)
ss<<itr<<" ";
ss<<"\n";
}
}



ss << arr.number_of_edges() << " edges:" << std::endl;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit)
ss << "[" << eit->curve() << "]" << std::endl;

On Tue, Apr 24, 2018 at 12:33 PM, Efi Fogel <[hidden email]> wrote:
Please provide a test case that reproduces the problem.

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



On 24 April 2018 at 17:32, Dinesh Shetty <[hidden email]> wrote:
When I switched to CGAL 4.12-beta2 from CGAL-4.4, I get following exception thrown
Exception: CGAL ERROR: precondition violation!
Expr: (m_traits.compare_y_at_x_2_object()(p, cv) == EQUAL) && compare_xy(cv.left(), p) == SMALLER && compare_xy(cv.right(), p) == LARGER
File: D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Arr_segment_traits_2.h
Line: 714

Any help appreciated..

On stackExchange


Reply | Threaded
Open this post in threaded view
|

Re: CGAL fails with insertion operation in 2D arrangements

Efi Fogel
This could have never worked.
You are using inexact construction.
Change the first line to:

typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;

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



On 24 April 2018 at 22:07, Dinesh Shetty <[hidden email]> wrote:
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT                                        Number_type;

typedef CGAL::Arr_segment_traits_2<Kernel>              Traits;
typedef Traits::Point_2                                 Point;
typedef Traits::X_monotone_curve_2                      Segment;

typedef CGAL::Arrangement_2<Traits>                     Arrangement;
typedef Arrangement::Vertex_handle                      Vertex_handle;
typedef Arrangement::Halfedge_handle                    Halfedge_handle;
typedef Arrangement::Face_handle                        Face_handle;
typedef Arrangement::Vertex_const_handle                Vertex_const_handle;
typedef Arrangement::Halfedge_const_handle              Halfedge_const_handle;


typedef CGAL::Arr_consolidated_curve_data_traits_2<Traits, int>
Data_traits;
typedef Data_traits::Curve_2                               Numbered_segment;
typedef CGAL::Arrangement_2<Data_traits>                   Numbered_arr;

Numbered_arr   arr;


insert(arr, Numbered_segment(Segment(Point(1.6831200000000E+02,-1.3992000000000E+01), Point( 1.2253100000000E+02, -2.0889000000000E+01)), 6));
insert(arr, Numbered_segment(Segment(Point(1.6490200000000E+02, 1.0314000000000E+01), Point( 1.0342400000000E+02, 4.2850000000000E+00)), 11));
insert(arr, Numbered_segment(Segment(Point(1.7217000000000E+02,-3.2611000000000E+01), Point( 9.9756000000000E+01, -4.3728000000000E+01)), 16));
insert(arr, Numbered_segment(Segment(Point(1.4197300000000E+02, 5.4490000000000E+00), Point( 1.4887000000000E+02, -4.0331000000000E+01)), 51));
std::stringstream ss;
Numbered_arr::Vertex_const_iterator   vit;
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) 
{
std::map<int, int> Frequency;
Numbered_arr::Halfedge_around_vertex_const_circulator eit, first;
eit = first = vit->incident_halfedges();
do 
{

++Frequency[eit->curve().data().front()];

} while (++eit != first);

ss << "@ ( " << vit->point() << ")" <<std::endl;
for(auto & itr : Frequency)
{
ss<<itr.first<<" apprears "<<itr.second<<"\n";
}

}


Numbered_arr::Edge_const_iterator eit;
std::vector<int> Pid;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) 
{
Data_traits::Data_container::const_iterator  it;

if(eit->curve().data().size()> 1)
{
Pid.clear();
Pid.reserve(eit->curve().data().size());
for (it = eit->curve().data().begin(); it != eit->curve().data().end(); ++it)
{
Pid.push_back(*it);
}
ss<<"Overlap detected : ";
for(auto & itr : Pid)
ss<<itr<<" ";
ss<<"\n";
}
}



ss << arr.number_of_edges() << " edges:" << std::endl;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit)
ss << "[" << eit->curve() << "]" << std::endl;

On Tue, Apr 24, 2018 at 12:33 PM, Efi Fogel <[hidden email]> wrote:
Please provide a test case that reproduces the problem.

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



On 24 April 2018 at 17:32, Dinesh Shetty <[hidden email]> wrote:
When I switched to CGAL 4.12-beta2 from CGAL-4.4, I get following exception thrown
Exception: CGAL ERROR: precondition violation!
Expr: (m_traits.compare_y_at_x_2_object()(p, cv) == EQUAL) && compare_xy(cv.left(), p) == SMALLER && compare_xy(cv.right(), p) == LARGER
File: D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Arr_segment_traits_2.h
Line: 714

Any help appreciated..

On stackExchange



Reply | Threaded
Open this post in threaded view
|

Re: CGAL fails with insertion operation in 2D arrangements

Dinesh
Well my version with 4.4 works

On Wed, Apr 25, 2018 at 3:31 AM Efi Fogel <[hidden email]> wrote:
This could have never worked.
You are using inexact construction.
Change the first line to:

typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;

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



On 24 April 2018 at 22:07, Dinesh Shetty <[hidden email]> wrote:
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT                                        Number_type;

typedef CGAL::Arr_segment_traits_2<Kernel>              Traits;
typedef Traits::Point_2                                 Point;
typedef Traits::X_monotone_curve_2                      Segment;

typedef CGAL::Arrangement_2<Traits>                     Arrangement;
typedef Arrangement::Vertex_handle                      Vertex_handle;
typedef Arrangement::Halfedge_handle                    Halfedge_handle;
typedef Arrangement::Face_handle                        Face_handle;
typedef Arrangement::Vertex_const_handle                Vertex_const_handle;
typedef Arrangement::Halfedge_const_handle              Halfedge_const_handle;


typedef CGAL::Arr_consolidated_curve_data_traits_2<Traits, int>
Data_traits;
typedef Data_traits::Curve_2                               Numbered_segment;
typedef CGAL::Arrangement_2<Data_traits>                   Numbered_arr;

Numbered_arr   arr;


insert(arr, Numbered_segment(Segment(Point(1.6831200000000E+02,-1.3992000000000E+01), Point( 1.2253100000000E+02, -2.0889000000000E+01)), 6));
insert(arr, Numbered_segment(Segment(Point(1.6490200000000E+02, 1.0314000000000E+01), Point( 1.0342400000000E+02, 4.2850000000000E+00)), 11));
insert(arr, Numbered_segment(Segment(Point(1.7217000000000E+02,-3.2611000000000E+01), Point( 9.9756000000000E+01, -4.3728000000000E+01)), 16));
insert(arr, Numbered_segment(Segment(Point(1.4197300000000E+02, 5.4490000000000E+00), Point( 1.4887000000000E+02, -4.0331000000000E+01)), 51));
std::stringstream ss;
Numbered_arr::Vertex_const_iterator   vit;
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) 
{
std::map<int, int> Frequency;
Numbered_arr::Halfedge_around_vertex_const_circulator eit, first;
eit = first = vit->incident_halfedges();
do 
{

++Frequency[eit->curve().data().front()];

} while (++eit != first);

ss << "@ ( " << vit->point() << ")" <<std::endl;
for(auto & itr : Frequency)
{
ss<<itr.first<<" apprears "<<itr.second<<"\n";
}

}


Numbered_arr::Edge_const_iterator eit;
std::vector<int> Pid;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) 
{
Data_traits::Data_container::const_iterator  it;

if(eit->curve().data().size()> 1)
{
Pid.clear();
Pid.reserve(eit->curve().data().size());
for (it = eit->curve().data().begin(); it != eit->curve().data().end(); ++it)
{
Pid.push_back(*it);
}
ss<<"Overlap detected : ";
for(auto & itr : Pid)
ss<<itr<<" ";
ss<<"\n";
}
}



ss << arr.number_of_edges() << " edges:" << std::endl;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit)
ss << "[" << eit->curve() << "]" << std::endl;

On Tue, Apr 24, 2018 at 12:33 PM, Efi Fogel <[hidden email]> wrote:
Please provide a test case that reproduces the problem.

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



On 24 April 2018 at 17:32, Dinesh Shetty <[hidden email]> wrote:
When I switched to CGAL 4.12-beta2 from CGAL-4.4, I get following exception thrown
Exception: CGAL ERROR: precondition violation!
Expr: (m_traits.compare_y_at_x_2_object()(p, cv) == EQUAL) && compare_xy(cv.left(), p) == SMALLER && compare_xy(cv.right(), p) == LARGER
File: D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Arr_segment_traits_2.h
Line: 714

Any help appreciated..

On stackExchange



Reply | Threaded
Open this post in threaded view
|

Re: CGAL fails with insertion operation in 2D arrangements

Efi Fogel
When you use inexact construction, your program may work on some instances and may fail on other.
We do not guarantee anything.


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



On 25 April 2018 at 18:49, Dinesh Shetty <[hidden email]> wrote:
Well my version with 4.4 works

On Wed, Apr 25, 2018 at 3:31 AM Efi Fogel <[hidden email]> wrote:
This could have never worked.
You are using inexact construction.
Change the first line to:

typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;

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



On 24 April 2018 at 22:07, Dinesh Shetty <[hidden email]> wrote:
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT                                        Number_type;

typedef CGAL::Arr_segment_traits_2<Kernel>              Traits;
typedef Traits::Point_2                                 Point;
typedef Traits::X_monotone_curve_2                      Segment;

typedef CGAL::Arrangement_2<Traits>                     Arrangement;
typedef Arrangement::Vertex_handle                      Vertex_handle;
typedef Arrangement::Halfedge_handle                    Halfedge_handle;
typedef Arrangement::Face_handle                        Face_handle;
typedef Arrangement::Vertex_const_handle                Vertex_const_handle;
typedef Arrangement::Halfedge_const_handle              Halfedge_const_handle;


typedef CGAL::Arr_consolidated_curve_data_traits_2<Traits, int>
Data_traits;
typedef Data_traits::Curve_2                               Numbered_segment;
typedef CGAL::Arrangement_2<Data_traits>                   Numbered_arr;

Numbered_arr   arr;


insert(arr, Numbered_segment(Segment(Point(1.6831200000000E+02,-1.3992000000000E+01), Point( 1.2253100000000E+02, -2.0889000000000E+01)), 6));
insert(arr, Numbered_segment(Segment(Point(1.6490200000000E+02, 1.0314000000000E+01), Point( 1.0342400000000E+02, 4.2850000000000E+00)), 11));
insert(arr, Numbered_segment(Segment(Point(1.7217000000000E+02,-3.2611000000000E+01), Point( 9.9756000000000E+01, -4.3728000000000E+01)), 16));
insert(arr, Numbered_segment(Segment(Point(1.4197300000000E+02, 5.4490000000000E+00), Point( 1.4887000000000E+02, -4.0331000000000E+01)), 51));
std::stringstream ss;
Numbered_arr::Vertex_const_iterator   vit;
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) 
{
std::map<int, int> Frequency;
Numbered_arr::Halfedge_around_vertex_const_circulator eit, first;
eit = first = vit->incident_halfedges();
do 
{

++Frequency[eit->curve().data().front()];

} while (++eit != first);

ss << "@ ( " << vit->point() << ")" <<std::endl;
for(auto & itr : Frequency)
{
ss<<itr.first<<" apprears "<<itr.second<<"\n";
}

}


Numbered_arr::Edge_const_iterator eit;
std::vector<int> Pid;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) 
{
Data_traits::Data_container::const_iterator  it;

if(eit->curve().data().size()> 1)
{
Pid.clear();
Pid.reserve(eit->curve().data().size());
for (it = eit->curve().data().begin(); it != eit->curve().data().end(); ++it)
{
Pid.push_back(*it);
}
ss<<"Overlap detected : ";
for(auto & itr : Pid)
ss<<itr<<" ";
ss<<"\n";
}
}



ss << arr.number_of_edges() << " edges:" << std::endl;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit)
ss << "[" << eit->curve() << "]" << std::endl;

On Tue, Apr 24, 2018 at 12:33 PM, Efi Fogel <[hidden email]> wrote:
Please provide a test case that reproduces the problem.

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



On 24 April 2018 at 17:32, Dinesh Shetty <[hidden email]> wrote:
When I switched to CGAL 4.12-beta2 from CGAL-4.4, I get following exception thrown
Exception: CGAL ERROR: precondition violation!
Expr: (m_traits.compare_y_at_x_2_object()(p, cv) == EQUAL) && compare_xy(cv.left(), p) == SMALLER && compare_xy(cv.right(), p) == LARGER
File: D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Arr_segment_traits_2.h
Line: 714

Any help appreciated..

On stackExchange




Reply | Threaded
Open this post in threaded view
|

Re: CGAL fails with insertion operation in 2D arrangements

Dinesh
It worked for many years for all the problems I have tried, but I switch to 4.12 now it breaks

On Wed, Apr 25, 2018 at 10:55 AM Efi Fogel <[hidden email]> wrote:
When you use inexact construction, your program may work on some instances and may fail on other.
We do not guarantee anything.


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



On 25 April 2018 at 18:49, Dinesh Shetty <[hidden email]> wrote:
Well my version with 4.4 works

On Wed, Apr 25, 2018 at 3:31 AM Efi Fogel <[hidden email]> wrote:
This could have never worked.
You are using inexact construction.
Change the first line to:

typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;

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



On 24 April 2018 at 22:07, Dinesh Shetty <[hidden email]> wrote:
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT                                        Number_type;

typedef CGAL::Arr_segment_traits_2<Kernel>              Traits;
typedef Traits::Point_2                                 Point;
typedef Traits::X_monotone_curve_2                      Segment;

typedef CGAL::Arrangement_2<Traits>                     Arrangement;
typedef Arrangement::Vertex_handle                      Vertex_handle;
typedef Arrangement::Halfedge_handle                    Halfedge_handle;
typedef Arrangement::Face_handle                        Face_handle;
typedef Arrangement::Vertex_const_handle                Vertex_const_handle;
typedef Arrangement::Halfedge_const_handle              Halfedge_const_handle;


typedef CGAL::Arr_consolidated_curve_data_traits_2<Traits, int>
Data_traits;
typedef Data_traits::Curve_2                               Numbered_segment;
typedef CGAL::Arrangement_2<Data_traits>                   Numbered_arr;

Numbered_arr   arr;


insert(arr, Numbered_segment(Segment(Point(1.6831200000000E+02,-1.3992000000000E+01), Point( 1.2253100000000E+02, -2.0889000000000E+01)), 6));
insert(arr, Numbered_segment(Segment(Point(1.6490200000000E+02, 1.0314000000000E+01), Point( 1.0342400000000E+02, 4.2850000000000E+00)), 11));
insert(arr, Numbered_segment(Segment(Point(1.7217000000000E+02,-3.2611000000000E+01), Point( 9.9756000000000E+01, -4.3728000000000E+01)), 16));
insert(arr, Numbered_segment(Segment(Point(1.4197300000000E+02, 5.4490000000000E+00), Point( 1.4887000000000E+02, -4.0331000000000E+01)), 51));
std::stringstream ss;
Numbered_arr::Vertex_const_iterator   vit;
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) 
{
std::map<int, int> Frequency;
Numbered_arr::Halfedge_around_vertex_const_circulator eit, first;
eit = first = vit->incident_halfedges();
do 
{

++Frequency[eit->curve().data().front()];

} while (++eit != first);

ss << "@ ( " << vit->point() << ")" <<std::endl;
for(auto & itr : Frequency)
{
ss<<itr.first<<" apprears "<<itr.second<<"\n";
}

}


Numbered_arr::Edge_const_iterator eit;
std::vector<int> Pid;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) 
{
Data_traits::Data_container::const_iterator  it;

if(eit->curve().data().size()> 1)
{
Pid.clear();
Pid.reserve(eit->curve().data().size());
for (it = eit->curve().data().begin(); it != eit->curve().data().end(); ++it)
{
Pid.push_back(*it);
}
ss<<"Overlap detected : ";
for(auto & itr : Pid)
ss<<itr<<" ";
ss<<"\n";
}
}



ss << arr.number_of_edges() << " edges:" << std::endl;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit)
ss << "[" << eit->curve() << "]" << std::endl;

On Tue, Apr 24, 2018 at 12:33 PM, Efi Fogel <[hidden email]> wrote:
Please provide a test case that reproduces the problem.

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



On 24 April 2018 at 17:32, Dinesh Shetty <[hidden email]> wrote:
When I switched to CGAL 4.12-beta2 from CGAL-4.4, I get following exception thrown
Exception: CGAL ERROR: precondition violation!
Expr: (m_traits.compare_y_at_x_2_object()(p, cv) == EQUAL) && compare_xy(cv.left(), p) == SMALLER && compare_xy(cv.right(), p) == LARGER
File: D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Arr_segment_traits_2.h
Line: 714

Any help appreciated..

On stackExchange




Reply | Threaded
Open this post in threaded view
|

Re: CGAL fails with insertion operation in 2D arrangements

Florian Prud'homme
Hello Dinesh,

Precondition are stricter today. You can desactivate them by adding
the preprocessor define :

#define CGAL_NDEBUG

https://doc.cgal.org/latest/Manual/devman_checks.html

But as Efi said, the result is not guarantee..




--
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


Reply | Threaded
Open this post in threaded view
|

Re: CGAL fails with insertion operation in 2D arrangements

Efi Fogel
In reply to this post by Dinesh
The assertion that causes the error has been there for ever. It is active only in debug mode. It's possible that it has never worked in debug mode and still works in release mode. In any case I suggest that you switch to using an exact construction kernel, cause even if it has been working so far, the failure is around the corner regardless of the assertion. 

On Wed, Apr 25, 2018, 19:09 Dinesh Shetty <[hidden email]> wrote:
It worked for many years for all the problems I have tried, but I switch to 4.12 now it breaks

On Wed, Apr 25, 2018 at 10:55 AM Efi Fogel <[hidden email]> wrote:
When you use inexact construction, your program may work on some instances and may fail on other.
We do not guarantee anything.


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



On 25 April 2018 at 18:49, Dinesh Shetty <[hidden email]> wrote:
Well my version with 4.4 works

On Wed, Apr 25, 2018 at 3:31 AM Efi Fogel <[hidden email]> wrote:
This could have never worked.
You are using inexact construction.
Change the first line to:

typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;

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



On 24 April 2018 at 22:07, Dinesh Shetty <[hidden email]> wrote:
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT                                        Number_type;

typedef CGAL::Arr_segment_traits_2<Kernel>              Traits;
typedef Traits::Point_2                                 Point;
typedef Traits::X_monotone_curve_2                      Segment;

typedef CGAL::Arrangement_2<Traits>                     Arrangement;
typedef Arrangement::Vertex_handle                      Vertex_handle;
typedef Arrangement::Halfedge_handle                    Halfedge_handle;
typedef Arrangement::Face_handle                        Face_handle;
typedef Arrangement::Vertex_const_handle                Vertex_const_handle;
typedef Arrangement::Halfedge_const_handle              Halfedge_const_handle;


typedef CGAL::Arr_consolidated_curve_data_traits_2<Traits, int>
Data_traits;
typedef Data_traits::Curve_2                               Numbered_segment;
typedef CGAL::Arrangement_2<Data_traits>                   Numbered_arr;

Numbered_arr   arr;


insert(arr, Numbered_segment(Segment(Point(1.6831200000000E+02,-1.3992000000000E+01), Point( 1.2253100000000E+02, -2.0889000000000E+01)), 6));
insert(arr, Numbered_segment(Segment(Point(1.6490200000000E+02, 1.0314000000000E+01), Point( 1.0342400000000E+02, 4.2850000000000E+00)), 11));
insert(arr, Numbered_segment(Segment(Point(1.7217000000000E+02,-3.2611000000000E+01), Point( 9.9756000000000E+01, -4.3728000000000E+01)), 16));
insert(arr, Numbered_segment(Segment(Point(1.4197300000000E+02, 5.4490000000000E+00), Point( 1.4887000000000E+02, -4.0331000000000E+01)), 51));
std::stringstream ss;
Numbered_arr::Vertex_const_iterator   vit;
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) 
{
std::map<int, int> Frequency;
Numbered_arr::Halfedge_around_vertex_const_circulator eit, first;
eit = first = vit->incident_halfedges();
do 
{

++Frequency[eit->curve().data().front()];

} while (++eit != first);

ss << "@ ( " << vit->point() << ")" <<std::endl;
for(auto & itr : Frequency)
{
ss<<itr.first<<" apprears "<<itr.second<<"\n";
}

}


Numbered_arr::Edge_const_iterator eit;
std::vector<int> Pid;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) 
{
Data_traits::Data_container::const_iterator  it;

if(eit->curve().data().size()> 1)
{
Pid.clear();
Pid.reserve(eit->curve().data().size());
for (it = eit->curve().data().begin(); it != eit->curve().data().end(); ++it)
{
Pid.push_back(*it);
}
ss<<"Overlap detected : ";
for(auto & itr : Pid)
ss<<itr<<" ";
ss<<"\n";
}
}



ss << arr.number_of_edges() << " edges:" << std::endl;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit)
ss << "[" << eit->curve() << "]" << std::endl;

On Tue, Apr 24, 2018 at 12:33 PM, Efi Fogel <[hidden email]> wrote:
Please provide a test case that reproduces the problem.

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



On 24 April 2018 at 17:32, Dinesh Shetty <[hidden email]> wrote:
When I switched to CGAL 4.12-beta2 from CGAL-4.4, I get following exception thrown
Exception: CGAL ERROR: precondition violation!
Expr: (m_traits.compare_y_at_x_2_object()(p, cv) == EQUAL) && compare_xy(cv.left(), p) == SMALLER && compare_xy(cv.right(), p) == LARGER
File: D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Arr_segment_traits_2.h
Line: 714

Any help appreciated..

On stackExchange




Reply | Threaded
Open this post in threaded view
|

Re: CGAL fails with insertion operation in 2D arrangements

Dinesh
I am really having hard time switching from 4.4 to 4.12. Seems like arrangement crash if I don’t use exact construction but constrained Delaunay mesh does not compile with exact construction

On Thu, Apr 26, 2018 at 12:32 AM Efi Fogel <[hidden email]> wrote:
The assertion that causes the error has been there for ever. It is active only in debug mode. It's possible that it has never worked in debug mode and still works in release mode. In any case I suggest that you switch to using an exact construction kernel, cause even if it has been working so far, the failure is around the corner regardless of the assertion. 

On Wed, Apr 25, 2018, 19:09 Dinesh Shetty <[hidden email]> wrote:
It worked for many years for all the problems I have tried, but I switch to 4.12 now it breaks

On Wed, Apr 25, 2018 at 10:55 AM Efi Fogel <[hidden email]> wrote:
When you use inexact construction, your program may work on some instances and may fail on other.
We do not guarantee anything.


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



On 25 April 2018 at 18:49, Dinesh Shetty <[hidden email]> wrote:
Well my version with 4.4 works

On Wed, Apr 25, 2018 at 3:31 AM Efi Fogel <[hidden email]> wrote:
This could have never worked.
You are using inexact construction.
Change the first line to:

typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;

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



On 24 April 2018 at 22:07, Dinesh Shetty <[hidden email]> wrote:
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT                                        Number_type;

typedef CGAL::Arr_segment_traits_2<Kernel>              Traits;
typedef Traits::Point_2                                 Point;
typedef Traits::X_monotone_curve_2                      Segment;

typedef CGAL::Arrangement_2<Traits>                     Arrangement;
typedef Arrangement::Vertex_handle                      Vertex_handle;
typedef Arrangement::Halfedge_handle                    Halfedge_handle;
typedef Arrangement::Face_handle                        Face_handle;
typedef Arrangement::Vertex_const_handle                Vertex_const_handle;
typedef Arrangement::Halfedge_const_handle              Halfedge_const_handle;


typedef CGAL::Arr_consolidated_curve_data_traits_2<Traits, int>
Data_traits;
typedef Data_traits::Curve_2                               Numbered_segment;
typedef CGAL::Arrangement_2<Data_traits>                   Numbered_arr;

Numbered_arr   arr;


insert(arr, Numbered_segment(Segment(Point(1.6831200000000E+02,-1.3992000000000E+01), Point( 1.2253100000000E+02, -2.0889000000000E+01)), 6));
insert(arr, Numbered_segment(Segment(Point(1.6490200000000E+02, 1.0314000000000E+01), Point( 1.0342400000000E+02, 4.2850000000000E+00)), 11));
insert(arr, Numbered_segment(Segment(Point(1.7217000000000E+02,-3.2611000000000E+01), Point( 9.9756000000000E+01, -4.3728000000000E+01)), 16));
insert(arr, Numbered_segment(Segment(Point(1.4197300000000E+02, 5.4490000000000E+00), Point( 1.4887000000000E+02, -4.0331000000000E+01)), 51));
std::stringstream ss;
Numbered_arr::Vertex_const_iterator   vit;
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) 
{
std::map<int, int> Frequency;
Numbered_arr::Halfedge_around_vertex_const_circulator eit, first;
eit = first = vit->incident_halfedges();
do 
{

++Frequency[eit->curve().data().front()];

} while (++eit != first);

ss << "@ ( " << vit->point() << ")" <<std::endl;
for(auto & itr : Frequency)
{
ss<<itr.first<<" apprears "<<itr.second<<"\n";
}

}


Numbered_arr::Edge_const_iterator eit;
std::vector<int> Pid;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) 
{
Data_traits::Data_container::const_iterator  it;

if(eit->curve().data().size()> 1)
{
Pid.clear();
Pid.reserve(eit->curve().data().size());
for (it = eit->curve().data().begin(); it != eit->curve().data().end(); ++it)
{
Pid.push_back(*it);
}
ss<<"Overlap detected : ";
for(auto & itr : Pid)
ss<<itr<<" ";
ss<<"\n";
}
}



ss << arr.number_of_edges() << " edges:" << std::endl;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit)
ss << "[" << eit->curve() << "]" << std::endl;

On Tue, Apr 24, 2018 at 12:33 PM, Efi Fogel <[hidden email]> wrote:
Please provide a test case that reproduces the problem.

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



On 24 April 2018 at 17:32, Dinesh Shetty <[hidden email]> wrote:
When I switched to CGAL 4.12-beta2 from CGAL-4.4, I get following exception thrown
Exception: CGAL ERROR: precondition violation!
Expr: (m_traits.compare_y_at_x_2_object()(p, cv) == EQUAL) && compare_xy(cv.left(), p) == SMALLER && compare_xy(cv.right(), p) == LARGER
File: D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Arr_segment_traits_2.h
Line: 714

Any help appreciated..

On stackExchange




Reply | Threaded
Open this post in threaded view
|

Re: CGAL fails with insertion operation in 2D arrangements

Sebastien Loriot (GeometryFactory)
Which way are you going? From arrangement to Mesh_2 or the way around?

You can use CGAL::Cartesian_converter to convert the point from the
arrangement that is using EPECK to EPICK for Mesh_2.

Basically,

CGAL::Cartesion_converter<CGAL::EPECK, CGAL::EPICK> to_epick;

EPECK::Point_3 ept;
EPICK::Point_3 pt = to_epick(ept);

HTH,

Sebastien.


On 05/03/2018 05:37 PM, Dinesh Shetty wrote:

> I am really having hard time switching from 4.4 to 4.12. Seems like
> arrangement crash if I don’t use exact construction but constrained
> Delaunay mesh does not compile with exact construction
>
> On Thu, Apr 26, 2018 at 12:32 AM Efi Fogel <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     The assertion that causes the error has been there for ever. It is
>     active only in debug mode. It's possible that it has never worked in
>     debug mode and still works in release mode. In any case I suggest
>     that you switch to using an exact construction kernel, cause even if
>     it has been working so far, the failure is around the corner
>     regardless of the assertion.
>
>     On Wed, Apr 25, 2018, 19:09 Dinesh Shetty <[hidden email]
>     <mailto:[hidden email]>> wrote:
>
>         It worked for many years for all the problems I have tried, but
>         I switch to 4.12 now it breaks
>
>         On Wed, Apr 25, 2018 at 10:55 AM Efi Fogel <[hidden email]
>         <mailto:[hidden email]>> wrote:
>
>             When you use inexact construction, your program may work on
>             some instances and may fail on other.
>             We do not guarantee anything.
>
>
>                 ____  _        ____             _
>                /_____/_) o    /__________  __  //
>               (____ (   (    (    (_/ (_/-(-'_(/
>                                       _/
>
>
>
>             On 25 April 2018 at 18:49, Dinesh Shetty
>             <[hidden email] <mailto:[hidden email]>> wrote:
>
>                 Well my version with 4.4 works
>
>                 On Wed, Apr 25, 2018 at 3:31 AM Efi Fogel
>                 <[hidden email] <mailto:[hidden email]>> wrote:
>
>                     This could have never worked.
>                     You are using inexact construction.
>                     Change the first line to:
>
>                     typedef
>                     CGAL::Exact_predicates__exact__constructions_kernel
>                     Kernel;
>
>                         ____  _        ____             _
>                        /_____/_) o    /__________  __  //
>                       (____ (   (    (    (_/ (_/-(-'_(/
>                                               _/
>
>
>
>                     On 24 April 2018 at 22:07, Dinesh Shetty
>                     <[hidden email]
>                     <mailto:[hidden email]>> wrote:
>
>                         typedef
>                         CGAL::Exact_predicates_inexact_constructions_kernel
>                         Kernel;
>                         typedef Kernel::FT                            
>                                    Number_type;
>
>                         typedef CGAL::Arr_segment_traits_2<Kernel>    
>                                  Traits;
>                         typedef Traits::Point_2                        
>                                 Point;
>                         typedef Traits::X_monotone_curve_2            
>                                  Segment;
>
>                         typedef CGAL::Arrangement_2<Traits>            
>                                 Arrangement;
>                         typedef Arrangement::Vertex_handle            
>                                  Vertex_handle;
>                         typedef Arrangement::Halfedge_handle          
>                                  Halfedge_handle;
>                         typedef Arrangement::Face_handle              
>                                  Face_handle;
>                         typedef Arrangement::Vertex_const_handle      
>                                  Vertex_const_handle;
>                         typedef Arrangement::Halfedge_const_handle    
>                                  Halfedge_const_handle;
>
>
>                         typedef
>                         CGAL::Arr_consolidated_curve_data_traits_2<Traits,
>                         int>
>                         Data_traits;
>                         typedef Data_traits::Curve_2                  
>                                     Numbered_segment;
>                         typedef CGAL::Arrangement_2<Data_traits>      
>                                     Numbered_arr;
>
>                         Numbered_arr   arr;
>
>
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.6831200000000E+02,-1.3992000000000E+01),
>                         Point(1.2253100000000E+02,-2.0889000000000E+01)), 6));
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.6490200000000E+02,1.0314000000000E+01),
>                         Point(1.0342400000000E+02,4.2850000000000E+00)),
>                         11));
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.7217000000000E+02,-3.2611000000000E+01),
>                         Point(9.9756000000000E+01,-4.3728000000000E+01)), 16));
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.4197300000000E+02,5.4490000000000E+00),
>                         Point(1.4887000000000E+02,-4.0331000000000E+01)), 51));
>                         std::stringstream ss;
>                         Numbered_arr::Vertex_const_iterator   vit;
>                         for (vit = arr.vertices_begin(); vit !=
>                         arr.vertices_end(); ++vit)
>                         {
>                         std::map<int, int> Frequency;
>                         Numbered_arr::Halfedge_around_vertex_const_circulator
>                         eit, first;
>                         eit = first = vit->incident_halfedges();
>                         do
>                         {
>
>                         ++Frequency[eit->curve().data().front()];
>
>                         } while (++eit != first);
>
>                         ss << "@ ( " << vit->point() << ")" <<std::endl;
>                         for(auto & itr : Frequency)
>                         {
>                         ss<<itr.first<<" apprears "<<itr.second<<"\n";
>                         }
>
>                         }
>
>
>                         Numbered_arr::Edge_const_iterator eit;
>                         std::vector<int> Pid;
>                         for (eit = arr.edges_begin(); eit !=
>                         arr.edges_end(); ++eit)
>                         {
>                         Data_traits::Data_container::const_iterator  it;
>
>                         if(eit->curve().data().size()> 1)
>                         {
>                         Pid.clear();
>                         Pid.reserve(eit->curve().data().size());
>                         for (it = eit->curve().data().begin(); it !=
>                         eit->curve().data().end(); ++it)
>                         {
>                         Pid.push_back(*it);
>                         }
>                         ss<<"Overlap detected : ";
>                         for(auto & itr : Pid)
>                         ss<<itr<<" ";
>                         ss<<"\n";
>                         }
>                         }
>
>
>
>                         ss << arr.number_of_edges() << " edges:" <<
>                         std::endl;
>                         for (eit = arr.edges_begin(); eit !=
>                         arr.edges_end(); ++eit)
>                         ss << "[" << eit->curve() << "]" << std::endl;
>
>                         On Tue, Apr 24, 2018 at 12:33 PM, Efi Fogel
>                         <[hidden email] <mailto:[hidden email]>>
>                         wrote:
>
>                             Please provide a test case that reproduces
>                             the problem.
>
>                                 ____  _        ____             _
>                                /_____/_) o    /__________  __  //
>                               (____ (   (    (    (_/ (_/-(-'_(/
>                                                       _/
>
>
>
>                             On 24 April 2018 at 17:32, Dinesh Shetty
>                             <[hidden email]
>                             <mailto:[hidden email]>> wrote:
>
>                                 When I switched to CGAL 4.12-beta2 from
>                                 CGAL-4.4, I get following exception thrown
>                                 Exception: CGAL ERROR: precondition
>                                 violation!
>                                 Expr:
>                                 (m_traits.compare_y_at_x_2_object()(p,
>                                 cv) == EQUAL) && compare_xy(cv.left(),
>                                 p) == SMALLER && compare_xy(cv.right(),
>                                 p) == LARGER
>                                 File:
>                                 D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Arr_segment_traits_2.h
>                                 Line: 714
>
>                                 Any help appreciated..
>
>                                 On stackExchange
>                                 https://stackoverflow.com/questions/50004248/cgal-fails-with-insertion-operation-in-2d-arrangements
>
>
>
>
>

--
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: CGAL fails with insertion operation in 2D arrangements

Dinesh
Ok.. but switching from 4.4 to 4.12 has been huge effort. Not sure why both packages can not work under one kernel anymore.  Cgal 4.4 worked for inexact construction in both debug and release for arrangement and Delaunay 

On Thu, May 3, 2018 at 11:08 AM Sebastien Loriot (GeometryFactory) <[hidden email]> wrote:
Which way are you going? From arrangement to Mesh_2 or the way around?

You can use CGAL::Cartesian_converter to convert the point from the
arrangement that is using EPECK to EPICK for Mesh_2.

Basically,

CGAL::Cartesion_converter<CGAL::EPECK, CGAL::EPICK> to_epick;

EPECK::Point_3 ept;
EPICK::Point_3 pt = to_epick(ept);

HTH,

Sebastien.


On 05/03/2018 05:37 PM, Dinesh Shetty wrote:
> I am really having hard time switching from 4.4 to 4.12. Seems like
> arrangement crash if I don’t use exact construction but constrained
> Delaunay mesh does not compile with exact construction
>
> On Thu, Apr 26, 2018 at 12:32 AM Efi Fogel <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     The assertion that causes the error has been there for ever. It is
>     active only in debug mode. It's possible that it has never worked in
>     debug mode and still works in release mode. In any case I suggest
>     that you switch to using an exact construction kernel, cause even if
>     it has been working so far, the failure is around the corner
>     regardless of the assertion.
>
>     On Wed, Apr 25, 2018, 19:09 Dinesh Shetty <[hidden email]
>     <mailto:[hidden email]>> wrote:
>
>         It worked for many years for all the problems I have tried, but
>         I switch to 4.12 now it breaks
>
>         On Wed, Apr 25, 2018 at 10:55 AM Efi Fogel <[hidden email]
>         <mailto:[hidden email]>> wrote:
>
>             When you use inexact construction, your program may work on
>             some instances and may fail on other.
>             We do not guarantee anything.
>
>
>                 ____  _        ____             _
>                /_____/_) o    /__________  __  //
>               (____ (   (    (    (_/ (_/-(-'_(/
>                                       _/
>
>
>
>             On 25 April 2018 at 18:49, Dinesh Shetty
>             <[hidden email] <mailto:[hidden email]>> wrote:
>
>                 Well my version with 4.4 works
>
>                 On Wed, Apr 25, 2018 at 3:31 AM Efi Fogel
>                 <[hidden email] <mailto:[hidden email]>> wrote:
>
>                     This could have never worked.
>                     You are using inexact construction.
>                     Change the first line to:
>
>                     typedef
>                     CGAL::Exact_predicates__exact__constructions_kernel
>                     Kernel;
>
>                         ____  _        ____             _
>                        /_____/_) o    /__________  __  //
>                       (____ (   (    (    (_/ (_/-(-'_(/
>                                               _/
>
>
>
>                     On 24 April 2018 at 22:07, Dinesh Shetty
>                     <[hidden email]
>                     <mailto:[hidden email]>> wrote:
>
>                         typedef
>                         CGAL::Exact_predicates_inexact_constructions_kernel
>                         Kernel;
>                         typedef Kernel::FT                             
>                                    Number_type;
>
>                         typedef CGAL::Arr_segment_traits_2<Kernel>     
>                                  Traits;
>                         typedef Traits::Point_2                         
>                                 Point;
>                         typedef Traits::X_monotone_curve_2             
>                                  Segment;
>
>                         typedef CGAL::Arrangement_2<Traits>             
>                                 Arrangement;
>                         typedef Arrangement::Vertex_handle             
>                                  Vertex_handle;
>                         typedef Arrangement::Halfedge_handle           
>                                  Halfedge_handle;
>                         typedef Arrangement::Face_handle               
>                                  Face_handle;
>                         typedef Arrangement::Vertex_const_handle       
>                                  Vertex_const_handle;
>                         typedef Arrangement::Halfedge_const_handle     
>                                  Halfedge_const_handle;
>
>
>                         typedef
>                         CGAL::Arr_consolidated_curve_data_traits_2<Traits,
>                         int>
>                         Data_traits;
>                         typedef Data_traits::Curve_2                   
>                                     Numbered_segment;
>                         typedef CGAL::Arrangement_2<Data_traits>       
>                                     Numbered_arr;
>
>                         Numbered_arr   arr;
>
>
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.6831200000000E+02,-1.3992000000000E+01),
>                         Point(1.2253100000000E+02,-2.0889000000000E+01)), 6));
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.6490200000000E+02,1.0314000000000E+01),
>                         Point(1.0342400000000E+02,4.2850000000000E+00)),
>                         11));
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.7217000000000E+02,-3.2611000000000E+01),
>                         Point(9.9756000000000E+01,-4.3728000000000E+01)), 16));
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.4197300000000E+02,5.4490000000000E+00),
>                         Point(1.4887000000000E+02,-4.0331000000000E+01)), 51));
>                         std::stringstream ss;
>                         Numbered_arr::Vertex_const_iterator   vit;
>                         for (vit = arr.vertices_begin(); vit !=
>                         arr.vertices_end(); ++vit)
>                         {
>                         std::map<int, int> Frequency;
>                         Numbered_arr::Halfedge_around_vertex_const_circulator
>                         eit, first;
>                         eit = first = vit->incident_halfedges();
>                         do
>                         {
>
>                         ++Frequency[eit->curve().data().front()];
>
>                         } while (++eit != first);
>
>                         ss << "@ ( " << vit->point() << ")" <<std::endl;
>                         for(auto & itr : Frequency)
>                         {
>                         ss<<itr.first<<" apprears "<<itr.second<<"\n";
>                         }
>
>                         }
>
>
>                         Numbered_arr::Edge_const_iterator eit;
>                         std::vector<int> Pid;
>                         for (eit = arr.edges_begin(); eit !=
>                         arr.edges_end(); ++eit)
>                         {
>                         Data_traits::Data_container::const_iterator  it;
>
>                         if(eit->curve().data().size()> 1)
>                         {
>                         Pid.clear();
>                         Pid.reserve(eit->curve().data().size());
>                         for (it = eit->curve().data().begin(); it !=
>                         eit->curve().data().end(); ++it)
>                         {
>                         Pid.push_back(*it);
>                         }
>                         ss<<"Overlap detected : ";
>                         for(auto & itr : Pid)
>                         ss<<itr<<" ";
>                         ss<<"\n";
>                         }
>                         }
>
>
>
>                         ss << arr.number_of_edges() << " edges:" <<
>                         std::endl;
>                         for (eit = arr.edges_begin(); eit !=
>                         arr.edges_end(); ++eit)
>                         ss << "[" << eit->curve() << "]" << std::endl;
>
>                         On Tue, Apr 24, 2018 at 12:33 PM, Efi Fogel
>                         <[hidden email] <mailto:[hidden email]>>
>                         wrote:
>
>                             Please provide a test case that reproduces
>                             the problem.
>
>                                 ____  _        ____             _
>                                /_____/_) o    /__________  __  //
>                               (____ (   (    (    (_/ (_/-(-'_(/
>                                                       _/
>
>
>
>                             On 24 April 2018 at 17:32, Dinesh Shetty
>                             <[hidden email]
>                             <mailto:[hidden email]>> wrote:
>
>                                 When I switched to CGAL 4.12-beta2 from
>                                 CGAL-4.4, I get following exception thrown
>                                 Exception: CGAL ERROR: precondition
>                                 violation!
>                                 Expr:
>                                 (m_traits.compare_y_at_x_2_object()(p,
>                                 cv) == EQUAL) && compare_xy(cv.left(),
>                                 p) == SMALLER && compare_xy(cv.right(),
>                                 p) == LARGER
>                                 File:
>                                 D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Arr_segment_traits_2.h
>                                 Line: 714
>
>                                 Any help appreciated..
>
>                                 On stackExchange
>                                 https://stackoverflow.com/questions/50004248/cgal-fails-with-insertion-operation-in-2d-arrangements
>
>
>
>
>

--
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: CGAL fails with insertion operation in 2D arrangements

Efi Fogel
No it did not. Perhaps it compiled, and perhaps it happened to work in release mode for certain input cases, but the failure was around the corner.
2D Arrangements always required exact construction and exact predicates when the split function object of the traits was used.
Consider yourself lucky that you have never encountered a problem while using inexact constructions, and that you are now fixing your code to be robust for all cases.

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



On 3 May 2018 at 20:29, Dinesh Shetty <[hidden email]> wrote:
Ok.. but switching from 4.4 to 4.12 has been huge effort. Not sure why both packages can not work under one kernel anymore.  Cgal 4.4 worked for inexact construction in both debug and release for arrangement and Delaunay 

On Thu, May 3, 2018 at 11:08 AM Sebastien Loriot (GeometryFactory) <[hidden email]> wrote:
Which way are you going? From arrangement to Mesh_2 or the way around?

You can use CGAL::Cartesian_converter to convert the point from the
arrangement that is using EPECK to EPICK for Mesh_2.

Basically,

CGAL::Cartesion_converter<CGAL::EPECK, CGAL::EPICK> to_epick;

EPECK::Point_3 ept;
EPICK::Point_3 pt = to_epick(ept);

HTH,

Sebastien.


On 05/03/2018 05:37 PM, Dinesh Shetty wrote:
> I am really having hard time switching from 4.4 to 4.12. Seems like
> arrangement crash if I don’t use exact construction but constrained
> Delaunay mesh does not compile with exact construction
>
> On Thu, Apr 26, 2018 at 12:32 AM Efi Fogel <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     The assertion that causes the error has been there for ever. It is
>     active only in debug mode. It's possible that it has never worked in
>     debug mode and still works in release mode. In any case I suggest
>     that you switch to using an exact construction kernel, cause even if
>     it has been working so far, the failure is around the corner
>     regardless of the assertion.
>
>     On Wed, Apr 25, 2018, 19:09 Dinesh Shetty <[hidden email]
>     <mailto:[hidden email]>> wrote:
>
>         It worked for many years for all the problems I have tried, but
>         I switch to 4.12 now it breaks
>
>         On Wed, Apr 25, 2018 at 10:55 AM Efi Fogel <[hidden email]
>         <mailto:[hidden email]>> wrote:
>
>             When you use inexact construction, your program may work on
>             some instances and may fail on other.
>             We do not guarantee anything.
>
>
>                 ____  _        ____             _
>                /_____/_) o    /__________  __  //
>               (____ (   (    (    (_/ (_/-(-'_(/
>                                       _/
>
>
>
>             On 25 April 2018 at 18:49, Dinesh Shetty
>             <[hidden email] <mailto:[hidden email]>> wrote:
>
>                 Well my version with 4.4 works
>
>                 On Wed, Apr 25, 2018 at 3:31 AM Efi Fogel
>                 <[hidden email] <mailto:[hidden email]>> wrote:
>
>                     This could have never worked.
>                     You are using inexact construction.
>                     Change the first line to:
>
>                     typedef
>                     CGAL::Exact_predicates__exact__constructions_kernel
>                     Kernel;
>
>                         ____  _        ____             _
>                        /_____/_) o    /__________  __  //
>                       (____ (   (    (    (_/ (_/-(-'_(/
>                                               _/
>
>
>
>                     On 24 April 2018 at 22:07, Dinesh Shetty
>                     <[hidden email]
>                     <mailto:[hidden email]>> wrote:
>
>                         typedef
>                         CGAL::Exact_predicates_inexact_constructions_kernel
>                         Kernel;
>                         typedef Kernel::FT                             
>                                    Number_type;
>
>                         typedef CGAL::Arr_segment_traits_2<Kernel>     
>                                  Traits;
>                         typedef Traits::Point_2                         
>                                 Point;
>                         typedef Traits::X_monotone_curve_2             
>                                  Segment;
>
>                         typedef CGAL::Arrangement_2<Traits>             
>                                 Arrangement;
>                         typedef Arrangement::Vertex_handle             
>                                  Vertex_handle;
>                         typedef Arrangement::Halfedge_handle           
>                                  Halfedge_handle;
>                         typedef Arrangement::Face_handle               
>                                  Face_handle;
>                         typedef Arrangement::Vertex_const_handle       
>                                  Vertex_const_handle;
>                         typedef Arrangement::Halfedge_const_handle     
>                                  Halfedge_const_handle;
>
>
>                         typedef
>                         CGAL::Arr_consolidated_curve_data_traits_2<Traits,
>                         int>
>                         Data_traits;
>                         typedef Data_traits::Curve_2                   
>                                     Numbered_segment;
>                         typedef CGAL::Arrangement_2<Data_traits>       
>                                     Numbered_arr;
>
>                         Numbered_arr   arr;
>
>
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.6831200000000E+02,-1.3992000000000E+01),
>                         Point(1.2253100000000E+02,-2.0889000000000E+01)), 6));
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.6490200000000E+02,1.0314000000000E+01),
>                         Point(1.0342400000000E+02,4.2850000000000E+00)),
>                         11));
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.7217000000000E+02,-3.2611000000000E+01),
>                         Point(9.9756000000000E+01,-4.3728000000000E+01)), 16));
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.4197300000000E+02,5.4490000000000E+00),
>                         Point(1.4887000000000E+02,-4.0331000000000E+01)), 51));
>                         std::stringstream ss;
>                         Numbered_arr::Vertex_const_iterator   vit;
>                         for (vit = arr.vertices_begin(); vit !=
>                         arr.vertices_end(); ++vit)
>                         {
>                         std::map<int, int> Frequency;
>                         Numbered_arr::Halfedge_around_vertex_const_circulator
>                         eit, first;
>                         eit = first = vit->incident_halfedges();
>                         do
>                         {
>
>                         ++Frequency[eit->curve().data().front()];
>
>                         } while (++eit != first);
>
>                         ss << "@ ( " << vit->point() << ")" <<std::endl;
>                         for(auto & itr : Frequency)
>                         {
>                         ss<<itr.first<<" apprears "<<itr.second<<"\n";
>                         }
>
>                         }
>
>
>                         Numbered_arr::Edge_const_iterator eit;
>                         std::vector<int> Pid;
>                         for (eit = arr.edges_begin(); eit !=
>                         arr.edges_end(); ++eit)
>                         {
>                         Data_traits::Data_container::const_iterator  it;
>
>                         if(eit->curve().data().size()> 1)
>                         {
>                         Pid.clear();
>                         Pid.reserve(eit->curve().data().size());
>                         for (it = eit->curve().data().begin(); it !=
>                         eit->curve().data().end(); ++it)
>                         {
>                         Pid.push_back(*it);
>                         }
>                         ss<<"Overlap detected : ";
>                         for(auto & itr : Pid)
>                         ss<<itr<<" ";
>                         ss<<"\n";
>                         }
>                         }
>
>
>
>                         ss << arr.number_of_edges() << " edges:" <<
>                         std::endl;
>                         for (eit = arr.edges_begin(); eit !=
>                         arr.edges_end(); ++eit)
>                         ss << "[" << eit->curve() << "]" << std::endl;
>
>                         On Tue, Apr 24, 2018 at 12:33 PM, Efi Fogel
>                         <[hidden email] <mailto:[hidden email]>>
>                         wrote:
>
>                             Please provide a test case that reproduces
>                             the problem.
>
>                                 ____  _        ____             _
>                                /_____/_) o    /__________  __  //
>                               (____ (   (    (    (_/ (_/-(-'_(/
>                                                       _/
>
>
>
>                             On 24 April 2018 at 17:32, Dinesh Shetty
>                             <[hidden email]
>                             <mailto:[hidden email]>> wrote:
>
>                                 When I switched to CGAL 4.12-beta2 from
>                                 CGAL-4.4, I get following exception thrown
>                                 Exception: CGAL ERROR: precondition
>                                 violation!
>                                 Expr:
>                                 (m_traits.compare_y_at_x_2_object()(p,
>                                 cv) == EQUAL) && compare_xy(cv.left(),
>                                 p) == SMALLER && compare_xy(cv.right(),
>                                 p) == LARGER
>                                 File:
>                                 D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Arr_segment_traits_2.h
>                                 Line: 714
>
>                                 Any help appreciated..
>
>                                 On stackExchange
>                                 https://stackoverflow.com/questions/50004248/cgal-fails-with-insertion-operation-in-2d-arrangements
>
>
>
>
>

--
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: CGAL fails with insertion operation in 2D arrangements

Dinesh
Well I have a case here that definitely works in debug mode in 4.4 but surely fails in 4.12( I have both version of libraries).

On Thu, May 3, 2018 at 12:47 PM Efi Fogel <[hidden email]> wrote:
No it did not. Perhaps it compiled, and perhaps it happened to work in release mode for certain input cases, but the failure was around the corner.
2D Arrangements always required exact construction and exact predicates when the split function object of the traits was used.
Consider yourself lucky that you have never encountered a problem while using inexact constructions, and that you are now fixing your code to be robust for all cases.

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



On 3 May 2018 at 20:29, Dinesh Shetty <[hidden email]> wrote:
Ok.. but switching from 4.4 to 4.12 has been huge effort. Not sure why both packages can not work under one kernel anymore.  Cgal 4.4 worked for inexact construction in both debug and release for arrangement and Delaunay 

On Thu, May 3, 2018 at 11:08 AM Sebastien Loriot (GeometryFactory) <[hidden email]> wrote:
Which way are you going? From arrangement to Mesh_2 or the way around?

You can use CGAL::Cartesian_converter to convert the point from the
arrangement that is using EPECK to EPICK for Mesh_2.

Basically,

CGAL::Cartesion_converter<CGAL::EPECK, CGAL::EPICK> to_epick;

EPECK::Point_3 ept;
EPICK::Point_3 pt = to_epick(ept);

HTH,

Sebastien.


On 05/03/2018 05:37 PM, Dinesh Shetty wrote:
> I am really having hard time switching from 4.4 to 4.12. Seems like
> arrangement crash if I don’t use exact construction but constrained
> Delaunay mesh does not compile with exact construction
>
> On Thu, Apr 26, 2018 at 12:32 AM Efi Fogel <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     The assertion that causes the error has been there for ever. It is
>     active only in debug mode. It's possible that it has never worked in
>     debug mode and still works in release mode. In any case I suggest
>     that you switch to using an exact construction kernel, cause even if
>     it has been working so far, the failure is around the corner
>     regardless of the assertion.
>
>     On Wed, Apr 25, 2018, 19:09 Dinesh Shetty <[hidden email]
>     <mailto:[hidden email]>> wrote:
>
>         It worked for many years for all the problems I have tried, but
>         I switch to 4.12 now it breaks
>
>         On Wed, Apr 25, 2018 at 10:55 AM Efi Fogel <[hidden email]
>         <mailto:[hidden email]>> wrote:
>
>             When you use inexact construction, your program may work on
>             some instances and may fail on other.
>             We do not guarantee anything.
>
>
>                 ____  _        ____             _
>                /_____/_) o    /__________  __  //
>               (____ (   (    (    (_/ (_/-(-'_(/
>                                       _/
>
>
>
>             On 25 April 2018 at 18:49, Dinesh Shetty
>             <[hidden email] <mailto:[hidden email]>> wrote:
>
>                 Well my version with 4.4 works
>
>                 On Wed, Apr 25, 2018 at 3:31 AM Efi Fogel
>                 <[hidden email] <mailto:[hidden email]>> wrote:
>
>                     This could have never worked.
>                     You are using inexact construction.
>                     Change the first line to:
>
>                     typedef
>                     CGAL::Exact_predicates__exact__constructions_kernel
>                     Kernel;
>
>                         ____  _        ____             _
>                        /_____/_) o    /__________  __  //
>                       (____ (   (    (    (_/ (_/-(-'_(/
>                                               _/
>
>
>
>                     On 24 April 2018 at 22:07, Dinesh Shetty
>                     <[hidden email]
>                     <mailto:[hidden email]>> wrote:
>
>                         typedef
>                         CGAL::Exact_predicates_inexact_constructions_kernel
>                         Kernel;
>                         typedef Kernel::FT                             
>                                    Number_type;
>
>                         typedef CGAL::Arr_segment_traits_2<Kernel>     
>                                  Traits;
>                         typedef Traits::Point_2                         
>                                 Point;
>                         typedef Traits::X_monotone_curve_2             
>                                  Segment;
>
>                         typedef CGAL::Arrangement_2<Traits>             
>                                 Arrangement;
>                         typedef Arrangement::Vertex_handle             
>                                  Vertex_handle;
>                         typedef Arrangement::Halfedge_handle           
>                                  Halfedge_handle;
>                         typedef Arrangement::Face_handle               
>                                  Face_handle;
>                         typedef Arrangement::Vertex_const_handle       
>                                  Vertex_const_handle;
>                         typedef Arrangement::Halfedge_const_handle     
>                                  Halfedge_const_handle;
>
>
>                         typedef
>                         CGAL::Arr_consolidated_curve_data_traits_2<Traits,
>                         int>
>                         Data_traits;
>                         typedef Data_traits::Curve_2                   
>                                     Numbered_segment;
>                         typedef CGAL::Arrangement_2<Data_traits>       
>                                     Numbered_arr;
>
>                         Numbered_arr   arr;
>
>
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.6831200000000E+02,-1.3992000000000E+01),
>                         Point(1.2253100000000E+02,-2.0889000000000E+01)), 6));
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.6490200000000E+02,1.0314000000000E+01),
>                         Point(1.0342400000000E+02,4.2850000000000E+00)),
>                         11));
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.7217000000000E+02,-3.2611000000000E+01),
>                         Point(9.9756000000000E+01,-4.3728000000000E+01)), 16));
>                         insert(arr,
>                         Numbered_segment(Segment(Point(1.4197300000000E+02,5.4490000000000E+00),
>                         Point(1.4887000000000E+02,-4.0331000000000E+01)), 51));
>                         std::stringstream ss;
>                         Numbered_arr::Vertex_const_iterator   vit;
>                         for (vit = arr.vertices_begin(); vit !=
>                         arr.vertices_end(); ++vit)
>                         {
>                         std::map<int, int> Frequency;
>                         Numbered_arr::Halfedge_around_vertex_const_circulator
>                         eit, first;
>                         eit = first = vit->incident_halfedges();
>                         do
>                         {
>
>                         ++Frequency[eit->curve().data().front()];
>
>                         } while (++eit != first);
>
>                         ss << "@ ( " << vit->point() << ")" <<std::endl;
>                         for(auto & itr : Frequency)
>                         {
>                         ss<<itr.first<<" apprears "<<itr.second<<"\n";
>                         }
>
>                         }
>
>
>                         Numbered_arr::Edge_const_iterator eit;
>                         std::vector<int> Pid;
>                         for (eit = arr.edges_begin(); eit !=
>                         arr.edges_end(); ++eit)
>                         {
>                         Data_traits::Data_container::const_iterator  it;
>
>                         if(eit->curve().data().size()> 1)
>                         {
>                         Pid.clear();
>                         Pid.reserve(eit->curve().data().size());
>                         for (it = eit->curve().data().begin(); it !=
>                         eit->curve().data().end(); ++it)
>                         {
>                         Pid.push_back(*it);
>                         }
>                         ss<<"Overlap detected : ";
>                         for(auto & itr : Pid)
>                         ss<<itr<<" ";
>                         ss<<"\n";
>                         }
>                         }
>
>
>
>                         ss << arr.number_of_edges() << " edges:" <<
>                         std::endl;
>                         for (eit = arr.edges_begin(); eit !=
>                         arr.edges_end(); ++eit)
>                         ss << "[" << eit->curve() << "]" << std::endl;
>
>                         On Tue, Apr 24, 2018 at 12:33 PM, Efi Fogel
>                         <[hidden email] <mailto:[hidden email]>>
>                         wrote:
>
>                             Please provide a test case that reproduces
>                             the problem.
>
>                                 ____  _        ____             _
>                                /_____/_) o    /__________  __  //
>                               (____ (   (    (    (_/ (_/-(-'_(/
>                                                       _/
>
>
>
>                             On 24 April 2018 at 17:32, Dinesh Shetty
>                             <[hidden email]
>                             <mailto:[hidden email]>> wrote:
>
>                                 When I switched to CGAL 4.12-beta2 from
>                                 CGAL-4.4, I get following exception thrown
>                                 Exception: CGAL ERROR: precondition
>                                 violation!
>                                 Expr:
>                                 (m_traits.compare_y_at_x_2_object()(p,
>                                 cv) == EQUAL) && compare_xy(cv.left(),
>                                 p) == SMALLER && compare_xy(cv.right(),
>                                 p) == LARGER
>                                 File:
>                                 D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Arr_segment_traits_2.h
>                                 Line: 714
>
>                                 Any help appreciated..
>
>                                 On stackExchange
>                                 https://stackoverflow.com/questions/50004248/cgal-fails-with-insertion-operation-in-2d-arrangements
>
>
>
>
>

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