1

したがって、CGALのドローネ三角形タイプを作成する必要がある次のものがあります。

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

この質問とマニュアルhereによると。これは機能するはずですが、次のエラーが発生します。

[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

マニュアルには次のように記載されています。

 Precondition:  The value_type of first and last is Point.

first と last は開始イテレータと終了イテレータです。

編集:私はこれを行うことでそれを解決しました:

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

修正済みですが、必要なイテレータの型宣言はマニュアルによると同じです。insert関数ではなくコンストラクターで失敗するのはなぜですか。

4

2 に答える 2

2

ひょっとして、古いリリースの CGAL を使用しているのでしょうか? この範囲からのコンストラクターは、メモリがうまく機能する場合、insert() 関数よりも後に導入されました。さて、コードを確認してください。

于 2013-06-13T05:06:45.930 に答える
1

問題はおそらく、クラスPointにテンプレートパラメーターになるために必要なメソッドがないことDelaunay_triangulation_2です(クラスを定義していたと思いますDelaunay

Delaunayクラスとの定義は何Pointですか?

有用な例はここにあります: http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_2/Chapter_main.html

于 2013-06-13T04:17:30.210 に答える