Add CGAL pre-4.11 support back to e/a/alphashapes3d-periodic
authorDmitriy Morozov <dmitriy@mrzv.org>
Mon, 27 Nov 2017 10:26:59 -0800
changeset 293 bc7bd0ac9af6
parent 292 b90319e7126f
child 294 5810d70ec967
Add CGAL pre-4.11 support back to e/a/alphashapes3d-periodic
examples/alphashapes/alphashapes3d-periodic.hpp
--- a/examples/alphashapes/alphashapes3d-periodic.hpp	Sun Nov 26 18:42:36 2017 -0800
+++ b/examples/alphashapes/alphashapes3d-periodic.hpp	Mon Nov 27 10:26:59 2017 -0800
@@ -218,59 +218,38 @@
     return out;
 }
 
-// FOR CGAL 4.10 use the following code
-//
-// void fill_simplex_set(const Delaunay3D& Dt, AlphaSimplex3D::SimplexSet& simplices)
-// {
-//     // Compute all simplices with their alpha values and attachment information
-//     for(Cell_iterator cur = Dt.cells_begin(); cur != Dt.cells_end(); ++cur){
-//         Delaunay3D::Periodic_tetrahedron ptet = Dt.periodic_tetrahedron(cur);
-//         Delaunay3D::Tetrahedron tet = Dt.tetrahedron(ptet);
-//         RealValue sqrad = CGAL::squared_radius(tet[0], tet[1], tet[2], tet[3]);
-//         simplices.insert(AlphaSimplex3D(*cur, sqrad));
-//     }
-//     rInfo("Cells inserted");
-//     for(Facet_iterator cur = Dt.facets_begin(); cur != Dt.facets_end(); ++cur){
-//         Delaunay3D::Periodic_triangle ptri = Dt.periodic_triangle(*cur);
-//         Delaunay3D::Triangle tri = Dt.triangle(ptri);
-//         RealValue sqrad = CGAL::squared_radius(tri[0], tri[1], tri[2]);
-//         simplices.insert(AlphaSimplex3D(*cur, simplices, Dt, sqrad));
-//     }
-//     rInfo("Facets inserted");
-//     for(Edge_iterator cur = Dt.edges_begin(); cur != Dt.edges_end(); ++cur){
-//         Delaunay3D::Periodic_segment pseg = Dt.periodic_segment(*cur);
-//         Delaunay3D::Segment seg = Dt.segment(pseg);
-//         RealValue sqrad = CGAL::squared_radius(seg[0],seg[1]);
-//         simplices.insert(AlphaSimplex3D(*cur, simplices, Dt, Dt.incident_facets(*cur), sqrad));
-//     }
-//     rInfo("Edges inserted");
-//     for(Vertex_iterator cur = Dt.vertices_begin(); cur != Dt.vertices_end(); ++cur)
-//         simplices.insert(AlphaSimplex3D(*cur));
-//     rInfo("Vertices inserted");
-// }
-
-// FOR CGAL 4.11 you must change to the following code
-//
 void fill_simplex_set(const Delaunay3D& Dt, AlphaSimplex3D::SimplexSet& simplices)
 {
    // Compute all simplices with their alpha values and attachment information
    for(Cell_iterator cur = Dt.cells_begin(); cur != Dt.cells_end(); ++cur){
        Delaunay3D::Periodic_tetrahedron ptet = Dt.periodic_tetrahedron(cur);
+#if CGAL_VERSION_NR >= CGAL_VERSION_NUMBER(4,11,0)
        Delaunay3D::Tetrahedron tet = Dt.construct_tetrahedron(ptet);
+#else
+       Delaunay3D::Tetrahedron tet = Dt.tetrahedron(ptet);
+#endif
        RealValue sqrad = CGAL::squared_radius(tet[0], tet[1], tet[2], tet[3]);
        simplices.insert(AlphaSimplex3D(*cur, sqrad));
    }
    rInfo("Cells inserted");
    for(Facet_iterator cur = Dt.facets_begin(); cur != Dt.facets_end(); ++cur){
        Delaunay3D::Periodic_triangle ptri = Dt.periodic_triangle(*cur);
+#if CGAL_VERSION_NR >= CGAL_VERSION_NUMBER(4,11,0)
        Delaunay3D::Triangle tri = Dt.construct_triangle(ptri);
+#else
+       Delaunay3D::Triangle tri = Dt.triangle(ptri);
+#endif
        RealValue sqrad = CGAL::squared_radius(tri[0], tri[1], tri[2]);
        simplices.insert(AlphaSimplex3D(*cur, simplices, Dt, sqrad));
    }
    rInfo("Facets inserted");
    for(Edge_iterator cur = Dt.edges_begin(); cur != Dt.edges_end(); ++cur){
        Delaunay3D::Periodic_segment pseg = Dt.periodic_segment(*cur);
+#if CGAL_VERSION_NR >= CGAL_VERSION_NUMBER(4,11,0)
        Delaunay3D::Segment seg = Dt.construct_segment(pseg);
+#else
+       Delaunay3D::Segment seg = Dt.segment(pseg);
+#endif
        RealValue sqrad = CGAL::squared_radius(seg[0],seg[1]);
        simplices.insert(AlphaSimplex3D(*cur, simplices, Dt, Dt.incident_facets(*cur), sqrad));
    }