我想创建一个约束Delaunay三角测量和附加的信息到每个顶点的自定义件(在下面的例子中unsigned
值)。
我已阅读the official example到的信息添加到“正常”的三角测量,它完美的作品。我还创建了一个约束Delaunay三角剖分没有信息,其工作为好。
如果我不过调整的例子使用约束Delaunay三角剖分与信息,只意味着改变标志着在下面的两行代码,我得到的构建错误的负载(见下文)。
我现在花了几个小时,试图让错误的感觉,或者找到另一种方式将信息添加到每个顶点。有没有人有一个想法,我做错了什么或如何才能够着手解决这个问题?
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h> // change 1
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_with_info_2<unsigned, K> Vb;
typedef CGAL::Triangulation_data_structure_2<Vb> Tds;
typedef CGAL::Constrained_Delaunay_triangulation_2<K, Tds> Delaunay; // change 2
typedef Delaunay::Point Point;
int main()
{
std::vector< std::pair<Point,unsigned> > points;
points.push_back( std::make_pair(Point(0,0),0) );
points.push_back( std::make_pair(Point(1,0),1) );
points.push_back( std::make_pair(Point(0,1),2) );
points.push_back( std::make_pair(Point(14,4),3) );
points.push_back( std::make_pair(Point(2,2),4) );
points.push_back( std::make_pair(Point(-4,0),5) );
Delaunay T;
T.insert( points.begin(),points.end() );
CGAL_assertion( T.number_of_vertices() == 6 );
// check that the info was correctly set.
Delaunay::Finite_vertices_iterator vit;
for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit)
if( points[ vit->info() ].first != vit->point() ){
std::cerr << "Error different info" << std::endl;
exit(EXIT_FAILURE);
}
std::cout << "OK" << std::endl;
return 0;
}
1>C:\Users\Albert\Documents\libs\cgal_4_13\include\CGAL/Constrained_triangulation_2.h(653): error C2039: 'is_constrained': is not a member of 'CGAL::Triangulation_ds_face_base_2<TDS2>'
1> with
1> [
1> TDS2=CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>
1> ]
1>C:\Users\Albert\Documents\libs\cgal_4_13\include\CGAL/Triangulation_ds_face_base_2.h(356): note: see declaration of 'CGAL::Triangulation_ds_face_base_2<TDS2>'
1> with
1> [
1> TDS2=CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>
1> ]
1>C:\Users\Albert\Documents\libs\cgal_4_13\include\CGAL/Constrained_triangulation_2.h(648): note: while compiling class template member function 'CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<unsigned int,GT,CGAL::Triangulation_vertex_base_2<GT,CGAL::Triangulation_ds_vertex_base_2<TDS2>>>,CGAL::Default,CGAL::Default,CGAL::Default>,false> CGAL::Constrained_triangulation_2<Gt,Tds_,Itag_>::insert(const CGAL::Point_2<Kernel_> &,CGAL::Triangulation_2<Gt,CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>>::Locate_type,CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_ds_face_base_2<TDS2>,CGAL::Default,CGAL::Default,CGAL::Default>,false>,int)'
1> with
1> [
1> GT=K,
1> TDS2=CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>,
1> Gt=K,
1> Tds_=Tds,
1> Itag_=CGAL::Default,
1> Kernel_=CGAL::Epick
1> ]
1>C:\Users\Albert\Documents\libs\cgal_4_13\include\CGAL/Constrained_triangulation_2.h(622): note: see reference to function template instantiation 'CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<unsigned int,GT,CGAL::Triangulation_vertex_base_2<GT,CGAL::Triangulation_ds_vertex_base_2<TDS2>>>,CGAL::Default,CGAL::Default,CGAL::Default>,false> CGAL::Constrained_triangulation_2<Gt,Tds_,Itag_>::insert(const CGAL::Point_2<Kernel_> &,CGAL::Triangulation_2<Gt,CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>>::Locate_type,CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_ds_face_base_2<TDS2>,CGAL::Default,CGAL::Default,CGAL::Default>,false>,int)' being compiled
1> with
1> [
1> GT=K,
1> TDS2=CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>,
1> Gt=K,
1> Tds_=Tds,
1> Itag_=CGAL::Default,
1> Kernel_=CGAL::Epick
1> ]
1>C:\Users\Albert\Documents\libs\cgal_4_13\include\CGAL/Constrained_Delaunay_triangulation_2.h(888): note: while compiling class template member function 'void CGAL::Constrained_Delaunay_triangulation_2<K,Tds,CGAL::Default>::triangulate_hole(std::list<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_ds_face_base_2<TDS2>,CGAL::Default,CGAL::Default,CGAL::Default>,false>,std::allocator<_Kty>> &,std::list<std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_ds_face_base_2<TDS2>,CGAL::Default,CGAL::Default,CGAL::Default>,false>,int>,std::allocator<_Ty>> &,std::list<_Ty,std::allocator<_Ty>> &)'
1> with
1> [
1> TDS2=CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>,
1> _Kty=CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_ds_face_base_2<CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>>,CGAL::Default,CGAL::Default,CGAL::Default>,false>,
1> _Ty=std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_ds_face_base_2<CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>>,CGAL::Default,CGAL::Default,CGAL::Default>,false>,int>
1> ]
1>C:\Users\Albert\Documents\projects\TestEnv_CGAL\main.cpp(9): note: see reference to class template instantiation 'CGAL::Constrained_Delaunay_triangulation_2<K,Tds,CGAL::Default>' being compiled
1>C:\Users\Albert\Documents\libs\cgal_4_13\include\CGAL/Constrained_triangulation_2.h(1142): error C2039: 'set_constraint': is not a member of 'CGAL::Triangulation_ds_face_base_2<TDS2>'
1> with
1> [
1> TDS2=CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>
1> ]
1>C:\Users\Albert\Documents\libs\cgal_4_13\include\CGAL/Triangulation_ds_face_base_2.h(356): note: see declaration of 'CGAL::Triangulation_ds_face_base_2<TDS2>'
1> with
1> [
1> TDS2=CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>
1> ]
1>C:\Users\Albert\Documents\libs\cgal_4_13\include\CGAL/Constrained_triangulation_2.h(1130): note: while compiling class template member function 'void CGAL::Constrained_triangulation_2<Gt,Tds_,Itag_>::triangulate_hole(std::list<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_ds_face_base_2<TDS2>,CGAL::Default,CGAL::Default,CGAL::Default>,false>,std::allocator<_Kty>> &,std::list<std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_ds_face_base_2<TDS2>,CGAL::Default,CGAL::Default,CGAL::Default>,false>,int>,std::allocator<_Ty>> &,std::list<_Ty,std::allocator<_Ty>> &,std::list<_Ty,std::allocator<_Ty>> &)'
1> with
1> [
1> Gt=K,
1> Tds_=Tds,
1> Itag_=CGAL::Default,
1> TDS2=CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>,
1> _Kty=CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_ds_face_base_2<CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>>,CGAL::Default,CGAL::Default,CGAL::Default>,false>,
1> _Ty=std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_ds_face_base_2<CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>>,CGAL::Default,CGAL::Default,CGAL::Default>,false>,int>
1> ]
1>C:\Users\Albert\Documents\libs\cgal_4_13\include\CGAL/Constrained_Delaunay_triangulation_2.h(890): note: see reference to function template instantiation 'void CGAL::Constrained_triangulation_2<Gt,Tds_,Itag_>::triangulate_hole(std::list<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_ds_face_base_2<TDS2>,CGAL::Default,CGAL::Default,CGAL::Default>,false>,std::allocator<_Kty>> &,std::list<std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_ds_face_base_2<TDS2>,CGAL::Default,CGAL::Default,CGAL::Default>,false>,int>,std::allocator<_Ty>> &,std::list<_Ty,std::allocator<_Ty>> &,std::list<_Ty,std::allocator<_Ty>> &)' being compiled
1> with
1> [
1> Gt=K,
1> Tds_=Tds,
1> Itag_=CGAL::Default,
1> TDS2=CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>,
1> _Kty=CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_ds_face_base_2<CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>>,CGAL::Default,CGAL::Default,CGAL::Default>,false>,
1> _Ty=std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_ds_face_base_2<CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>>,CGAL::Default,CGAL::Default,CGAL::Default>,false>,int>
1> ]
1>C:\Users\Albert\Documents\libs\cgal_4_13\include\CGAL/Constrained_triangulation_2.h(1143): error C2039: 'set_constraint': is not a member of 'CGAL::Triangulation_ds_face_base_2<TDS2>'
1> with
1> [
1> TDS2=CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>
1> ]
1>C:\Users\Albert\Documents\libs\cgal_4_13\include\CGAL/Triangulation_ds_face_base_2.h(356): note: see declaration of 'CGAL::Triangulation_ds_face_base_2<TDS2>'
1> with
1> [
1> TDS2=CGAL::Triangulation_data_structure_2<Vb,CGAL::Triangulation_ds_face_base_2<void>>
1> ]
面部类型(在TDS第二模板参数)必须ConstrainedTriangulationFaceBase_2
的模型,用于在你情况示例CGAL::Constrained_triangulation_face_base_2<K>
。
更换:
typedef CGAL::Triangulation_data_structure_2<Vb> Tds;
通过
typedef CGAL::Constrained_triangulation_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds;