1

So i have the following which should create a Delaunay triangle type for CGAL:

std::vector<Point> points = createPoints() // Fills points, This works. 
Delaunay dt(points.begin(), points.end());

According to this question and the manual here. This should work, however I get the following error:

[100%] Building CXX object src/utilities/TriangulationVolumeCalculation/CMakeFiles/calculateVolumeDifference.dir/CalculateVolumeDifference.cpp.o
/home/uqbdart/SMG/sao2/src/utilities/TriangulationVolumeCalculation/CalculateVolumeDifference.cpp: In function ‘void fillDelaunay(Delaunay&, std::vector<std::vector<double> >)’:
/home/uqbdart/SMG/sao2/src/utilities/TriangulationVolumeCalculation/CalculateVolumeDifference.cpp:31:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
/home/uqbdart/SMG/sao2/src/utilities/TriangulationVolumeCalculation/CalculateVolumeDifference.cpp: In function ‘int main(int, char**)’:
/home/uqbdart/SMG/sao2/src/utilities/TriangulationVolumeCalculation/CalculateVolumeDifference.cpp:50:27: error: no matching function for call to ‘CGAL::Delaunay_triangulation_2<CGAL::Projection_traits_xy_3<CGAL::Epick> >::Delaunay_triangulation_2(std::vector<CGAL::Point_3<CGAL::Epick> >::iterator&, std::vector<CGAL::Point_3<CGAL::Epick> >::iterator&)’
/home/uqbdart/SMG/sao2/src/utilities/TriangulationVolumeCalculation/CalculateVolumeDifference.cpp:50:27: note: candidates are:
In file included from /home/uqbdart/SMG/sao2/src/utilities/TriangulationVolumeCalculation/CalculateVolumeDifference.cpp:3:0:
/usr/local/include/CGAL/Delaunay_triangulation_2.h:89:3: note: CGAL::Delaunay_triangulation_2<Gt, Tds>::Delaunay_triangulation_2(const CGAL::Delaunay_triangulation_2<Gt, Tds>&) [with Gt = CGAL::Projection_traits_xy_3<CGAL::Epick>; Tds = CGAL::Triangulation_data_structure_2<CGAL::Triangulation_vertex_base_2<CGAL::Projection_traits_xy_3<CGAL::Epick>, CGAL::Triangulation_ds_vertex_base_2<void> >, CGAL::Triangulation_ds_face_base_2<void> >]
/usr/local/include/CGAL/Delaunay_triangulation_2.h:89:3: note:   candidate expects 1 argument, 2 provided
/usr/local/include/CGAL/Delaunay_triangulation_2.h:86:2: note: CGAL::Delaunay_triangulation_2<Gt, Tds>::Delaunay_triangulation_2(const Gt&) [with Gt = CGAL::Projection_traits_xy_3<CGAL::Epick>; Tds = CGAL::Triangulation_data_structure_2<CGAL::Triangulation_vertex_base_2<CGAL::Projection_traits_xy_3<CGAL::Epick>, CGAL::Triangulation_ds_vertex_base_2<void> >, CGAL::Triangulation_ds_face_base_2<void> >]
/usr/local/include/CGAL/Delaunay_triangulation_2.h:86:2: note:   candidate expects 1 argument, 2 provided
make[2]: *** [src/utilities/TriangulationVolumeCalculation/CMakeFiles/calculateVolumeDifference.dir/CalculateVolumeDifference.cpp.o] Error 1
make[1]: *** [src/utilities/TriangulationVolumeCalculation/CMakeFiles/calculateVolumeDifference.dir/all] Error 2
make: *** [all] Error 2

The manual states that:

 Precondition:  The value_type of first and last is Point.

Where first and last are the beginning and end iterator.

EDIT: I solved it by doing this:

Delaunay dt;
dt.insert(points.begin(), points.end());

Although it is fixed, the type declarations for the required iterator are the same according to the manual. Why would it fail in the constructor and not in the insert function.

Community
  • 1
  • 1
Fantastic Mr Fox
  • 32,495
  • 27
  • 95
  • 175

2 Answers2

2

By any chance, would you be using an old release of CGAL ? This constructor from range was introduced later than the insert() function, if memory serves me well. Well, just check the code.

Sylvain Pion
  • 575
  • 1
  • 4
  • 11
1

The issue is probably that your class Point do not have the required methods to be a template parameter of Delaunay_triangulation_2 (that I guess you used to defined the class Delaunay)

What are the definition of the classes Delaunay and Point?

Useful examples can be found here: http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_2/Chapter_main.html

Boris Dalstein
  • 7,015
  • 4
  • 30
  • 59
  • No point is a part of the CGAL lib. It is a typedef like this: `typedef K::Point_3 Point;` – Fantastic Mr Fox Jun 13 '13 at 04:22
  • Alright, seen your edit. Then I have no idea why it works in insert and not in the constructor. Though, the documentation specifies the concept `PointInputIterator` for `insert()`, and `InputIterator` for the constructor. Maybe there's a subtle difference, but I can't help you on this. – Boris Dalstein Jun 13 '13 at 04:29