diff --git a/Advancing_front_surface_reconstruction/doc/Advancing_front_surface_reconstruction/CGAL/Advancing_front_surface_reconstruction.h b/Advancing_front_surface_reconstruction/doc/Advancing_front_surface_reconstruction/CGAL/Advancing_front_surface_reconstruction.h index bf1eb0c4302..dc5418c920f 100644 --- a/Advancing_front_surface_reconstruction/doc/Advancing_front_surface_reconstruction/CGAL/Advancing_front_surface_reconstruction.h +++ b/Advancing_front_surface_reconstruction/doc/Advancing_front_surface_reconstruction/CGAL/Advancing_front_surface_reconstruction.h @@ -11,16 +11,16 @@ data structure that describes the surface. The vertices and facets of the 2D tr store handles to the vertices and faces of the 3D triangulation, which enables the user to explore the 2D as well as 3D neighborhood of vertices and facets of the surface. -\tparam Gt must be a model of `Kernel`. \tparam Dt must be a `Delaunay_triangulation_3` with -`Advancing_front_surface_reconstruction_vertex_base_3` and `Advancing_front_surface_reconstruction_cell_base_3` blended into the vertex and cell type, and the geometric traits class must be the `Exact_predicates_inexact_constructions_kernel`. +`Advancing_front_surface_reconstruction_vertex_base_3` and `Advancing_front_surface_reconstruction_cell_base_3` blended into the vertex and cell type. +The default uses the `Exact_predicates_inexact_constructions_kernel` as geometric traits class. -\tparam Filter must be a functor with `bool operator()(Gt::Point_3,Gt::Point_3,Gt::Point_3)` that allows the user to filter candidate triangles, for example based on its size. - It defaults to a functor that always returns `false`. +\tparam Filter must be a functor with `bool operator()(Point,Point,Point)` that allows the user to filter candidate triangles, for example based on its size. + The type `Point` must be the point type of the geometric traits class of the triangulation. It defaults to a functor that always returns `false`. */ - template< typename Gt, typename Dt, typename Filter> + template< typename Dt, typename Filter> class Advancing_front_surface_reconstruction { public: @@ -199,7 +199,8 @@ has_on_surface(Triangulation_data_structure_2::Vertex_handle v2) const; For a sequence of points computes a sequence of index triples describing the faces of the reconstructed surface. -\tparam PointInputIterator must be an input iterator with 3D points from the `Exact_predicates_inexact_constructions_kernel` as value type. +\tparam PointInputIterator must be an input iterator with 3D points as value type. This point type must +be convertible to `Exact_predicates_inexact_constructions_kernel::Point_3` with the `Cartesian_converter`. \tparam IndicesOutputIterator must be an output iterator to which `CGAL::cpp11::tuple` can be assigned. @@ -223,7 +224,8 @@ describing the faces of the reconstructed surface. For a sequence of points computes a sequence of index triples describing the faces of the reconstructed surface. -\tparam PointInputIterator must be an input iterator with 3D points from the `Exact_predicates_inexact_constructions_kernel` as value type. +\tparam PointInputIterator must be an input iterator with 3D points as value type. This point type must +be convertible to `Exact_predicates_inexact_constructions_kernel::Point_3` with the `Cartesian_converter`. \tparam IndicesOutputIterator must be an output iterator to which `CGAL::cpp11::tuple` can be assigned. \tparam Filter must be a functor with `bool operator()(Gt::Point_3,Gt::Point_3,Gt::Point_3)`. diff --git a/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/boundaries.cpp b/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/boundaries.cpp index 42ceaf8e63f..32c566095ae 100644 --- a/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/boundaries.cpp +++ b/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/boundaries.cpp @@ -5,7 +5,7 @@ #include typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Advancing_front_surface_reconstruction Reconstruction; +typedef CGAL::Advancing_front_surface_reconstruction<> Reconstruction; typedef Reconstruction::Triangulation_3 Triangulation_3; typedef Reconstruction::Outlier_range Outlier_range; typedef Reconstruction::Boundary_range Boundary_range; diff --git a/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/reconstruction_class.cpp b/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/reconstruction_class.cpp index 8ef730cedad..a0264552108 100644 --- a/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/reconstruction_class.cpp +++ b/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/reconstruction_class.cpp @@ -5,7 +5,7 @@ #include typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Advancing_front_surface_reconstruction Reconstruction; +typedef CGAL::Advancing_front_surface_reconstruction<> Reconstruction; typedef Reconstruction::Triangulation_3 Triangulation_3; typedef Reconstruction::Triangulation_data_structure_2 TDS_2; typedef K::Point_3 Point_3; diff --git a/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/reconstruction_fct.cpp b/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/reconstruction_fct.cpp index 479a4633dec..1077854c780 100644 --- a/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/reconstruction_fct.cpp +++ b/Advancing_front_surface_reconstruction/examples/Advancing_front_surface_reconstruction/reconstruction_fct.cpp @@ -1,12 +1,12 @@ #include #include #include -#include +#include #include #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; -typedef Kernel::Point_3 Point_3; +typedef CGAL::Simple_cartesian K; +typedef K::Point_3 Point_3; typedef CGAL::cpp11::tuple Facet; @@ -27,8 +27,16 @@ struct Perimeter { : bound(bound) {} - bool operator()(const Point_3& p, const Point_3& q, const Point_3& r) const + // The point type that will be injected here will be + // CGAL::Exact_predicates_inexact_constructions_kernel::Point_3 + template + bool operator()(const Point& p, const Point& q, const Point& r) const { + // bound == 0 is better than bound < infinity + // as it avoids the distance computations + if(bound == 0){ + return false; + } double d = sqrt(squared_distance(p,q)); if(d>bound) return true; d += sqrt(squared_distance(p,r)) ; @@ -48,7 +56,7 @@ int main(int argc, char* argv[]) std::istream_iterator(), std::back_inserter(points)); - Perimeter perimeter(0.5); + Perimeter perimeter(0); CGAL::advancing_front_surface_reconstruction(points.begin(), points.end(), std::back_inserter(facets), diff --git a/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h b/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h index 5da7e772ff7..8df15dc5d76 100644 --- a/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h +++ b/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -166,14 +167,15 @@ public: }; - template , Advancing_front_surface_reconstruction_cell_base_3 > >, + template < + class Triangulation = Delaunay_triangulation_3, Advancing_front_surface_reconstruction_cell_base_3 > >, class Reject = Always_false> class Advancing_front_surface_reconstruction { public: typedef Triangulation Triangulation_3; - typedef Advancing_front_surface_reconstruction Extract; + typedef typename Triangulation_3::Geom_traits Kernel; + typedef Advancing_front_surface_reconstruction Extract; typedef typename Triangulation_3::Geom_traits Geom_traits; typedef typename Kernel::FT coord_type; @@ -2305,11 +2307,30 @@ namespace AFSR { template struct Auto_count : public std::unary_function >{ mutable int i; - Auto_count() : i(0){} + + Auto_count() + : i(0) + {} + std::pair operator()(const T& p) const { return std::make_pair(p,i++); } }; + + template +struct Auto_count_cc : public std::unary_function >{ + mutable int i; + CC cc; + + Auto_count_cc(CC cc) + : i(0), cc(cc) + {} + + template + std::pair operator()(const T2& p) const { + return std::make_pair(cc(p),i++); + } + }; } @@ -2328,7 +2349,7 @@ advancing_front_surface_reconstruction(PointIterator b, typedef Triangulation_data_structure_3 Tds; typedef Delaunay_triangulation_3 Triangulation_3; - typedef Advancing_front_surface_reconstruction Reconstruction; + typedef Advancing_front_surface_reconstruction Reconstruction; typedef Kernel::Point_3 Point_3; Triangulation_3 dt( boost::make_transform_iterator(b, AFSR::Auto_count()), @@ -2360,11 +2381,14 @@ advancing_front_surface_reconstruction(PointIterator b, typedef Triangulation_data_structure_3 Tds; typedef Delaunay_triangulation_3 Triangulation_3; - typedef Advancing_front_surface_reconstruction Reconstruction; + typedef Advancing_front_surface_reconstruction Reconstruction; + typedef std::iterator_traits::value_type InputPoint; + typedef typename Kernel_traits::Kernel InputKernel; + typedef Cartesian_converter CC; typedef Kernel::Point_3 Point_3; - - Triangulation_3 dt( boost::make_transform_iterator(b, AFSR::Auto_count()), - boost::make_transform_iterator(e, AFSR::Auto_count() ) ); + CC cc=CC(); + Triangulation_3 dt( boost::make_transform_iterator(b, AFSR::Auto_count_cc(cc)), + boost::make_transform_iterator(e, AFSR::Auto_count_cc(cc) ) ); AFSR_options opt; opt.K = radius_ratio_bound; @@ -2391,7 +2415,7 @@ advancing_front_surface_reconstructionP(PointIterator b, typedef Triangulation_data_structure_3 Tds; typedef Delaunay_triangulation_3 Triangulation_3; - typedef Advancing_front_surface_reconstruction Reconstruction; + typedef Advancing_front_surface_reconstruction Reconstruction; typedef typename Kernel::Point_3 Point_3; Triangulation_3 dt( boost::make_transform_iterator(b, AFSR::Auto_count()), @@ -2419,7 +2443,7 @@ advancing_front_surface_reconstructionP(PointIterator b, typedef Triangulation_data_structure_3 Tds; typedef Delaunay_triangulation_3 Triangulation_3; - typedef Advancing_front_surface_reconstruction Reconstruction; + typedef Advancing_front_surface_reconstruction Reconstruction; typedef typename Kernel::Point_3 Point_3; Triangulation_3 dt( boost::make_transform_iterator(b, AFSR::Auto_count()), diff --git a/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h b/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h index cf77c286548..04504b7fae0 100644 --- a/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h +++ b/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction_vertex_base_3.h @@ -31,7 +31,7 @@ namespace CGAL { - template class Advancing_front_surface_reconstruction; + template class Advancing_front_surface_reconstruction; template > class Advancing_front_surface_reconstruction_vertex_base_3 : public VertexBase @@ -45,7 +45,7 @@ public: }; - template friend class Advancing_front_surface_reconstruction; + template friend class Advancing_front_surface_reconstruction; typedef VertexBase Base; diff --git a/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/construct_polyhedron.h b/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/construct_polyhedron.h index 4ee56548a60..dc5f3603b8d 100644 --- a/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/construct_polyhedron.h +++ b/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/construct_polyhedron.h @@ -25,7 +25,7 @@ namespace CGAL { - template + template class Advancing_front_polyhedron_reconstruction; namespace AFSR { diff --git a/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/construct_surface_2.h b/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/construct_surface_2.h index 7147d11cb3b..a217aeb4fe0 100644 --- a/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/construct_surface_2.h +++ b/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/construct_surface_2.h @@ -22,15 +22,15 @@ namespace CGAL { - template + template class Advancing_front_surface_reconstruction; namespace AFSR { - template + template typename TDS::Vertex_handle -construct_surface(TDS& tds, const CGAL::Advancing_front_surface_reconstruction& surface) +construct_surface(TDS& tds, const CGAL::Advancing_front_surface_reconstruction& surface) { typedef typename TDS::Vertex_handle Vertex_handle; diff --git a/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/orient.h b/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/orient.h index f7ab995e178..ae68077bc47 100644 --- a/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/orient.h +++ b/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/orient.h @@ -23,9 +23,9 @@ namespace CGAL { namespace AFSR { - template + template typename TDS::Vertex_handle - orient(TDS& tds, const Advancing_front_surface_reconstruction& surface) + orient(TDS& tds, const Advancing_front_surface_reconstruction& surface) { typedef typename TDS::Vertex_handle Vertex_handle; diff --git a/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/write_triple_indices.h b/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/write_triple_indices.h index 9a1899ad9ad..d91059a30b8 100644 --- a/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/write_triple_indices.h +++ b/Advancing_front_surface_reconstruction/include/CGAL/internal/AFSR/write_triple_indices.h @@ -24,16 +24,16 @@ namespace CGAL { -template +template class Advancing_front_surface_reconstruction; -template +template OutputIterator - write_triple_indices(OutputIterator out, const Advancing_front_surface_reconstruction& S) + write_triple_indices(OutputIterator out, const Advancing_front_surface_reconstruction& S) { - typedef Advancing_front_surface_reconstruction Surface; + typedef Advancing_front_surface_reconstruction Surface; typedef typename Surface::TDS_2 TDS_2; typedef typename TDS_2::Face_iterator Face_iterator;