Subject: CGAL users discussion list
List archive
- From: Efi Fogel <>
- To:
- Subject: Re: [cgal-discuss] Arrangement 2 -> problem at intersection
- Date: Fri, 26 Jul 2013 09:34:12 +0300
Dear Alexandre,
First, check your input coordinates.
Secondly, use exact input (and not floating point). Represent a rational number as a quotion of 2 numbers.
Efi
On Jul 25, 2013 5:08 PM, "Alexandre Boulc'h" <> wrote:
>
> Hello,
>
> I have a problem of intersection in an arrangement_2.
> I build three segment that intersect at the same point, but it appears that
> the arrangement produces 3 different points. I am using
> Exact_predicates_exact_constructions_kernel.
>
> Here is the code:
>
> #include <CGAL/Arr_segment_traits_2.h>
> #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
> #include <CGAL/Arrangement_2.h>
>
> typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
> typedef CGAL::Arr_segment_traits_2<Kernel> Traits;
> typedef Traits::Point_2 Point_2;
> typedef Traits::X_monotone_curve_2 Curve_2;
> typedef CGAL::Arrangement_2<Traits> Arrangement_2;
> typedef Arrangement_2::Vertex_iterator Vertex_iterator;
>
> using std::cout;
> using std::endl;
>
> int main(){
>
> Arrangement_2 arr;
>
> insert(arr, Curve_2(Point_2(-1, -1-0.1), Point_2(1,1-0.1)));
> insert(arr, Curve_2(Point_2(0, -1), Point_2(0,1)));
> insert(arr, Curve_2(Point_2(-1, -0.1), Point_2(1, -0.1)));
>
> cout << "number of vertices: " << arr.number_of_vertices() << endl;
>
> for(Vertex_iterator itv = arr.vertices_begin(); itv !=
> arr.vertices_end(); itv++){
> cout << CGAL::to_double(itv->point().x());
> cout << " ";
> cout << CGAL::to_double(itv->point().y());
> cout << endl;
> }
> }
>
> and the output:
>
> number of vertices: 9
> -1 -1.1
> 1 0.9
> 0 -0.1
> 0 -1
> 0 1
> -0 -0.1
> -1 -0.1
> 2.77556e-17 -0.1
> 1 -0.1
>
> Can you tell me where is the problem in my code ?
> Thank you.
>
> Alexandre Boulc'h
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://sympa.inria.fr/sympa/info/cgal-discuss
>
>
- [cgal-discuss] Arrangement 2 -> problem at intersection, Alexandre Boulc'h, 07/25/2013
- Re: [cgal-discuss] Arrangement 2 -> problem at intersection, Efi Fogel, 07/26/2013
- [cgal-discuss] Re: Arrangement 2 -> problem at intersection, boulcha, 07/26/2013
- Re: [cgal-discuss] Arrangement 2 -> problem at intersection, Efi Fogel, 07/26/2013
Archive powered by MHonArc 2.6.18.