Search code examples
meshcgal

Lloyd optimization using CGAL 4-12-beta2


I am trying to optimize the mesh obtained after performing delauny refinement as shown below

CGAL::refine_Delaunay_mesh_2(cdtp, seed.begin(), seed.end(), Criteria( cnfg_.MaxTriangleSkewness(), cnfg_.MaxTriangleEdgeLength()*2.0));
if(OptimizeMesh)
{
    CGAL::lloyd_optimize_mesh_2(cdtp ,CGAL::parameters::max_iteration_number = MeshOptItr);
}

However I get a compiler error as shown below

3>D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Mesh_2/Mesh_global_optimizer_2.h(379): error C2039: 'sizing_info' : is not a member of 'CGAL::Triangulation_vertex_base_with_info_2<Info_,GT,Vb>'
3>          with
3>          [
3>              Info_=std::pair<std::pair<int,int>,std::pair<int,IdType>>,
3>              GT=Kernel,
3>              Vb=CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>
3>          ]
3>          D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Mesh_2/Mesh_global_optimizer_2.h(371) : while compiling class template member function 'void CGAL::Mesh_2::Mesh_global_optimizer_2<CDT,MoveFunction>::update_mesh(const std::vector<_Ty> &)'
3>          with
3>          [
3>              CDT=CGAL::Constrained_triangulation_plus_2<CDTriangulation>,
3>              MoveFunction=Mv,
3>              _Ty=std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<std::pair<std::pair<int,int>,std::pair<int,IdType>>,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::Point_2<CGAL::Epick>>
3>          ]
3>          D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Mesh_2/Mesh_global_optimizer_2.h(178) : see reference to function template instantiation 'void CGAL::Mesh_2::Mesh_global_optimizer_2<CDT,MoveFunction>::update_mesh(const std::vector<_Ty> &)' being compiled
3>          with
3>          [
3>              CDT=CGAL::Constrained_triangulation_plus_2<CDTriangulation>,
3>              MoveFunction=Mv,
3>              _Ty=std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<std::pair<std::pair<int,int>,std::pair<int,IdType>>,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::Point_2<CGAL::Epick>>
3>          ]

I use visual studio 2012 on windows 7. Examples in the CGAL website does not illustrate it for vertex with attached info. How do I overcome this?


Solution

  • Without seeing any code I can only guess that the vertex and/or face type and not valid models to use the optimization method.

    As documented here, vertex base and face base of its underlying TriangulationDataStructure_2 respectively implementing the concepts DelaunayMeshFaceBase_2 and DelaunayMeshVertexBase_2.

    See also this example.