Как создать ограниченную триангуляцию Делоне с CGAL с пользовательской информацией для каждой вершины? - PullRequest
0 голосов
/ 11 февраля 2019

Я хочу создать ограниченную триангуляцию Делоне и прикрепить пользовательский фрагмент информации к каждой вершине (значение unsigned в примере ниже).

Я прочитал официальный пример добавить информацию в «нормальную» триангуляцию, которая отлично работает.Я также создал ограниченную триангуляцию Делоне без информации, которая также работает.

Если я, однако, настрою пример, чтобы использовать ограниченную триангуляцию Делоне с информацией, что означает только изменение двух строк, отмеченных в коде ниже,Я получаю множество ошибок сборки (см. Ниже).

Я уже потратил несколько часов, пытаясь разобраться в ошибках или найти другой способ добавления информации в каждую вершину.У кого-нибудь есть идея, что я делаю не так или как я могу решить эту проблему?

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

1 Ответ

0 голосов
/ 11 февраля 2019

Тип лица (второй параметр шаблона в TDS) должен быть моделью ConstrainedTriangulationFaceBase_2, например CGAL::Constrained_triangulation_face_base_2<K> в вашем случае.

Заменить:

typedef CGAL::Triangulation_data_structure_2<Vb>                    Tds;

1011 *
...