diff --git a/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_simple.C b/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_simple.C index ae32dbef06e..3d8de316560 100644 --- a/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_simple.C +++ b/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_simple.C @@ -20,7 +20,7 @@ typedef CGAL::Polyhedron_3 Polyhedron; int main(int argc, char *argv[]) { if (argc < 2) { std::cout << "Usage: " << argv[0] << " " << std::endl; - return 1; + return 0; } std::list l; diff --git a/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_subdiv.C b/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_subdiv.C index 3e325a7074b..fb7fc94017c 100644 --- a/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_subdiv.C +++ b/Skin_surface_3/examples/Skin_surface_3/NGHK_skin_surface_subdiv.C @@ -20,7 +20,7 @@ typedef CGAL::Polyhedron_3 Polyhedron; int main(int argc, char *argv[]) { if (argc < 2) { std::cout << "Usage: " << argv[0] << " " << std::endl; - return 1; + return 0; } std::list l; diff --git a/Skin_surface_3/examples/Skin_surface_3/makefile b/Skin_surface_3/examples/Skin_surface_3/makefile index 87b9e4779ac..f7dfd54cb4a 100644 --- a/Skin_surface_3/examples/Skin_surface_3/makefile +++ b/Skin_surface_3/examples/Skin_surface_3/makefile @@ -13,7 +13,7 @@ include $(CGAL_MAKEFILE) # compiler flags #---------------------------------------------------------------------# -CXXFLAGS = -O2\ +CXXFLAGS = -g\ -I.\ -Idsrpdb/include\ -I../../include \ @@ -30,7 +30,7 @@ LIBPATH = \ $(TESTSUITE_LIBPATH) \ $(CGAL_LIBPATH) -LDFLAGS = -O2\ +LDFLAGS = -g\ $(TESTSUITE_LDFLAGS) \ $(LONG_NAME_PROBLEM_LDFLAGS) \ $(CGAL_LDFLAGS) diff --git a/Skin_surface_3/examples/Skin_surface_3/skin_surface_pdb_reader.C b/Skin_surface_3/examples/Skin_surface_3/skin_surface_pdb_reader.C index 9694fb0114f..d2a29f6c086 100644 --- a/Skin_surface_3/examples/Skin_surface_3/skin_surface_pdb_reader.C +++ b/Skin_surface_3/examples/Skin_surface_3/skin_surface_pdb_reader.C @@ -22,7 +22,7 @@ typedef CGAL::Polyhedron_3 Polyhedron; int main(int argc, char *argv[]) { if (argc < 2) { std::cout << "Usage: " << argv[0] << " " << std::endl; - return 1; + return 0; } std::list l; diff --git a/Skin_surface_3/examples/Skin_surface_3/skin_surface_subdiv.C b/Skin_surface_3/examples/Skin_surface_3/skin_surface_subdiv.C index 313de63cc1b..cf815d03e39 100644 --- a/Skin_surface_3/examples/Skin_surface_3/skin_surface_subdiv.C +++ b/Skin_surface_3/examples/Skin_surface_3/skin_surface_subdiv.C @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include @@ -16,11 +15,7 @@ typedef CGAL::Skin_surface_3 Skin_surface_3; typedef Skin_surface_3::FT FT; typedef Skin_surface_3::Weighted_point Weighted_point; typedef Skin_surface_3::Bare_point Bare_point; - -// Each facet has a pointer to the tetrahedron of the TMC it is contained in -typedef Skin_surface_3::Triangulated_mixed_complex TMC; -typedef CGAL::Skin_surface_polyhedral_items_3 Poly_items; -typedef CGAL::Polyhedron_3 Polyhedron; +typedef CGAL::Polyhedron_3 Polyhedron; int main(int argc, char *argv[]) { std::list l; @@ -34,7 +29,7 @@ int main(int argc, char *argv[]) { Polyhedron p; CGAL::mesh_skin_surface_3(skin_surface, p); - + CGAL::subdivide_skin_surface_mesh_3(p, skin_surface); std::ofstream out("mesh.off"); diff --git a/Skin_surface_3/examples/Skin_surface_3/skin_surface_subdiv_with_normals.C b/Skin_surface_3/examples/Skin_surface_3/skin_surface_subdiv_with_normals.C index cb69fe8d6ab..790c70d2230 100644 --- a/Skin_surface_3/examples/Skin_surface_3/skin_surface_subdiv_with_normals.C +++ b/Skin_surface_3/examples/Skin_surface_3/skin_surface_subdiv_with_normals.C @@ -2,13 +2,12 @@ #include #include #include -#include #include #include #include #include -#include +#include "skin_surface_writer.h" typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Regular_triangulation_euclidean_traits_3 Traits; @@ -16,77 +15,23 @@ typedef CGAL::Skin_surface_3 Skin_surface_3; typedef Skin_surface_3::FT FT; typedef Skin_surface_3::Weighted_point Weighted_point; typedef Skin_surface_3::Bare_point Bare_point; - -// Each facet has a pointer to the tetrahedron of the TMC it is contained in -typedef Skin_surface_3::Triangulated_mixed_complex TMC; -typedef CGAL::Skin_surface_polyhedral_items_3 Poly_items; -typedef CGAL::Polyhedron_3 Polyhedron; - - -template -/// Write polyhedron with normals: -void write_polyhedron_with_normals(Polyhedron &p, - SkinSurface &skin, - std::ostream &out) -{ - typedef typename Polyhedron::Vertex_iterator Vertex_iterator; - typedef typename Polyhedron::Facet_iterator Facet_iterator; - typedef typename Polyhedron::Halfedge_around_facet_circulator HFC; - typedef typename Polyhedron::Vertex_handle Vertex_handle; - - // Write header - out << "NOFF " << p.size_of_vertices () - << " " << p.size_of_facets() - << " " << p.size_of_halfedges() - << std::endl; - - // Write vertices - typedef CGAL::Skin_surface_subdivision_policy_base_3 - Subdivision_policy; - Subdivision_policy *policy = get_subdivision_policy(p, skin); - for (Vertex_iterator vit = p.vertices_begin(); - vit != p.vertices_end(); vit ++) { - out << vit->point() << " " - << policy->normal(vit) - << std::endl; - } - - // Write faces - CGAL::Inverse_index index(p.vertices_begin(), - p.vertices_end()); - for(Facet_iterator fi = p.facets_begin(); - fi != p.facets_end(); ++fi) { - HFC hc = fi->facet_begin(); - HFC hc_end = hc; - std::size_t n = circulator_size( hc); - out << n; - do { - Vertex_handle vh = (*hc).vertex(); - out << " " << index[vh]; - } while (++hc != hc_end); - out << "\n"; - } -} +typedef CGAL::Polyhedron_3 Polyhedron; int main(int argc, char *argv[]) { std::list l; FT shrinkfactor = 0.5; - if (argc < 2) { - std::cout << "Usage: " << argv[0] << " " << std::endl; - exit(0); - } - std::ifstream in(argv[1]); - Weighted_point wp; - while (in >> wp) l.push_front(wp); + l.push_front(Weighted_point(Bare_point(0,0,0), 1)); + l.push_front(Weighted_point(Bare_point(0,1,0), 2)); + l.push_front(Weighted_point(Bare_point(0,0,2), 1)); Skin_surface_3 skin_surface(l.begin(), l.end(), shrinkfactor); Polyhedron p; CGAL::mesh_skin_surface_3(skin_surface, p); - - CGAL::subdivide_skin_surface_mesh_3(p, skin_surface); + CGAL::subdivide_skin_surface_mesh_3(p, skin_surface); + std::ofstream out("mesh.off"); write_polyhedron_with_normals(p, skin_surface, out); diff --git a/Skin_surface_3/examples/Skin_surface_3/union_of_balls_simple.C b/Skin_surface_3/examples/Skin_surface_3/union_of_balls_simple.C index 8774c333b0b..dae6c22b74f 100644 --- a/Skin_surface_3/examples/Skin_surface_3/union_of_balls_simple.C +++ b/Skin_surface_3/examples/Skin_surface_3/union_of_balls_simple.C @@ -1,30 +1,29 @@ -// NGHK: NOT IN USE FOR NOW - // examples/Skin_surface_3/union_of_balls_simple.C -#include -#include +#include +#include #include - +// #include #include -typedef CGAL::Skin_surface_traits_3<> Skin_surface_traits; -typedef Skin_surface_traits::Regular_traits Regular_traits; -typedef Regular_traits::Bare_point Reg_point; -typedef Regular_traits::Weighted_point Reg_weighted_point; -typedef CGAL::Polyhedron_3 Polyhedron; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Regular_triangulation_euclidean_traits_3 Traits; +typedef CGAL::Union_of_balls_3 Union_of_balls_3; +typedef Union_of_balls_3::FT FT; +typedef Union_of_balls_3::Weighted_point Weighted_point; +typedef Union_of_balls_3::Bare_point Bare_point; +typedef CGAL::Polyhedron_3 Polyhedron; int main(int argc, char *argv[]) { - return 0; + std::list l; - std::list l; - - l.push_front(Reg_weighted_point(Reg_point(0,0,0), 1)); - l.push_front(Reg_weighted_point(Reg_point(0,1,0), 2)); - l.push_front(Reg_weighted_point(Reg_point(0,0,2), 1)); + l.push_front(Weighted_point(Bare_point(0,0,0), 1)); + l.push_front(Weighted_point(Bare_point(0,1,0), 2)); + l.push_front(Weighted_point(Bare_point(0,0,2), 1)); - Polyhedron p; - Skin_surface_traits skin_surface_traits(1); - CGAL::skin_surface_3(l.begin(), l.end(), p, skin_surface_traits); + Union_of_balls_3 union_of_balls(l.begin(), l.end()); + +// Polyhedron p; +// CGAL::mesh_union_of_balls_3(union_of_balls, p); return 0; } diff --git a/Skin_surface_3/include/CGAL/Skin_surface_3.h b/Skin_surface_3/include/CGAL/Skin_surface_3.h index 3657f3fbd21..10244fc2c01 100644 --- a/Skin_surface_3/include/CGAL/Skin_surface_3.h +++ b/Skin_surface_3/include/CGAL/Skin_surface_3.h @@ -17,8 +17,8 @@ // // Author(s) : Nico Kruithof -#ifndef CGAL_CGAL_SKIN_SURFACE_3_H -#define CGAL_CGAL_SKIN_SURFACE_3_H +#ifndef CGAL_SKIN_SURFACE_3_H +#define CGAL_SKIN_SURFACE_3_H #include #include @@ -289,4 +289,4 @@ construct_bounding_box(Regular ®ular) CGAL_END_NAMESPACE -#endif // CGAL_CGAL_SKIN_SURFACE_TRAITS_3_H +#endif // CGAL_SKIN_SURFACE_3_H diff --git a/Skin_surface_3/include/CGAL/Skin_surface_refinement_traits_3.h b/Skin_surface_3/include/CGAL/Skin_surface_refinement_traits_3.h index 1d063fdf97d..2e259a89791 100644 --- a/Skin_surface_3/include/CGAL/Skin_surface_refinement_traits_3.h +++ b/Skin_surface_3/include/CGAL/Skin_surface_refinement_traits_3.h @@ -176,8 +176,8 @@ private: protected: Skin_surface const &skin; SS_vertex_map triang_vertex_signs; - T2P_converter const t2p_converter; - P2T_converter const p2t_converter; + T2P_converter t2p_converter; + P2T_converter p2t_converter; }; template @@ -225,13 +225,13 @@ public: P_point to_surface(P_vertex_handle vh) { - SS_cell_handle ch = Base::skin.locate(Base::p2t_converter(vh->point())); + SS_cell_handle ch = Base::skin.locate(p2t_converter(vh->point())); return to_surface_along_transversal_segment(vh->point(),ch); } P_vector normal(P_vertex_handle vh) { - SS_cell_handle ch = Base::skin.locate(Base::p2t_converter(vh->point())); + SS_cell_handle ch = Base::skin.locate(p2t_converter(vh->point())); return ch->surf->gradient(vh->point()); } }; diff --git a/Skin_surface_3/include/CGAL/Triangulated_mixed_complex_observer_3.h b/Skin_surface_3/include/CGAL/Triangulated_mixed_complex_observer_3.h index c14799b36c9..7c648be0cb5 100644 --- a/Skin_surface_3/include/CGAL/Triangulated_mixed_complex_observer_3.h +++ b/Skin_surface_3/include/CGAL/Triangulated_mixed_complex_observer_3.h @@ -188,9 +188,9 @@ public: const Surface_RT &s, const int orient) { Q[1] = Q[3] = Q[4] = 0; - Q[0] = Q[2] = Q[5] = orient*(1-s); + Q[0] = Q[2] = Q[5] = orient/s; - surf = new Quadratic_surface(Q, c, s*(1-s)*w); + surf = new Quadratic_surface(Q, c, w); } void create_hyperboloid(const Surface_point &c, @@ -198,18 +198,18 @@ public: const Surface_vector &t, const Surface_RT &s, const int orient) { - Surface_RT den = t*t; + Surface_RT den = t*t*s*(1-s); - Q[0] = orient*(- t.x()*t.x()/den + (1-s)); + Q[0] = orient*(- t.x()*t.x()/den + 1/s); Q[1] = orient*(-2*t.y()*t.x()/den); - Q[2] = orient*(- t.y()*t.y()/den + (1-s)); + Q[2] = orient*(- t.y()*t.y()/den + 1/s); Q[3] = orient*(-2*t.z()*t.x()/den); Q[4] = orient*(-2*t.z()*t.y()/den); - Q[5] = orient*(- t.z()*t.z()/den + (1-s)); + Q[5] = orient*(- t.z()*t.z()/den + 1/s); - surf = new Quadratic_surface(Q, c, s*(1-s)*w); + surf = new Quadratic_surface(Q, c, w); } Surface_RT Q[6];