Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

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


Chronological Thread 
  • From: Ophir Setter <>
  • To:
  • Subject: Re: [cgal-discuss] Arrangement_2 : problem during insertions
  • Date: Wed, 3 Aug 2011 20:13:29 +0300

1/4=0
1/2=0

Try instead:
rat(1, 4)
rat(1, 2)

http://www.cgal.org/Manual/3.3/doc_html/cgal_manual/NumberTypeSupport_ref/Class_Gmpq.html

Ophir

On Wed, Aug 3, 2011 at 3:36 PM, Pierre Cagne <> wrote:
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






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





Archive powered by MHonArc 2.6.16.

Top of Page