Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Problem with Polygon_2 intersection

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Problem with Polygon_2 intersection


Chronological Thread 
  • From: "Olivier Tournaire" <>
  • To:
  • Subject: Re: [cgal-discuss] Problem with Polygon_2 intersection
  • Date: Tue, 13 Mar 2007 17:09:19 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=N6jIFGO12AGDfvq3Xcl0JI05Yqyhofn7tiCIU+r6t5R1Q7Ra0zVvn81R72zO/A/iRtqgXGeBig+y6whDJuAbcfPVxAOCb8etxkojTFaTYbqfoP6mMZLZvosFZ3tlCuLx2guktp3Bk9pPMvL7OL3XTqFXEhYBhHuQeFivvYuUqUU=

Hi,

I do not understand the problem of using a kernel with double coordinates.
Moreover, I tried using the sample code given in the documentation and
I still have the problem (2D Regularized Boolean Set-Operations ).

Olivier


2007/3/13, Efi Fogel < >:
Looking at the attached code, the 1st line already reveals that you are
using an inexact number type. Instead of defining your own, you can use
one of the predefined kernel. Since you need to construct new geometric
objects (i.e., intersections), try:

    CGAL::Exact_predicates_exact_constructions_kernel

wrote:

>Hi,
>
>I am currently having a problem computing an intersection of 2 polygons. My program stops, and enven with visual debuger, I do not know what happen. My current problem stands in a method from a class. Here is the prototype :
>
>void Paving::ComputeCrops( const std::vector< CGAL::Polygon_2<CCd> > &polygones )
>
>I previously defined :
>
>typedef CGAL::Cartesian<double> CCd;
>
>Here is the (main) code in my method :
>
>std::vector< CGAL::Polygon_2<CCd> >::const_iterator itb_pol = polygones.begin(), ite_pol = polygones.end();
>for (;itb_pol!=ite_pol;itb_pol++,cpt++)
>{
>       CGAL::Polygon_2<CCd> poly_proj;
>       CGAL::Polygon_2<CCd>::Vertex_circulator circb = (*itb_pol).vertices_circulator(), done = circb;
>       do
>       {
>               TPoint3D <double> p3d = mnt.GetPoint( (*circb).x() , (*circb).y() );
>               TPoint2D <double> p2d;
>               if ( strcmp(m_DEM_type,"ground") == 0 )
>               {
>                       ori.GroundToPhoto(p3d,p2d);
>               }
>               else // type = "map"
>               {
>                       ori.MapToPhoto(p3d,p2d);
>               }
>               CCd::Point_2 pi( p2d.x,p2d.y);
>               poly_proj.push_back( pi );
>               } while( (++circb)!=done ) ;
>
>               // on cree le polygone de l'image
>               CGAL::Polygon_2<CCd> poly_image;
>               {
>                       CCd::Point_2 pi0(0.,0.);
>                       CCd::Point_2 pi1(ori.GetNs().-1,0.);
>                       CCd::Point_2 pi2(ori.GetNs().-1,ori.GetNl()-1.);
>                       CCd::Point_2 pi3(0.,ori.GetNl()-1.);
>                       poly_image.push_back( pi0 );
>                       poly_image.push_back( pi1 );
>                       poly_image.push_back( pi2 );
>                       poly_image.push_back( pi3 );
>               }
>
>               // On fait l'intersection du polygone image et du polygone projete
>               std::list< Polygon_2_WH_CCd > intR;
>               std::list< Polygon_2_WH_CCd >::iterator it;
>               CGAL::intersection(poly_proj,poly_image,std::back_inserter(intR));
>
>/* ... */
>
>
>I also have defined :
>
>typedef CGAL::Polygon_2<CCd> Polygon_2_CCd;
>typedef CGAL::Polygon_with_holes_2<CCd> Polygon_2_WH_CCd;
>
>
>My programs suddenly stops (sometimes) in the CGAL::intersection(...) function. I really do not understand what happen. The both polygons contain always 4 points. The debuger did not helped me, that why I write to the list.
>
>Is there any explanation for this behavior ?
>Is there any way to test if there is a problem, like a try ... catch statement ?
>
>Thanks in advance for your answers.
>
>Olivier Tournaire
>
>PS : I have also tried the same code, remplacing CGAL::intersection(...) with CGAL::do_intersect(...). Same result ...
>
>


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




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