Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Arrangement_2 : problem during insertions

Subject: CGAL users discussion list

List archive

[cgal-discuss] Arrangement_2 : problem during insertions


Chronological Thread 
  • From: Pierre Cagne <>
  • To: CGAL Discuss <>
  • Subject: [cgal-discuss] Arrangement_2 : problem during insertions
  • Date: Wed, 3 Aug 2011 14:36:42 +0200

Hi,

I currently use the facilities of CGAL about line arrangements, and I'm
experiencing an issue. When I want to insert a segment line whose the
endpoints are already vertices of the graph, I'm having that kind of error :

terminate called after throwing an instance of
'CGAL::Precondition_exception'
what(): CGAL ERROR: precondition violation!
Expr: ! is_degen
File: /usr/macports/include/CGAL/Arr_segment_traits_2.h
Line: 149
Explanation: Cannot contruct a degenerate segment.
Abort trap

Here is a minimal example code to get this error :

#include <iostream>
#include <CGAL/Cartesian.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Gmpz.h>
#include <CGAL/Gmpq.h>

using namespace std;

typedef CGAL::Gmpz
NT;
typedef CGAL::Gmpq
rat;
typedef CGAL::Cartesian<rat>
Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2
Point_2;
typedef Traits_2::X_monotone_curve_2
Segment_2;
typedef CGAL::Arrangement_2<Traits_2>
Arrangement_2;

int main(void) {
Arrangement_2 arr;

CGAL::insert(arr, Segment_2 (Point_2 (rat(0),rat(0)), Point_2
(rat(1),rat(1))));
CGAL::insert(arr, Segment_2 (Point_2 (rat(1/4),rat(1/2)), Point_2
(rat(1),rat(0))));
CGAL::insert(arr, Segment_2 (Point_2 (rat(0),rat(0)), Point_2
(rat(1/4),rat(1/2))))

return 0;
}


I kind of understood that point-location query might help me, but after
several trials, I'm still at the same point (without pun :) ).

So, does anyone know how to do it ?



Thankfully.

--
Pierre Cagne
Etudiant à l'ENS de Paris
Département Informatique








Archive powered by MHonArc 2.6.16.

Top of Page