diff --git a/Ridges_3/examples/Ridges_3/CMakeLists.txt b/Ridges_3/examples/Ridges_3/CMakeLists.txt index aa298aefc9f..fe049fc0cdd 100644 --- a/Ridges_3/examples/Ridges_3/CMakeLists.txt +++ b/Ridges_3/examples/Ridges_3/CMakeLists.txt @@ -41,6 +41,7 @@ if ( CGAL_FOUND ) endif() create_single_source_cgal_program( Compute_Ridges_Umbilics.cpp) + create_single_source_cgal_program( Ridges_Umbilics_SM.cpp) else(EIGEN3_FOUND OR LAPACK_FOUND) diff --git a/Ridges_3/examples/Ridges_3/compute_normals.h b/Ridges_3/examples/Ridges_3/compute_normals.h index 02a209a1e76..10ede7cfc77 100644 --- a/Ridges_3/examples/Ridges_3/compute_normals.h +++ b/Ridges_3/examples/Ridges_3/compute_normals.h @@ -44,13 +44,17 @@ void compute_facets_normals(const TriangleMesh& tm, FaceVectorMap fvm, const Kernel& k) { + typedef boost::property_traits::value_type Vector_3; + + typedef boost::property_map::type VPM; + VPM vpm = get(CGAL::vertex_point,tm); BOOST_FOREACH(typename boost::graph_traits::face_descriptor f, faces(tm)){ typename boost::graph_traits::halfedge_descriptor h = halfedge(f,tm); - typename Kernel::Vector_3 normal = - CGAL::cross_product(target(h,tm)->point() - - target(opposite(h,tm),tm)->point(), - target(next(h,tm),tm)->point() - - target(opposite(h,tm),tm)->point()); + Vector_3 normal = + CGAL::cross_product(get(vpm, target(h,tm)) - + get(vpm, target(opposite(h,tm),tm)), + get(vpm, target(CGAL::next(h,tm),tm)) - // AF: arghh CGAL:: + get(vpm, target(opposite(h,tm),tm))); put(fvm, f, normal / CGAL::sqrt(normal * normal)); } } diff --git a/Ridges_3/include/CGAL/PolyhedralSurf_neighbors.h b/Ridges_3/include/CGAL/PolyhedralSurf_neighbors.h index 5b54880d55f..b7aa09e54a2 100644 --- a/Ridges_3/include/CGAL/PolyhedralSurf_neighbors.h +++ b/Ridges_3/include/CGAL/PolyhedralSurf_neighbors.h @@ -32,11 +32,15 @@ namespace CGAL { //triangle incident to the halfedge. //--------------------------------------------------------------------------- template < class TriangularPolyhedralSurface > class T_Gate -{ +{ + typedef typename boost::property_map::type VPM; + typedef typename boost::property_traits::value_type Point_3; + typedef typename Kernel_traits::Kernel Kernel; + public: - typedef typename TriangularPolyhedralSurface::Traits::FT FT; - typedef typename TriangularPolyhedralSurface::Traits::Vector_3 Vector_3; - typedef typename TriangularPolyhedralSurface::Traits::Point_3 Point_3; + typedef typename Kernel::FT FT; + typedef typename Kernel::Vector_3 Vector_3; + typedef typename boost::graph_traits::vertex_descriptor Vertex_const_handle; typedef typename boost::graph_traits::halfedge_descriptor Halfedge_const_handle; @@ -79,11 +83,15 @@ struct compare_gates template < class TriangularPolyhedralSurface > class T_PolyhedralSurf_neighbors { - const TriangularPolyhedralSurface& P; + + typedef typename boost::property_map::type VPM; + typedef typename boost::property_traits::value_type Point_3; + typedef typename Kernel_traits::Kernel Kernel; + public: - typedef typename TriangularPolyhedralSurface::Traits::FT FT; - typedef typename TriangularPolyhedralSurface::Traits::Vector_3 Vector_3; - typedef typename TriangularPolyhedralSurface::Traits::Point_3 Point_3; + typedef typename Kernel::FT FT; + typedef typename Kernel::Vector_3 Vector_3; + typedef typename boost::graph_traits::vertex_descriptor Vertex_const_handle; typedef typename boost::graph_traits::halfedge_descriptor Halfedge_const_handle; typedef CGAL::Halfedge_around_target_circulator @@ -116,10 +124,10 @@ public: Gate make_gate(const Vertex_const_handle v, const Halfedge_const_handle he) { - Point_3 p0 = v->point(), - p1 = target(he,P)->point(), - p2 = target(next(he,P),P)->point(), - p3 = target(prev(he,P),P)->point(); + Point_3 p0 = get(vpm, v), + p1 = get(vpm, target(he,P)), + p2 = get(vpm, target(next(he,P),P)), + p3 = get(vpm, target(prev(he,P),P)); Vector_3 p0p1 = p0 - p1, p0p2 = p0 - p2, p0p3 = p0 - p3; @@ -131,13 +139,17 @@ public: } protected: + /* //tag to visit vertices struct Vertex_cmp{//comparison is wrt vertex addresses bool operator()(const Vertex_const_handle a, const Vertex_const_handle b) const{ return &*a < &*b; } }; - typedef std::map Vertex2bool_map; + */ + const TriangularPolyhedralSurface& P; + VPM vpm; + typedef std::map Vertex2bool_map; Vertex2bool_map is_visited_map; }; @@ -145,7 +157,7 @@ public: template < class TriangularPolyhedralSurface > T_PolyhedralSurf_neighbors < TriangularPolyhedralSurface >:: T_PolyhedralSurf_neighbors(const TriangularPolyhedralSurface& P) - :P(P) + :P(P), vpm(get(vertex_point,P)) { //init the is_visited_map Vertex_const_iterator itb, ite; @@ -178,12 +190,12 @@ compute_one_ring(const Vertex_const_handle v, ite = vertex_neigh.end(); itb++;//the first vertex v is the center to which distances are //computed from, for other 1ring neighbors - Point_3 p0 = v->point(), p; + Point_3 p0 = get(vpm, v), p; Vector_3 p0p; FT d = OneRingSize; for (; itb != ite; itb++){ - p = (*itb)->point(); + p = get(vpm, *itb); p0p = p0 - p; d = CGAL::sqrt(p0p*p0p); if (d > OneRingSize) OneRingSize = d; @@ -249,7 +261,7 @@ compute_neighbors(const Vertex_const_handle v, if ( iter != contour.begin() ) pos_prev = --iter; else pos_prev = --contour.end(); - if ( he->next() == *pos_next ) + if ( next(he,P) == *pos_next ) { // case 2a //contour he1 = opposite(prev(he,P),P); diff --git a/Ridges_3/include/CGAL/Ridges.h b/Ridges_3/include/CGAL/Ridges.h index 462066ee722..34f7fe6203a 100644 --- a/Ridges_3/include/CGAL/Ridges.h +++ b/Ridges_3/include/CGAL/Ridges.h @@ -57,8 +57,12 @@ enum Ridge_order {Ridge_order_3 = 3, Ridge_order_4 = 4}; //-------------------------------------------------------------------------- template < class TriangulatedSurfaceMesh > class Ridge_line { + typedef typename boost::property_map::type VPM; + typedef typename boost::property_traits::value_type Point_3; + typedef typename Kernel_traits::Kernel Kernel; public: - typedef typename TriangulatedSurfaceMesh::Traits::FT FT; + + typedef typename Kernel::FT FT; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef std::pair< halfedge_descriptor, FT> ridge_halfhedge; @@ -377,8 +381,8 @@ template < class TriangulatedSurfaceMesh, BOOST_FOREACH(vertex_descriptor v, vertices(p)){ points.push_back(get(vpm,v)); } - - CGAL::Min_sphere_d > + + CGAL::Min_sphere_d > min_sphere(points.begin(), points.end()); squared_model_size = min_sphere.squared_radius(); //maybe better to use CGAL::Min_sphere_of_spheres_d ?? but need to create spheres? @@ -461,7 +465,7 @@ template < class TriangulatedSurfaceMesh, //follow the ridge from curhe if (is_visited_map.find(f)->second) break; is_visited_map.find(f)->second = true; - if (curhe->opposite() == curhe1) curhe = curhe2; + if (opposite(curhe,P) == curhe1) curhe = curhe2; else curhe = curhe1;//curhe stays at the ridge extremity addfront(cur_ridge_line, curhe, cur_ridge_type); if ( ! is_border_edge(curhe,P) ) f = face(opposite(curhe,P),P); diff --git a/Ridges_3/include/CGAL/Umbilics.h b/Ridges_3/include/CGAL/Umbilics.h index aa542ba537a..93a4f6b1ad7 100644 --- a/Ridges_3/include/CGAL/Umbilics.h +++ b/Ridges_3/include/CGAL/Umbilics.h @@ -41,7 +41,7 @@ class Umbilic public: typedef typename boost::graph_traits::vertex_descriptor Vertex_const_handle; typedef typename boost::graph_traits::halfedge_descriptor Halfedge_const_handle; - typedef typename TriangulatedSurfaceMesh::Traits::Vector_3 Vector_3; + // typedef typename TriangulatedSurfaceMesh::Traits::Vector_3 Vector_3; //contructor Umbilic(const Vertex_const_handle v_init,