Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Bug: CGAL::natural_neighbor_coordinates_2() with CGAL::Triangulation_euclidean_traits_...

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Bug: CGAL::natural_neighbor_coordinates_2() with CGAL::Triangulation_euclidean_traits_...


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Bug: CGAL::natural_neighbor_coordinates_2() with CGAL::Triangulation_euclidean_traits_...
  • Date: Mon, 05 Jul 2010 13:41:17 +0200

Dear Lehtonen,

here is a patch, together with patched files that solve your problem.

FYI, as documented here
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Interpolation_ref/Function_natural_neighbor_coordinates_2.html#Index_anchor_2305
natural_neighbor_coordinates_2 requires the geom_traits to be a model of
PolygonTraits_2. Triangulation_euclidean_traits_xy_3 is not documented
as such a model, thus the compilation error. For convenience, I added
the functionalities needed to the traits classes.


Best,

S.

Lehtonen, Matti/HIIT wrote:
Hi!

Only one of following calls is compiled without "error: no matching function
for
call to �natural_neighbor_coordinates_2(...)�". I don't see any reason (==no
need to be incompatible with euclidean traits), why they all shouldn't be
compiled successfully.

Because GCC (gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3) is so unhelpful to tell why
compilation fails (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40793), so
I
cannot say exactly why these examples fail. This example is collected by the
hard way, spending many, Many hours to identify the direction to the actual
problem.


Versions:
// $URL:
svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Interpolation/include/CGAL/natural_neighbor_coordinates_2.h
$
// $Id: natural_neighbor_coordinates_2.h 44490 2008-07-27 11:54:19Z spion $

// $URL:
svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_2.h
$
// $Id: Triangulation_euclidean_traits_2.h 48844 2009-04-21 18:28:04Z spion $

patched:
// $URL:
svn+ssh:///svn/cgal/branches/CGAL-3.6-branch/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_xy_3.h
$
// $Id: Triangulation_euclidean_traits_xy_3.h 57043 2010-06-24 07:56:01Z
sloriot
$

// $URL:
svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h
$
// $Id: Delaunay_triangulation_2.h 46169 2008-10-08 13:44:06Z pmachado $


typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Triangulation_euclidean_traits_2<Kernel> Gt2;
typedef CGAL::Triangulation_euclidean_traits_xy_3<Kernel> Gt3;

typedef CGAL::Delaunay_triangulation_2<Kernel> DTr1;
typedef CGAL::Delaunay_triangulation_2<Gt2> DTr2;
typedef CGAL::Delaunay_triangulation_2<Gt3> DTr3;

typedef DTr1::Geom_traits::Point_2 Point1;
typedef DTr2::Geom_traits::Point_2 Point2;
typedef DTr3::Geom_traits::Point_2 Point3;

DTr1 T1;
DTr2 T2;
DTr3 T3;

Point1 p1;
Point2 p2;
Point3 p3;

std::vector<std::pair<Point1, FT> > coords1;
std::vector<std::pair<Point2, FT> > coords2;
std::vector<std::pair<Point3, FT> > coords3;

// My code: fails
(void) CGAL::natural_neighbor_coordinates_2( T3, p3, std::back_inserter(
coords3 ) );

// Test case: fails
(void) CGAL::natural_neighbor_coordinates_2( T2, p2, std::back_inserter(
coords2 ) );

// Exactly like in example: okay
(void) CGAL::natural_neighbor_coordinates_2( T1, p1, std::back_inserter(
coords1 ) );



Lehtonen, Matti

Researcher, head programmer - Helsinki Institute for Information Technology
HIIT
http://www.hiit.fi/

--- Triangulation_euclidean_traits_2.h	2010-07-05 12:13:00.478201079 +0200
+++ /home/sloriot/CGAL/branches/CGAL-3.6-branch/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_2.h	2010-01-19 08:45:07.027024727 +0100
@@ -57,13 +57,7 @@
   typedef typename R::Construct_triangle_2       Construct_triangle_2;
   typedef typename R::Construct_direction_2      Construct_direction_2;
   typedef typename R::Construct_ray_2            Construct_ray_2;
-
-  //for natural_neighbor_coordinates_2
-  typedef typename R::FT                         FT;
-  typedef typename R::Equal_x_2                  Equal_x_2;
-  typedef typename R::Compute_area_2             Compute_area_2;
-  Compute_area_2 compute_area_2_object () const {return Compute_area_2();}
-
+  
   // for compatibility with previous versions
   typedef Point_2      Point;
   typedef Segment_2    Segment;
--- Triangulation_euclidean_traits_xy_3.h	2010-07-05 13:25:26.125221214 +0200
+++ /home/sloriot/CGAL/branches/CGAL-3.6-branch/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_xy_3.h	2010-06-24 10:45:27.724445185 +0200
@@ -90,60 +90,6 @@
 };
 
 
-template <class R>
-class Circumcenter_center_xy_3
-{
-  typedef typename R::Point_3   Point_3; 
-  typedef typename R::Point_2   Point_2;
-
-  typename R::FT x(const Point_3 &p) const { return p.x(); }
-  typename R::FT y(const Point_3 &p) const { return p.y(); }
-  
-  Point_2 project(const Point_3& p) const
-  {
-    return Point_2(x(p),y(p));
-  }
-  
-  Point_3 embed (const Point_2& p) const 
-  {
-    return Point_3(p.x(),p.y(),typename R::FT(0));
-  }
-  
-public:
-  Point_3 operator() (const Point_3& p1,const Point_3& p2) const
-  {
-    return embed( circumcenter(project(p1),project(p2)) );
-  }
-
-  Point_3 operator() (const Point_3& p1,const Point_3& p2,const Point_3& p3) const
-  {
-    return embed( circumcenter(project(p1),project(p2),project(p3)) );
-  }
-};
-
-template <class R>
-class Compute_area_xy_3
-{
-  typedef typename R::Point_3   Point_3; 
-  typedef typename R::Point_2   Point_2;
-
-  typename R::FT x(const Point_3 &p) const { return p.x(); }
-  typename R::FT y(const Point_3 &p) const { return p.y(); }
-  
-  Point_2 project(const Point_3& p) const
-  {
-    return Point_2(x(p),y(p));
-  }
-
-  
-public:
-  typename R::FT operator() (const Point_3& p1,const Point_3& p2,const Point_3& p3) const
-  {
-    return R().compute_area_2_object() ( project(p1),project(p2),project(p3) );
-  }
-};
-
-
 template < class R >
 class Triangulation_euclidean_traits_xy_3 {
 public:
@@ -163,14 +109,6 @@
   typedef typename Rp::Construct_segment_3   Construct_segment_2;
   typedef typename Rp::Construct_triangle_3  Construct_triangle_2;
 
-  //for natural_neighbor_coordinates_2
-  typedef typename R::FT                                      FT;
-  typedef typename R::Equal_x_3                               Equal_x_2;
-  typedef Circumcenter_center_xy_3<R>                         Construct_circumcenter_2;
-  typedef Compute_area_xy_3<R>                                Compute_area_2;
-  Construct_circumcenter_2 construct_circumcenter_2_object () const {return Construct_circumcenter_2();}
-  Compute_area_2 compute_area_2_object () const {return Compute_area_2();}  
-
   // for compatibility with previous versions
   typedef Point_2      Point;
   typedef Segment_2    Segment;
--- Triangulation_euclidean_traits_xz_3.h	2010-07-05 13:31:39.653033291 +0200
+++ /home/sloriot/CGAL/branches/CGAL-3.6-branch/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_xz_3.h	2010-06-24 10:45:27.724445185 +0200
@@ -89,59 +89,6 @@
   }
 };
 
-template <class R>
-class Circumcenter_center_xz_3
-{
-  typedef typename R::Point_3   Point_3; 
-  typedef typename R::Point_2   Point_2;
-
-  typename R::FT x(const Point_3 &p) const { return p.x(); }
-  typename R::FT y(const Point_3 &p) const { return p.z(); }
-  
-  Point_2 project(const Point_3& p) const
-  {
-    return Point_2(x(p),y(p));
-  }
-  
-  Point_3 embed (const Point_2& p) const 
-  {
-    return Point_3(p.x(),typename R::FT(0),p.y());
-  }
-  
-public:
-  Point_3 operator() (const Point_3& p1,const Point_3& p2) const
-  {
-    return embed( circumcenter(project(p1),project(p2)) );
-  }
-
-  Point_3 operator() (const Point_3& p1,const Point_3& p2,const Point_3& p3) const
-  {
-    return embed( circumcenter(project(p1),project(p2),project(p3)) );
-  }
-};
-
-template <class R>
-class Compute_area_xz_3
-{
-  typedef typename R::Point_3   Point_3; 
-  typedef typename R::Point_2   Point_2;
-
-  typename R::FT x(const Point_3 &p) const { return p.x(); }
-  typename R::FT y(const Point_3 &p) const { return p.z(); }
-  
-  Point_2 project(const Point_3& p) const
-  {
-    return Point_2(x(p),y(p));
-  }
-
-  
-public:
-  typename R::FT operator() (const Point_3& p1,const Point_3& p2,const Point_3& p3) const
-  {
-    return R().compute_area_2_object() ( project(p1),project(p2),project(p3) );
-  }
-};
-
 
 template < class R >
 class Triangulation_euclidean_traits_xz_3 {
@@ -162,14 +109,6 @@
   typedef typename Rp::Construct_segment_3   Construct_segment_2;
   typedef typename Rp::Construct_triangle_3  Construct_triangle_2;
 
-  //for natural_neighbor_coordinates_2
-  typedef typename R::FT                                      FT;
-  typedef typename R::Equal_x_3                               Equal_x_2;
-  typedef Circumcenter_center_xz_3<R>                         Construct_circumcenter_2;
-  typedef Compute_area_xz_3<R>                                Compute_area_2;
-  Construct_circumcenter_2 construct_circumcenter_2_object () const {return Construct_circumcenter_2();}
-  Compute_area_2 compute_area_2_object () const {return Compute_area_2();}  
-
   // for compatibility with previous versions
   typedef Point_2      Point;
   typedef Segment_2    Segment;
--- Triangulation_euclidean_traits_yz_3.h	2010-07-05 13:29:31.760970937 +0200
+++ /home/sloriot/CGAL/branches/CGAL-3.6-branch/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_yz_3.h	2010-06-24 10:45:27.724445185 +0200
@@ -90,58 +90,6 @@
   }
 };
 
-template <class R>
-class Circumcenter_center_yz_3
-{
-  typedef typename R::Point_3   Point_3; 
-  typedef typename R::Point_2   Point_2;
-
-  typename R::FT x(const Point_3 &p) const { return p.y(); }
-  typename R::FT y(const Point_3 &p) const { return p.z(); }
-  
-  Point_2 project(const Point_3& p) const
-  {
-    return Point_2(x(p),y(p));
-  }
-  
-  Point_3 embed (const Point_2& p) const 
-  {
-    return Point_3(typename R::FT(0),p.x(),p.y());
-  }
-  
-public:
-  Point_3 operator() (const Point_3& p1,const Point_3& p2) const
-  {
-    return embed( circumcenter(project(p1),project(p2)) );
-  }
-
-  Point_3 operator() (const Point_3& p1,const Point_3& p2,const Point_3& p3) const
-  {
-    return embed( circumcenter(project(p1),project(p2),project(p3)) );
-  }
-};
-
-template <class R>
-class Compute_area_yz_3
-{
-  typedef typename R::Point_3   Point_3; 
-  typedef typename R::Point_2   Point_2;
-
-  typename R::FT x(const Point_3 &p) const { return p.y(); }
-  typename R::FT y(const Point_3 &p) const { return p.z(); }
-  
-  Point_2 project(const Point_3& p) const
-  {
-    return Point_2(x(p),y(p));
-  }
-
-  
-public:
-  typename R::FT operator() (const Point_3& p1,const Point_3& p2,const Point_3& p3) const
-  {
-    return R().compute_area_2_object() ( project(p1),project(p2),project(p3) );
-  }
-};
 
 template < class R >
 class Triangulation_euclidean_traits_yz_3 {
@@ -162,14 +110,6 @@
   typedef typename Rp::Construct_segment_3   Construct_segment_2;
   typedef typename Rp::Construct_triangle_3  Construct_triangle_2;
 
-  //for natural_neighbor_coordinates_2
-  typedef typename R::FT                                      FT;
-  typedef typename R::Equal_y_3                               Equal_x_2;
-  typedef Circumcenter_center_yz_3<R>                         Construct_circumcenter_2;
-  typedef Compute_area_yz_3<R>                                Compute_area_2;
-  Construct_circumcenter_2 construct_circumcenter_2_object () const {return Construct_circumcenter_2();}
-  Compute_area_2 compute_area_2_object () const {return Compute_area_2();}  
-
   // for compatibility with previous versions
   typedef Point_2      Point;
   typedef Segment_2    Segment;

Attachment: patch.tgz
Description: application/compressed-tar




Archive powered by MHonArc 2.6.16.

Top of Page