From 9e27a54b74bac9c0a44a824c193717f7edc9d19e Mon Sep 17 00:00:00 2001 From: Miguel Granados Date: Fri, 17 May 2002 17:20:18 +0000 Subject: [PATCH] Iteratation macros names changed in order to avoid conflicts with the Nef_S2 package macros. --- Packages/Nef_3/TODO | 1 + .../include/CGAL/Nef_3/SNC_FM_decorator.h | 6 +- .../Nef_3/include/CGAL/Nef_3/SNC_SM_checker.h | 4 +- .../CGAL/Nef_3/SNC_SM_const_decorator.h | 24 ++-- .../include/CGAL/Nef_3/SNC_SM_decorator.h | 6 +- .../include/CGAL/Nef_3/SNC_SM_io_parser.h | 14 +- .../include/CGAL/Nef_3/SNC_SM_overlayer.h | 30 ++-- .../include/CGAL/Nef_3/SNC_SM_point_locator.h | 12 +- .../include/CGAL/Nef_3/SNC_SM_triangulator.h | 18 +-- .../include/CGAL/Nef_3/SNC_SM_visualizor.h | 15 +- .../include/CGAL/Nef_3/SNC_constructor.h | 129 +++++++++++------- .../Nef_3/include/CGAL/Nef_3/SNC_decorator.h | 4 +- .../Nef_3/include/CGAL/Nef_3/SNC_io_parser.h | 32 ++--- .../Nef_3/include/CGAL/Nef_3/SNC_iteration.h | 54 +++++--- .../include/CGAL/Nef_3/SNC_point_locator.h | 12 +- .../Nef_3/include/CGAL/Nef_3/SNC_structure.h | 71 +++++----- .../include/CGAL/Nef_3/SNC_visualizor_OGL.h | 30 ++-- .../Nef_3/include/CGAL/Nef_3/bounded_side_3.h | 6 +- .../CGAL/Nef_3/polyhedron_3_to_nef_3.h | 15 +- .../Nef_3/include/CGAL/Nef_polyhedron_3.h | 14 +- 20 files changed, 268 insertions(+), 229 deletions(-) diff --git a/Packages/Nef_3/TODO b/Packages/Nef_3/TODO index e903ab44637..51920900386 100644 --- a/Packages/Nef_3/TODO +++ b/Packages/Nef_3/TODO @@ -1,6 +1,7 @@ Nef_3 Package: TODO --------------------------------------------------------------------- +- Fix sorting of the edges per Pluecker lines. - Simplification of the SNC structure - Unary operations - Intersections of Line_3 with Line_3 diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_FM_decorator.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_FM_decorator.h index 00c782ee86d..09410ef9bf5 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_FM_decorator.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_FM_decorator.h @@ -357,7 +357,7 @@ create_facet_objects(const Plane_3& plane_supporting_facet, |MinimalEdge[c]|. */ int i=0; - CGAL_forall_iterators(eit,SHalfedges) { e = *eit; + CGAL_nef3_forall_iterators(eit,SHalfedges) { e = *eit; if ( FacetCycle[e] >= 0 ) continue; // already assigned SHalfedge_around_facet_circulator hfc(e),hend(hfc); SHalfedge_handle e_min = e; @@ -407,13 +407,13 @@ create_facet_objects(const Plane_3& plane_supporting_facet, facet objects, and all facet objects know their bounding facet cycles. */ - CGAL_forall_iterators(eit,SHalfedges) { e=*eit; + CGAL_nef3_forall_iterators(eit,SHalfedges) { e=*eit; if ( facet(e) != Halffacet_handle() ) continue; TRACEN(" linking hole "<::access(info(vertex(l)))]; TRACEN("vertex "<<&*vertex(l)); diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_checker.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_checker.h index c5fde63940e..eb31e9961c0 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_checker.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_checker.h @@ -128,7 +128,7 @@ void SNC_SM_checker:: check_order_preserving_embedding() const { SVertex_const_iterator v; - CGAL_forall_svertices_of(v,center_vertex()) + CGAL_nef3_forall_svertices_of(v,center_vertex()) check_order_preserving_embedding(v); } @@ -144,7 +144,7 @@ check_is_triangulation() const CGAL::set_pretty_mode ( error_status ); error_status << "check_is_triangulation\n"; SHalfedge_const_iterator e; - CGAL_forall_shalfedges_of(e,center_vertex()) { + CGAL_nef3_forall_shalfedges_of(e,center_vertex()) { SHalfedge_around_sface_const_circulator hit(e), hend(hit); int edges_in_face_cycle=0; CGAL_For_all(hit,hend) { diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_const_decorator.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_const_decorator.h index d23dace7cf6..b696434be85 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_const_decorator.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_const_decorator.h @@ -249,14 +249,14 @@ Size_type number_of_svertices() const /*{\Mop returns the number of vertices.}*/ { Size_type n(0); SVertex_const_iterator vit; - CGAL_forall_svertices_of(vit,psm_) ++n; + CGAL_nef3_forall_svertices_of(vit,psm_) ++n; return n; } Size_type number_of_shalfedges() const /*{\Mop returns the number of halfedges.}*/ { Size_type n(0); SHalfedge_const_iterator eit; - CGAL_forall_shalfedges_of(eit,psm_) ++n; + CGAL_nef3_forall_shalfedges_of(eit,psm_) ++n; return n; } Size_type number_of_sedges() const @@ -275,7 +275,7 @@ Size_type number_of_sfaces() const /*{\Mop returns the number of faces.}*/ { Size_type n(0); SFace_const_iterator fit; - CGAL_forall_sfaces_of(fit,psm_) ++n; + CGAL_nef3_forall_sfaces_of(fit,psm_) ++n; return n; } Size_type number_of_sface_cycles() const; @@ -353,9 +353,9 @@ The iterator range access operations are of the following kind:\\ |SHalfloop_iterator shalfloops_begin()/shalfloops_end()|\\ |SFace_iterator sfaces_begin()/sfaces_end()| -The macros are then |CGAL_forall_svertices(v,M)|, -|CGAL_forall_shalfedges(e,M)|, |CGAL_forall_sedges(e,M)|, -|CGAL_forall_sfaces(f,M)|, |CGAL_forall_sface_cycles_of(fc,F)| where |M| +The macros are then |CGAL_nef3_forall_svertices(v,M)|, +|CGAL_nef3_forall_shalfedges(e,M)|, |CGAL_nef3_forall_sedges(e,M)|, +|CGAL_nef3_forall_sfaces(f,M)|, |CGAL_nef3_forall_sface_cycles_of(fc,F)| where |M| is a sphere map and |F| is a face.}*/ }; // SNC_SM_const_decorator @@ -378,7 +378,7 @@ check_integrity_and_topological_planarity(bool faces) const SVertex_const_handle v; int iso_vert_num=0; /* check the source links of out edges and count isolated vertices */ - CGAL_forall_svertices(v,*this) { + CGAL_nef3_forall_svertices(v,*this) { if ( is_isolated(v) ) { if ( faces ) CGAL_nef3_assertion_msg(face(v) != SFace_const_handle(), @@ -395,7 +395,7 @@ check_integrity_and_topological_planarity(bool faces) const /* check the bidirected links and the face pointer init */ SHalfedge_const_iterator e; - CGAL_forall_shalfedges(e,*this) { + CGAL_nef3_forall_shalfedges(e,*this) { CGAL_nef3_assertion( twin(twin(e)) == e ); CGAL_nef3_assertion( source(e) != SVertex_const_handle() ); CGAL_nef3_assertion( next(e) != SHalfedge_const_handle() ); @@ -413,8 +413,8 @@ check_integrity_and_topological_planarity(bool faces) const int fc_num(0),iv_num(0); SFace_const_iterator f; SFace_cycle_const_iterator fci; - CGAL_forall_sfaces(f,*this) { - CGAL_forall_sface_cycles_of(fci,f) { + CGAL_nef3_forall_sfaces(f,*this) { + CGAL_nef3_forall_sface_cycles_of(fci,f) { if ( fci.is_shalfedge() ) { CGAL_nef3_assertion( face(SHalfedge_const_handle(fci)) == f ); ++fc_num; @@ -449,7 +449,7 @@ number_of_sface_cycles() const CGAL::Unique_hash_map visited; // init with bool() == false SHalfedge_const_iterator e; - CGAL_forall_shalfedges(e,*this) { + CGAL_nef3_forall_shalfedges(e,*this) { if ( visited[e] ) continue; SHalfedge_around_sface_const_circulator hfc(e), hend(hfc); CGAL_For_all(hfc,hend) visited[hfc]=true; @@ -467,7 +467,7 @@ number_of_connected_components() const int comp_num=0; CGAL::Unique_hash_map visited(false); SVertex_const_iterator v; - CGAL_forall_svertices(v,*this) { + CGAL_nef3_forall_svertices(v,*this) { if (visited[v]) continue; std::list L; L.push_back(v); visited[v]=true; diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_decorator.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_decorator.h index b35e7294c0d..f4d866cea86 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_decorator.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_decorator.h @@ -860,9 +860,9 @@ The iterator range access operations are of the following kind:\\ |SHalfedge_iterator sedges_begin()/sedges_end()|\\ |SFace_iterator sfaces_begin()/sfaces_end()| -The macros are then |CGAL_forall_svertices_of(v,V)|, -|CGAL_forall_shalfedges_of(e,V)|, |CGAL_forall_sedges_of(e,V)|, -|CGAL_forall_sfaces_of(f,V)|, |CGAL_forall_sface_cycles_of(fc,F)|.}*/ +The macros are then |CGAL_nef3_forall_svertices_of(v,V)|, +|CGAL_nef3_forall_shalfedges_of(e,V)|, |CGAL_nef3_forall_sedges_of(e,V)|, +|CGAL_nef3_forall_sfaces_of(f,V)|, |CGAL_nef3_forall_sface_cycles_of(fc,F)|.}*/ }; // SNC_SM_decorator diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_io_parser.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_io_parser.h index f5350f64ee0..1c7b858db4b 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_io_parser.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_io_parser.h @@ -275,13 +275,13 @@ void SNC_SM_io_parser::print_face(SFace_handle f) const { // syntax: index { fclist, ivlist, loop, mark } out << index(f) << " { "; SFace_cycle_iterator it; - CGAL_forall_sface_cycles_of(it,f) + CGAL_nef3_forall_sface_cycles_of(it,f) if ( it.is_shalfedge() ) out << index(SHalfedge_handle(it)) << ' '; out << ", "; - CGAL_forall_sface_cycles_of(it,f) + CGAL_nef3_forall_sface_cycles_of(it,f) if ( it.is_svertex() ) out << index(SVertex_handle(it)) << ' '; out << ", "; - CGAL_forall_sface_cycles_of(it,f) + CGAL_nef3_forall_sface_cycles_of(it,f) if ( it.is_shalfloop() ) out << index(SHalfloop_handle(it)); out << ", " << mark(f) << " }\n"; } @@ -322,12 +322,12 @@ void SNC_SM_io_parser::print() const if (verbose) out << "/* index { isolated ? face : edge, mark, point } */" << endl; SVertex_iterator vit; - CGAL_forall_svertices(vit,*this) print_vertex(vit); + CGAL_nef3_forall_svertices(vit,*this) print_vertex(vit); if (verbose) out << "/* index { twin, prev, next, source, face, mark, circle } */" << endl; SHalfedge_iterator eit; - CGAL_forall_shalfedges(eit,*this) print_edge(eit); + CGAL_nef3_forall_shalfedges(eit,*this) print_edge(eit); if (verbose) out << "/* index { twin, face, mark, circle } */" << endl; if ( has_loop() ) @@ -335,7 +335,7 @@ void SNC_SM_io_parser::print() const if (verbose) out << "/* index { fclist, ivlist, loop, mark } */" << endl; SFace_iterator fit; - CGAL_forall_sfaces(fit,*this) print_face(fit); + CGAL_nef3_forall_sfaces(fit,*this) print_face(fit); out.flush(); if (verbose) debug(); } @@ -420,7 +420,7 @@ void SNC_SM_io_parser::debug() const out << "shalfedges: " << number_of_shalfedges() << "\n"; out << "shalfloops: " << number_of_shalfloops() << "\n"; SVertex_iterator vit; - CGAL_forall_svertices(vit,*this) { + CGAL_nef3_forall_svertices(vit,*this) { if ( is_isolated(vit) ) continue; typename Base::SHalfedge_around_svertex_circulator hcirc = out_edges(vit), hend = hcirc; diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_overlayer.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_overlayer.h index 3f51954d7c4..c2187b00e41 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_overlayer.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_overlayer.h @@ -117,7 +117,7 @@ struct SMO_from_segs { void clear_temporary_vertex_info() const { Vertex_handle v; - CGAL_forall_svertices(v,G) + CGAL_nef3_forall_svertices(v,G) geninfo::clear(G.info(v)); } @@ -591,7 +591,7 @@ create_from_segments(Forward_iterator start, Forward_iterator end) const Seg_list L(start,end); Unique_hash_map From_input(false); Seg_iterator it; - CGAL_forall_iterators(it,L) From_input[it]=true; + CGAL_nef3_forall_iterators(it,L) From_input[it]=true; Seg_list L_pos,L_neg; partition_to_halfsphere(L.begin(), L.end(), L_pos, From_input, +1); partition_to_halfsphere(L.begin(), L.end(), L_neg, From_input, -1); @@ -637,7 +637,7 @@ create_from_segments(Forward_iterator start, Forward_iterator end) const K.get_negative_halfsphere_geometry()); SHalfedge_iterator u; - CGAL_forall_sedges(u,*this) { + CGAL_nef3_forall_sedges(u,*this) { Sphere_segment s(point(source(u)),point(target(u))); circle(u) = s.sphere_circle(); circle(twin(u)) = s.sphere_circle().opposite(); @@ -663,7 +663,7 @@ create_from_circles(Forward_iterator start, Forward_iterator end) const L.push_back(spair.first); L.push_back(spair.second); } Seg_iterator it; - CGAL_forall_iterators(it,L) From_input[it]=true; + CGAL_nef3_forall_iterators(it,L) From_input[it]=true; Seg_list L_pos,L_neg; partition_to_halfsphere(L.begin(), L.end(), L_pos, From_input, +1); partition_to_halfsphere(L.begin(), L.end(), L_neg, From_input, -1); @@ -708,7 +708,7 @@ create_from_circles(Forward_iterator start, Forward_iterator end) const K.get_negative_halfsphere_geometry()); SHalfedge_iterator u; - CGAL_forall_sedges(u,*this) { + CGAL_nef3_forall_sedges(u,*this) { Sphere_segment s(point(source(u)),point(target(u))); circle(u) = s.sphere_circle(); circle(twin(u)) = s.sphere_circle().opposite(); @@ -741,13 +741,13 @@ subdivide(Vertex_handle v0, Vertex_handle v1) Seg_map From; for (int i=0; i<2; ++i) { SVertex_iterator v; - CGAL_forall_svertices(v,PI[i]) { + CGAL_nef3_forall_svertices(v,PI[i]) { if ( !PI[i].is_isolated(v) ) continue; L.push_back(trivial_segment(PI[i],v)); From[--L.end()] = Seg_info(v,i); } SHalfedge_iterator e; - CGAL_forall_sedges(e,PI[i]) { + CGAL_nef3_forall_sedges(e,PI[i]) { if ( source(e) == target(e) ) { Seg_pair p = two_segments(PI[i],e); L.push_back(p.first); @@ -810,7 +810,7 @@ subdivide(Vertex_handle v0, Vertex_handle v1) NH_geometry()); SHalfedge_iterator u; - CGAL_forall_sedges(u,*this) { + CGAL_nef3_forall_sedges(u,*this) { Sphere_segment s(point(source(u)),point(target(u))); circle(u) = s.sphere_circle(); circle(twin(u)) = s.sphere_circle().opposite(); @@ -851,7 +851,7 @@ partition_to_halfsphere(Iterator start, Iterator beyond, Seg_list& L, Sphere_circle yzcircle(1,0,0); typename Seg_list::iterator it, itl; - CGAL_forall_iterators(it,L) { TRACEN(" "<<*it); + CGAL_nef3_forall_iterators(it,L) { TRACEN(" "<<*it); if ( equal_as_sets(it->sphere_circle(),xycircle) ) { TRACEN(" splitting xy seg "<<*it); int n1 = it->intersection(yzcircle,s1,s2); @@ -868,7 +868,7 @@ partition_to_halfsphere(Iterator start, Iterator beyond, Seg_list& L, // at least one item was appended } } - CGAL_forall_iterators(it,L) { + CGAL_nef3_forall_iterators(it,L) { if ( it->is_halfcircle() ) { TRACEN(" splitting halfcircle "<<*it); Sphere_segment s1,s2; @@ -1076,7 +1076,7 @@ merge_halfsphere_maps(SVertex_handle v1, SVertex_handle v2, } while ( source(ep) != v1 ); typename std::list::iterator it; - CGAL_forall_iterators(it,L_equator) { + CGAL_nef3_forall_iterators(it,L_equator) { SHalfedge_handle e1 = it->first, e2 = it->second; SHalfedge_handle e1t = twin(e1), e2t = twin(e2); TRACEV(PH(e1));TRACEV(PH(e2)); @@ -1101,17 +1101,17 @@ void SNC_SM_overlayer:: select(const Selection& SP) const { SVertex_iterator v; - CGAL_forall_svertices(v,*this) { + CGAL_nef3_forall_svertices(v,*this) { mark(v) = SP(mark(v,0),mark(v,1)); discard_info(v); } SHalfedge_iterator e; - CGAL_forall_sedges(e,*this) { + CGAL_nef3_forall_sedges(e,*this) { mark(e) = SP(mark(e,0),mark(e,1)); discard_info(e); } SFace_iterator f; - CGAL_forall_sfaces(f,*this) { + CGAL_nef3_forall_sfaces(f,*this) { mark(f) = SP(mark(f,0),mark(f,1)); discard_info(f); } @@ -1133,7 +1133,7 @@ void SNC_SM_overlayer::simplify() const CGAL::Union_find< SFace_handle> UF; SFace_iterator f; - CGAL_forall_sfaces(f,*this) { + CGAL_nef3_forall_sfaces(f,*this) { Pitem[f] = UF.make_set(f); clear_face_cycle_entries(f); } diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_point_locator.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_point_locator.h index 79bd920d75d..a541ceff2b6 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_point_locator.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_point_locator.h @@ -184,12 +184,12 @@ public: such that |s| intersects the $1$-skeleton of |P|.}*/ { TRACEN("locate naivly "< visited(false); - CGAL_forall_svertices(v,*this) { + CGAL_nef3_forall_svertices(v,*this) { Sphere_point p_res, vp = point(v); if ( s.has_on(vp) ) { TRACEN(" location via vertex at "< visited(false); SHalfedge_const_iterator e_res; - CGAL_forall_shalfedges(e,*this) { + CGAL_nef3_forall_shalfedges(e,*this) { Sphere_segment se = segment(e); Sphere_point p_res; if ( do_intersect_internally(se,s,p_res) ) { diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_triangulator.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_triangulator.h index 3aec3067932..6e85bfbafc2 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_triangulator.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_triangulator.h @@ -351,8 +351,8 @@ public: { Vertex_iterator v; Halfedge_iterator e; - CGAL_forall_vertices(v,*this) discard_info(v); - CGAL_forall_halfedges(e,*this) discard_info(e); + CGAL_nef3_forall_vertices(v,*this) discard_info(v); + CGAL_nef3_forall_halfedges(e,*this) discard_info(e); } @@ -366,13 +366,13 @@ void SNC_SM_triangulator::triangulate() Seg_list L; Seg_map From; SNC_SVertex_const_iterator v; - CGAL_forall_svertices(v,E_) { + CGAL_nef3_forall_svertices(v,E_) { if ( !E_.is_isolated(v) ) continue; L.push_back(trivial_segment(E_,v)); From[--L.end()] = Object_handle(v); } SNC_SHalfedge_const_iterator e; - CGAL_forall_sedges(e,E_) { + CGAL_nef3_forall_sedges(e,E_) { if ( E_.source(e) == E_.target(e) ) { Seg_pair p = two_segments(E_,e); L.push_back(p.first); L.push_back(p.second); @@ -427,7 +427,7 @@ void SNC_SM_triangulator::triangulate() // enrich the edges by circle information Halfedge_iterator u; - CGAL_forall_edges(u,*this) { + CGAL_forall_edges(u,*this) { // for all sphere edges Sphere_segment s(point(source(u)),point(target(u))); circle(u) = s.sphere_circle(); circle(twin(u)) = s.sphere_circle().opposite(); @@ -466,7 +466,7 @@ void SNC_SM_triangulator::triangulate() correct_triangle_at(--vertices_end());*/ // enrigh triangulation edges by circle information - CGAL_forall_edges(u,*this) { + CGAL_forall_edges(u,*this) { // for all sphere edges Sphere_segment s(point(source(u)),point(target(u))); circle(u) = s.sphere_circle(); circle(twin(u)) = s.sphere_circle().opposite(); @@ -503,7 +503,7 @@ partition_to_halfsphere(Iterator start, Iterator beyond, Seg_list& L, typename Seg_list::iterator it, itl; bool part_in_hemisphere(false); - CGAL_forall_iterators(it,L) { TRACEN(" "<<*it); + CGAL_nef3_forall_iterators(it,L) { TRACEN(" "<<*it); if ( equal_as_sets(it->sphere_circle(),xycircle) ) { TRACEN(" splitting xy seg "<<*it); int n1 = it->intersection(yzcircle,s1,s2); @@ -522,7 +522,7 @@ partition_to_halfsphere(Iterator start, Iterator beyond, Seg_list& L, part_in_hemisphere = true; } } - CGAL_forall_iterators(it,L) { + CGAL_nef3_forall_iterators(it,L) { if ( it->is_halfcircle() ) { TRACEN(" splitting halfcircle "<<*it); Sphere_segment s1,s2; @@ -580,7 +580,7 @@ merge_halfsphere_maps(Vertex_handle v1, Vertex_handle v2) const } while ( source(ep) != v1 ); typename std::list::iterator it; - CGAL_forall_iterators(it,L_equator) { + CGAL_nef3_forall_iterators(it,L_equator) { Halfedge_handle e1 = it->first, e2 = it->second; Halfedge_handle e1t = twin(e1), e2t = twin(e2); TRACEV(PH(e1));TRACEV(PH(e2)); diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_visualizor.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_visualizor.h index 843dc426e54..e8984c05ac0 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_visualizor.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_SM_visualizor.h @@ -36,7 +36,6 @@ #include #include #include -#include #define LGREY CGAL::Color(170,170,200) #define DGREY CGAL::Color(30,30,50) @@ -144,7 +143,7 @@ void draw_map() const { // draw sphere segments underlying edges of E_: SHalfedge_const_iterator e; - CGAL_forall_sedges(e,E_) { + CGAL_nef3_forall_sedges(e,E_) { if ( E_.source(e) == E_.target(e) ) { S_.push_back(E_.circle(e), CO_.color(e,E_.mark(e))); } else { @@ -162,13 +161,13 @@ void draw_map() const // draw points underlying vertices of E_: SVertex_const_iterator v; - CGAL_forall_svertices(v,E_) + CGAL_nef3_forall_svertices(v,E_) S_.push_back(E_.point(v),CO_.color(v,E_.mark(v))); SM_Halfedge_const_iterator h; Unique_hash_map Done(false); - CGAL_forall_halfedges(h,T_) { + CGAL_nef3_forall_halfedges(h,T_) { if ( Done[h] ) continue; SM_Halfedge_const_iterator hn(T_.next(h)),hnn(T_.next(hn)); TRACEV(T_.incident_triangle(h)); @@ -181,7 +180,7 @@ void draw_map() const Done[h]=Done[hn]=Done[hnn]=true; } - CGAL_forall_edges(h,T_) + CGAL_forall_edges(h,T_) // for all sphere edges S_.push_back_triangle_edge(Sphere_segment(T_.point(T_.source(h)), T_.point(T_.target(h)), T_.circle(h))); @@ -196,18 +195,18 @@ void draw_triangulation() const SHalfedge_const_iterator ed; SVertex_const_iterator vd; SM_Halfedge_const_iterator e; - CGAL_forall_edges(e,T_) { + CGAL_nef3_forall_edges(e,T_) { S_.push_back(Sphere_segment(T_.point(T_.source(e)),T_.point(T_.target(e)), T_.circle(e)),CO_.color(ed,T_.mark(e))); } // draw points underlying vertices of triangulation: SM_Vertex_const_iterator v; - CGAL_forall_vertices(v,T_) + CGAL_nef3_forall_vertices(v,T_) S_.push_back(T_.point(v),CO_.color(vd,T_.mark(v))); Unique_hash_map Done(false); - CGAL_forall_halfedges(e,T_) { + CGAL_nef3_forall_halfedges(e,T_) { if ( Done[e] ) continue; SM_Halfedge_const_iterator en(T_.next(e)),enn(T_.next(en)); CGAL_nef3_assertion(T_.incident_mark(e)==T_.incident_mark(en)&& diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_constructor.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_constructor.h index 3e3e0a3b259..ca98f594235 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_constructor.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_constructor.h @@ -41,6 +41,9 @@ #include #include #include +#ifdef SM_VISUALIZOR +#include +#endif // SM_VISUALIZOR #include #include #undef _DEBUG @@ -82,7 +85,8 @@ template struct Halfedge_key_lt { typedef Halfedge_key Key; bool operator()(const Key& k1, const Key& k2) const - { if ( k1.p == k2.p ) return (k1.i < k2.i); + { if ( k1.p == k2.p ) return (k1.i > k2.i); + // WARNING: we must sort lexicographically along the line!!! return CGAL::lexicographically_xyz_smaller(k1.p,k2.p); } }; @@ -219,15 +223,16 @@ public: typedef void* GenPtr; - typedef CGAL::Unique_hash_map Shell_number_hash; + typedef CGAL::Unique_hash_map + Shell_number_hash; typedef CGAL::Unique_hash_map SFace_visited_hash; typedef CGAL::Unique_hash_map Shell_closed_hash; struct Shell_explorer { const SNC_decorator& D; Shell_number_hash& Shell; - SFace_visited_hash& Done; Shell_closed_hash& Closed; + SFace_visited_hash& Done; Vertex_handle v_min; int n; @@ -385,8 +390,8 @@ public: sg++; while ( true ) { Vector_3 g(plane(facet(twin(sg))).orthogonal_vector()); - if( is_positive( cross_product(g, ev) * h)) { - if( is_negative( rv * g)) + if( CGAL_NTS is_positive( cross_product(g, ev) * h)) { + if( CGAL_NTS is_negative( rv * g)) return facet(twin(sh)); else { sh = sg; @@ -405,17 +410,17 @@ public: Halffacet_handle f_visible; Plane_3 h = plane(f); CGAL_assertion( h.has_on(ray.target())); - CGAL_assertion( !is_zero(Vector_3(ray.direction()) * - Vector_3(h.orthogonal_vector()))); + CGAL_assertion( !CGAL_NTS is_zero(Vector_3(ray.direction()) * + Vector_3(h.orthogonal_vector()))); /* is imposible to reach the interior or f using a ray coplanar with f */ - if( is_negative(Vector_3(ray.direction()) * - Vector_3(h.orthogonal_vector()))) + if( CGAL_NTS is_negative(Vector_3(ray.direction()) * + Vector_3(h.orthogonal_vector()))) f_visible = f; else f_visible = twin(f); - CGAL_assertion( is_negative( Vector_3(ray.direction()) * - Vector_3(plane(f_visible). - orthogonal_vector()))); + CGAL_assertion( CGAL_NTS is_negative( Vector_3(ray.direction()) * + Vector_3(plane(f_visible). + orthogonal_vector()))); return f_visible; } @@ -448,7 +453,7 @@ public: TRACEN( "Shoting ray " << ray); Object_handle o; Vertex_handle v; - CGAL_forall_vertices( v, *sncp()) { + CGAL_nef3_forall_vertices( v, *sncp()) { if ( ray.source() != point(v) && ray.has_on(point(v)) ) { TRACEN("ray hit vertex case"); shorten( ray, point(v)); @@ -456,7 +461,7 @@ public: } } Halfedge_handle e; - CGAL_forall_edges( e, *sncp()) { + CGAL_nef3_forall_edges( e, *sncp()) { Point_3 q; if ( does_ray_intersect_internally( ray, e, q) ) { TRACEN("ray hit edge case"); @@ -465,7 +470,7 @@ public: } } Halffacet_handle f; - CGAL_forall_halffacets( f, *sncp()) { + CGAL_nef3_forall_halffacets( f, *sncp()) { Point_3 q; if ( does_ray_intersect_internally( ray, f, q) ) { TRACEN("ray hit facet case"); @@ -691,7 +696,7 @@ create_box_corner(int x, int y, int z, if ( spherical_orientation(p1,p2,p3) > 0 ) f = D.face(e); else f = D.face(D.twin(e)); D.mark(f) = true; - CGAL_forall_sedges_of(e,v) + CGAL_nef3_forall_sedges_of(e,v) D.mark(e) = D.mark(D.source(e)) = boundary; D.mark_of_halfsphere(-1) = (x<0 && y>0 && z>0); D.mark_of_halfsphere(+1) = (x>0 && y>0 && z<0); @@ -807,7 +812,7 @@ pair_up_halfedges() const Pluecker_line_map M; Halfedge_iterator e; - CGAL_forall_halfedges(e,*sncp()) { + CGAL_nef3_forall_halfedges(e,*sncp()) { Point_3 p = point(vertex(e)); Pluecker_line_3 l(p, p + tmp_point(e)); TRACEN(" "<second.sort(Halfedge_key_lt()); TRACEN(" "<first<<"\n " <<(debug_container(it->second),"")); Halfedge_list::iterator itl; - CGAL_forall_iterators(itl,it->second) { + CGAL_nef3_forall_iterators(itl,it->second) { Halfedge_handle e1 = itl->e; ++itl; CGAL_nef3_assertion(itl != it->second.end()); Halfedge_handle e2 = itl->e; + TRACEN("e1="<>>>>link_shalfedges_to_facet_cycles"); Halfedge_iterator e; - CGAL_forall_edges(e,*sncp()) { + CGAL_nef3_forall_edges(e,*sncp()) { Halfedge_iterator et = twin(e); SM_decorator D(vertex(e)), Dt(vertex(et)); if ( D.is_isolated(e) ) continue; SHalfedge_around_svertex_circulator ce(D.first_out_edge(e)),cee(ce); SHalfedge_around_svertex_circulator cet(Dt.first_out_edge(et)),cete(cet); - /*debug*/ - SHalfedge_around_svertex_circulator ceti = cet; - CGAL_For_all(ceti,cete) { - TRACEN(" et ss "<first); + CGAL_nef3_forall_iterators(it,M) { TRACEN(" plane "<first); FM_decorator D(*sncp()); D.create_facet_objects(it->first,it->second.begin(),it->second.end()); } @@ -938,7 +951,10 @@ create_volumes() const std::vector MinimalVertex; std::vector EntrySFace; SFace_iterator f; - CGAL_forall_sfaces(f,*sncp()) { + /* First, we classify all the Shere Faces per Shell. For each Shell we + determine its minimum lexicographyly vertex and we check wheter the + Shell encloses a region (closed surface) or not. */ + CGAL_nef3_forall_sfaces(f,*sncp()) { if ( Done[f] ) continue; V.minimal_vertex() = vertex(f); @@ -948,14 +964,18 @@ create_volumes() const EntrySFace.push_back(f); V.increment_shell_number(); } - Volume_handle outer_volume = sncp()->new_volume(); - for( unsigned i = 0; i < MinimalVertex.size(); ++i) { + /* then, we determine the Shells which correspond to Volumes via a ray + shotting in the direction (-1,0,0) over the Sphere_map of the minimal + vertex. The Shell corresponds to a Volume if the object hit belongs + to another Shell. */ + sncp()->new_volume(); // Outer volume, aka. nirvana + for( unsigned int i = 0; i < MinimalVertex.size(); ++i) { Vertex_handle v = MinimalVertex[i]; TRACEN( "Shell #" << i << " minimal vertex: " << point(v)); SM_point_locator D(v); SObject_handle o = D.locate(Sphere_point(-1,0,0)); SFace_const_handle sfc; - if( !assign(sfc, o) || Shell[sfc] != i) { // TO TEST: !assign(sfc, o) case + if( !assign(sfc, o) || Shell[sfc] != i) { /*UNTESTED CASE: !assign(sfc,o)*/ SFace_handle f = EntrySFace[i]; CGAL_assertion( Shell[EntrySFace[i]] == i ); if( Closed[f] ) { @@ -968,7 +988,10 @@ create_volumes() const } } } - CGAL_forall_sfaces(f,*sncp()) { + /* finaly, we go through all the Shells which do not correspond to a Volume + and we assign them to its enclosing Volume determined via a facet below + check. */ + CGAL_nef3_forall_sfaces(f,*sncp()) { if ( volume(f) != Volume_handle() ) continue; TRACEN( "Inner shell #" << Shell[f] << " volume?"); diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_decorator.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_decorator.h index cb6225220af..6606dd794dc 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_decorator.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_decorator.h @@ -392,7 +392,7 @@ visit_shell_objects(SFace_handle f, Visitor& V) const FacetCandidates.pop_front(); V.visit(f); // report facet Halffacet_cycle_iterator fc; - CGAL_forall_facet_cycles_of(fc,f) { + CGAL_nef3_forall_facet_cycles_of(fc,f) { SHalfedge_handle e; SHalfloop_handle l; if ( assign(e,fc) ) { SHalfedge_around_facet_circulator ec(e),ee(e); @@ -415,7 +415,7 @@ visit_shell_objects(SFace_handle f, Visitor& V) const if ( !Done[vertex(sf)] ) V.visit(vertex(sf)); // report vertex SFace_cycle_iterator fc; - CGAL_forall_sface_cycles_of(fc,sf) { + CGAL_nef3_forall_sface_cycles_of(fc,sf) { SVertex_handle v; SHalfedge_handle e; SHalfloop_handle l; if ( assign(e,fc) ) { SHalfedge_around_sface_circulator ec(e),ee(e); diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h index 708c91551e6..21c1c271c1c 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h @@ -202,33 +202,33 @@ void SNC_io_parser::print() const out << "/* Vertex: index { svs sve ses see sfs sfe sl," << " mark, point } */\n"; Vertex_iterator v; - CGAL_forall_vertices(v,*sncp()) print_vertex(v); + CGAL_nef3_forall_vertices(v,*sncp()) print_vertex(v); if (verbose) out << "/* Edge: index { twin, source, isolated incident_object," << " mark } */\n"; Halfedge_iterator e; - CGAL_forall_halfedges(e,*sncp()) print_edge(e); + CGAL_nef3_forall_halfedges(e,*sncp()) print_edge(e); if (verbose) out << "/* Facet: index { fclist, ivlist, mark, plane } */\n"; Halffacet_iterator f; - CGAL_forall_halffacets(f,*sncp()) print_facet(f); + CGAL_nef3_forall_halffacets(f,*sncp()) print_facet(f); if (verbose) out << "/* Volume: index { shlist, mark } */\n"; Volume_iterator c; - CGAL_forall_volumes(c,*sncp()) print_volume(c); + CGAL_nef3_forall_volumes(c,*sncp()) print_volume(c); if (verbose) out << "/* SEdge: index { twin, sprev, snext, source, sface," << " prev, next, facet } */\n"; SHalfedge_iterator se; - CGAL_forall_shalfedges(se,*sncp()) print_sedge(se); + CGAL_nef3_forall_shalfedges(se,*sncp()) print_sedge(se); if (verbose) out << "/* SLoop: index { twin, sface, facet } */" << std::endl; SHalfloop_iterator sl; - CGAL_forall_shalfloops(sl,*sncp()) print_sloop(sl); + CGAL_nef3_forall_shalfloops(sl,*sncp()) print_sloop(sl); if (verbose) out << "/* SFace: index { fclist, ivlist, sloop, volume } */" << std::endl; SFace_iterator sf; - CGAL_forall_sfaces(sf,*sncp()) print_sface(sf); + CGAL_nef3_forall_sfaces(sf,*sncp()) print_sface(sf); } template @@ -387,10 +387,10 @@ void SNC_io_parser::print_facet(Halffacet_handle f) const { // syntax: index { fclist, ivlist, mark, plane } out << index(f) << " { "; Halffacet_cycle_iterator it; - CGAL_forall_facet_cycles_of(it,f) + CGAL_nef3_forall_facet_cycles_of(it,f) if ( it.is_shalfedge() ) out << index(SHalfedge_handle(it)) << ' '; out << ", "; - CGAL_forall_facet_cycles_of(it,f) + CGAL_nef3_forall_facet_cycles_of(it,f) if ( it.is_shalfloop() ) out << index(SHalfloop_handle(it)); out << ", " << mark(f) << ", " << plane(f) << " }\n"; } @@ -423,7 +423,7 @@ void SNC_io_parser::print_volume(Volume_handle c) const { // syntax: index { shlist, mark } out << index(c) << " { "; Shell_entry_iterator it; - CGAL_forall_shells_of(it,c) + CGAL_nef3_forall_shells_of(it,c) out << index(SFace_handle(it)) << ' '; out << ", " << mark(c) << " }\n"; } @@ -534,13 +534,13 @@ print_sface(SFace_handle f) const { // syntax: index { vertex, fclist, ivlist, sloop, volume } out << index(f) << " { " << index(f->center_vertex_) << ", "; SFace_cycle_iterator it; - CGAL_forall_sface_cycles_of(it,f) + CGAL_nef3_forall_sface_cycles_of(it,f) if ( it.is_shalfedge() ) out << index(SHalfedge_handle(it)) << ' '; out << ", "; - CGAL_forall_sface_cycles_of(it,f) + CGAL_nef3_forall_sface_cycles_of(it,f) if ( it.is_svertex() ) out << index(SVertex_handle(it)) << ' '; out << ", "; - CGAL_forall_sface_cycles_of(it,f) + CGAL_nef3_forall_sface_cycles_of(it,f) if ( it.is_shalfloop() ) out << index(SHalfloop_handle(it)); out << ", " << index(volume(f)) << " }\n"; } @@ -590,12 +590,12 @@ void SNC_io_parser::print_local_graph(Vertex_handle v) const if (verbose) out << "/* index { twin, source, isolated incident_object, mark } */\n"; SVertex_iterator vit; - CGAL_forall_svertices_of(vit,v) print_edge(vit); + CGAL_nef3_forall_svertices_of(vit,v) print_edge(vit); if (verbose) out << "/* index { twin, sprev, snext, source, sface," << " prev, next, facet } */\n"; SHalfedge_iterator eit; - CGAL_forall_shalfedges_of(eit,v) print_sedge(eit); + CGAL_nef3_forall_shalfedges_of(eit,v) print_sedge(eit); if (verbose) out << "/* index { twin, sface, facet } */" << std::endl; if ( D.has_loop() ) @@ -603,7 +603,7 @@ void SNC_io_parser::print_local_graph(Vertex_handle v) const if (verbose) out << "/* index { fclist, ivlist, sloop, volume } */" << std::endl; SFace_iterator fit; - CGAL_forall_sfaces_of(fit,v) print_sface(fit); + CGAL_nef3_forall_sfaces_of(fit,v) print_sface(fit); out.flush(); } diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_iteration.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_iteration.h index b33bba0f0f9..bcf77de5b97 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_iteration.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_iteration.h @@ -31,50 +31,64 @@ #ifndef CGAL_SNC_ITERATION_H #define CGAL_SNC_ITERATION_H -#undef CGAL_forall_iterators -#define CGAL_forall_iterators(x,L)\ +//#undef CGAL_nef3_forall_iterators +#define CGAL_nef3_forall_iterators(x,L)\ for(x = (L).begin(); x != (L).end(); ++x) -#define CGAL_forall_vertices(x,SNC)\ +#define CGAL_nef3_forall_vertices(x,SNC)\ for(x = (SNC).vertices_begin(); x != (SNC).vertices_end(); ++x) -#define CGAL_forall_halfedges(x,SNC)\ + +#define CGAL_nef3_forall_halfedges(x,SNC)\ for(x = (SNC).halfedges_begin(); x != (SNC).halfedges_end(); ++x) -#define CGAL_forall_edges(x,SNC)\ + +#define CGAL_nef3_forall_edges(x,SNC)\ for(x = (SNC).halfedges_begin(); x != (SNC).halfedges_end(); ++x) \ if ( x->is_twin() ) continue; else -#define CGAL_forall_halffacets(x,SNC)\ + +#define CGAL_nef3_forall_halffacets(x,SNC)\ for(x = (SNC).halffacets_begin(); x != (SNC).halffacets_end(); ++x) -#define CGAL_forall_facets(x,SNC)\ + +#define CGAL_nef3_forall_facets(x,SNC)\ for(x = (SNC).halffacets_begin(); x != (SNC).halffacets_end(); ++x) \ if ( x->is_twin() ) continue; else -#define CGAL_forall_volumes(x,SNC)\ + +#define CGAL_nef3_forall_volumes(x,SNC)\ for(x = (SNC).volumes_begin(); x != (SNC).volumes_end(); ++x) -#define CGAL_forall_svertices(x,SNC)\ + +#define CGAL_nef3_forall_svertices(x,SNC)\ for(x = (SNC).svertices_begin(); x != (SNC).svertices_end(); ++x) -#define CGAL_forall_shalfloops(x,SNC)\ + +#define CGAL_nef3_forall_shalfloops(x,SNC)\ for(x = (SNC).shalfloops_begin(); x != (SNC).shalfloops_end(); ++x) -#define CGAL_forall_shalfedges(x,SNC)\ + +#define CGAL_nef3_forall_shalfedges(x,SNC)\ for(x = (SNC).shalfedges_begin(); x != (SNC).shalfedges_end(); ++x) -#define CGAL_forall_sedges(x,SNC)\ + +#define CGAL_nef3_forall_sedges(x,SNC)\ for(x = (SNC).shalfedges_begin(); x != (SNC).shalfedges_end(); ++(++x)) -#define CGAL_forall_sfaces(x,SNC)\ + +#define CGAL_nef3_forall_sfaces(x,SNC)\ for(x = (SNC).sfaces_begin(); x != (SNC).sfaces_end(); ++x) -#define CGAL_forall_facet_cycles_of(x,F)\ +#define CGAL_nef3_forall_facet_cycles_of(x,F)\ for(x = (F)->facet_cycles_begin(); x != (F)->facet_cycles_end(); ++x) -#define CGAL_forall_shells_of(x,C)\ + +#define CGAL_nef3_forall_shells_of(x,C)\ for(x = (C)->shells_begin(); x != (C)->shells_end(); ++x) -#define CGAL_forall_svertices_of(x,V)\ +#define CGAL_nef3_forall_svertices_of(x,V)\ for(x = (V)->svertices_begin(); x != (V)->svertices_end(); ++x) -#define CGAL_forall_sedges_of(x,V)\ + +#define CGAL_nef3_forall_sedges_of(x,V)\ for(x = (V)->shalfedges_begin(); x != (V)->shalfedges_end(); ++(++x)) -#define CGAL_forall_shalfedges_of(x,V)\ + +#define CGAL_nef3_forall_shalfedges_of(x,V)\ for(x = (V)->shalfedges_begin(); x != (V)->shalfedges_end(); ++x) -#define CGAL_forall_sfaces_of(x,V)\ + +#define CGAL_nef3_forall_sfaces_of(x,V)\ for(x = (V)->sfaces_begin(); x != (V)->sfaces_end(); ++x) -#define CGAL_forall_sface_cycles_of(x,F)\ +#define CGAL_nef3_forall_sface_cycles_of(x,F)\ for(x = (F)->sface_cycles_begin(); x != (F)->sface_cycles_end(); ++x) #endif //CGAL_SNC_ITERATION_H diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h index b05643862cf..27b0da79e70 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h @@ -131,15 +131,15 @@ SNC_point_locator::locate(const Point_3& p) const // now not empty: Vertex_iterator v; - CGAL_forall_vertices(v,*sncp()) + CGAL_nef3_forall_vertices(v,*sncp()) if ( p == point(v) ) return Object_handle(v); Halfedge_iterator e; - CGAL_forall_edges(e,*sncp()) + CGAL_nef3_forall_edges(e,*sncp()) if ( segment(e).constains(p) ) return Object_handle(e); Halffacet_iterator f; - CGAL_forall_halffacets(f,*sncp()) { // nur ufacets + CGAL_nef3_forall_halffacets(f,*sncp()) { // nur ufacets FM_decorator D(f); if ( D.facet_contains(p) ) return Object_handle(f); } @@ -147,15 +147,15 @@ SNC_point_locator::locate(const Point_3& p) const Segment_3 s(p, point(vertices_begin())), so(s.opposite()); Object_handle closest(vertices_begin()); - CGAL_forall_vertices(v,*sncp()) + CGAL_nef3_forall_vertices(v,*sncp()) if ( s.has_on(point(v)) ) { shorten(s,point(v)); closest=Object_handle(v); } - CGAL_forall_edges(e,*sncp()) { + CGAL_nef3_forall_edges(e,*sncp()) { Point_3 q; if ( do_intersect(s,e,q) ) { shorten(s,q); closest=Object_handle(e); } } - CGAL_forall_halffacets(f,*sncp()) { + CGAL_nef3_forall_halffacets(f,*sncp()) { Point_3 q; if ( do_intersect(s,f,q) ) { shorten(s,q); closest=Object_handle(f); } diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_structure.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_structure.h index 96834ad7ae6..9914251bdfa 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_structure.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_structure.h @@ -490,7 +490,7 @@ public: void reset_object_list(Object_list& L) { Object_iterator oit; - CGAL_forall_iterators(oit,L) reset_iterator_hash(oit); + CGAL_nef3_forall_iterators(oit,L) reset_iterator_hash(oit); L.clear(); } @@ -547,10 +547,10 @@ public: |Halffacet_iterator halffacets_begin()/halffacets_end()|\\ |Volume_iterator volumes_begin()/volumes_end()| - The macros are then |CGAL_forall_vertices(v,\Mvar)|, - |CGAL_forall_halfedges(e,\Mvar)|, |CGAL_forall_edges(e,\Mvar)|, - |CGAL_forall_halffacets(f,\Mvar)|, |CGAL_forall_facets(f,\Mvar)|, - |CGAL_forall_volumes(w,\Mvar)|.}*/ + The macros are then |CGAL_nef3_forall_vertices(v,\Mvar)|, + |CGAL_nef3_forall_halfedges(e,\Mvar)|, |CGAL_nef3_forall_edges(e,\Mvar)|, + |CGAL_nef3_forall_halffacets(f,\Mvar)|, |CGAL_nef3_forall_facets(f,\Mvar)|, + |CGAL_nef3_forall_volumes(w,\Mvar)|.}*/ Size_type number_of_vertices() const { return vertices_.size(); } /*{\Mop returns the number of vertices.}*/ @@ -729,7 +729,7 @@ public: Union_find< SFace_handle>& uf ) { SNC_decorator D; Halffacet_cycle_iterator fc; - CGAL_forall_facet_cycles_of(fc, f) { + CGAL_nef3_forall_facet_cycles_of(fc, f) { SHalfedge_handle e; SHalfloop_handle l; if( assign(e, fc) ) { @@ -796,7 +796,7 @@ public: /* there must be only two incident sedges to the svertex v */ CGAL_assertion( SD.circle(e1) == SD.circle(e2o)); /* the two local sedges share the same scircle */ - CGAL_assertion( D.mark(e1) == D.mark(v) && D.mark(v) == D.mark(e2o)); + CGAL_assertion( D.mark(e1) == D.mark(v) && D.mark(v) == D.mark(e2)); /* the edge and its two incident facets have the same mark */ SD.link_as_prev_next_pair( SD.previous(e1), SD.next(e1)); SD.link_as_prev_next_pair( SD.previous(e1o), SD.next(e1o)); @@ -935,13 +935,13 @@ public: Union_find< SFace_handle> uf_sface; Volume_iterator c; - CGAL_forall_volumes( c, *this) + CGAL_nef3_forall_volumes( c, *this) hash_volume[c] = uf_volume.make_set(c); Halffacet_iterator hf; - CGAL_forall_halffacets( hf, *this) + CGAL_nef3_forall_halffacets( hf, *this) hash_facet[hf] = uf_facet.make_set(hf); SFace_iterator sf; - CGAL_forall_sfaces( sf, *this) + CGAL_nef3_forall_sfaces( sf, *this) hash_sface[sf] = uf_sface.make_set(sf); Halffacet_handle f((*this).halffacets_begin()); @@ -956,9 +956,7 @@ public: " mark("<index(f)<<")="<index(c2)<<")="<& uf_sface ) { SNC_decorator D(*this); SFace_iterator sf; - CGAL_forall_sfaces( sf, *this) { + CGAL_nef3_forall_sfaces( sf, *this) { if( uf_sface.find(hash_sface[sf]) != hash_sface[sf]) { TRACEN("no find object "<index(sf)); SM_decorator SD(D.vertex(sf)); @@ -1057,14 +1052,14 @@ public: } } Halffacet_iterator f; - CGAL_forall_halffacets( f, *this) { + CGAL_nef3_forall_halffacets( f, *this) { if( uf_facet.find(hash_facet[f]) != hash_facet[f]) { TRACEN("no find object "<index(f)); delete_halffacet_pair(f); } } Volume_iterator c; - CGAL_forall_volumes( c, *this) { + CGAL_nef3_forall_volumes( c, *this) { if( uf_volume.find(hash_volume[c]) != hash_volume[c]) { TRACEN("no find object "<index(c)); delete_volume(c); @@ -1078,7 +1073,7 @@ public: SNC_decorator D(*this); SM_decorator SD; SHalfedge_iterator e; - CGAL_forall_shalfedges(e, *this) { // all shalfedges + CGAL_nef3_forall_shalfedges(e, *this) { // all shalfedges // if( e was not yet assigned to an sface cycle ) UFH_sface sf(uf.find(hash[D.sface(e)])); if( hash[D.sface(e)] != sf) { @@ -1089,7 +1084,7 @@ public: } } SVertex_handle sv; - CGAL_forall_svertices(sv, *this) + CGAL_nef3_forall_svertices(sv, *this) if( SD.is_isolated(sv)) SD.set_face( sv, *(uf.find(hash[D.sface(sv)]))); } @@ -1099,7 +1094,7 @@ public: Union_find< Halffacet_handle>& uf) { SNC_decorator D(*this); SHalfedge_iterator u; - CGAL_forall_shalfedges(u, *this) { // all edge uses + CGAL_nef3_forall_shalfedges(u, *this) { // all edge uses // if( u was not yet assigned to a facet cycle ) UFH_facet sf(uf.find(hash[D.facet(u)])); if( hash[D.facet(u)] != sf) { @@ -1110,7 +1105,7 @@ public: } } SHalfloop_iterator l; - CGAL_forall_shalfloops( l, *this) // all sloops + CGAL_nef3_forall_shalfloops( l, *this) // all sloops l->incident_facet_ = *(uf.find(hash[D.facet(l)])); } @@ -1120,7 +1115,7 @@ public: Union_find< Volume_handle>& uf) { SNC_decorator D(*this); SFace_iterator sf; - CGAL_forall_sfaces(sf, *this) { // all sfaces + CGAL_nef3_forall_sfaces(sf, *this) { // all sfaces // if( f was not yet assigned to a shell ) UFH_volume c(uf.find(hash[D.volume(sf)])); if( hash[D.volume(sf)] != c) { @@ -1188,7 +1183,7 @@ pointer_update(const SNC_structure& D) for ( ; sfc != D.sfaces_end(); ++sfc,++sf) SFM[sfc] = sf; SFM[D.sfaces_end()] = sfaces_end(); - CGAL_forall_vertices(v,*this) { + CGAL_nef3_forall_vertices(v,*this) { // Local Graph update: (SVertices are postponed/updated as Edges) v->sncp_ = this; v->svertices_begin_ = EM[v->svertices_begin_]; @@ -1200,14 +1195,14 @@ pointer_update(const SNC_structure& D) v->shalfloop_ = SLM[v->shalfloop_]; } // Halfedge update: - CGAL_forall_halfedges(e,*this) { + CGAL_nef3_forall_halfedges(e,*this) { e->center_vertex_ = VM[e->center_vertex_]; e->twin_ = EM[e->twin_]; e->out_sedge_ = SEM[e->out_sedge_]; e->incident_sface_ = SFM[e->incident_sface_]; } // Halffacet update - CGAL_forall_halffacets(f,*this) { + CGAL_nef3_forall_halffacets(f,*this) { f->twin_ = FM[f->twin_]; f->volume_ = CM[f->volume_]; Halffacet_cycle_iterator ftc; @@ -1221,16 +1216,16 @@ pointer_update(const SNC_structure& D) } } // Volume update - CGAL_forall_volumes(c,*this) { + CGAL_nef3_forall_volumes(c,*this) { Shell_entry_iterator sei; - CGAL_forall_shells_of(sei,c) { + CGAL_nef3_forall_shells_of(sei,c) { sf = sei; // conversion from generic iterator to sface const handle *sei = Object_handle(SFM[sf]); store_boundary_item(sf,sei); } } - CGAL_forall_shalfedges(se,*this) { + CGAL_nef3_forall_shalfedges(se,*this) { se->source_ = EM[se->source_]; se->sprev_ = SEM[se->sprev_]; se->snext_ = SEM[se->snext_]; se->incident_sface_ = SFM[se->incident_sface_]; @@ -1238,12 +1233,12 @@ pointer_update(const SNC_structure& D) se->prev_ = SEM[se->prev_]; se->next_ = SEM[se->next_]; se->incident_facet_ = FM[se->incident_facet_]; } - CGAL_forall_shalfloops(sl,*this) { + CGAL_nef3_forall_shalfloops(sl,*this) { sl->twin_ = SLM[sl->twin_]; sl->incident_sface_ = SFM[sl->incident_sface_]; sl->incident_facet_ = FM[sl->incident_facet_]; } - CGAL_forall_sfaces(sf,*this) { + CGAL_nef3_forall_sfaces(sf,*this) { sf->center_vertex_ = VM[sf->center_vertex_]; sf->incident_volume_ = CM[sf->incident_volume_]; SFace_cycle_iterator sfc; diff --git a/Packages/Nef_3/include/CGAL/Nef_3/SNC_visualizor_OGL.h b/Packages/Nef_3/include/CGAL/Nef_3/SNC_visualizor_OGL.h index fe758bdfc55..3308ae29691 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_visualizor_OGL.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_visualizor_OGL.h @@ -371,17 +371,17 @@ namespace OGL { { glNewList(object_list_, GL_COMPILE); Vertex_iterator v; - CGAL_forall_iterators(v,vertices_) draw(v); + CGAL_nef3_forall_iterators(v,vertices_) draw(v); glEndList(); glNewList(object_list_+1, GL_COMPILE); Edge_iterator e; - CGAL_forall_iterators(e,edges_) draw(e); + CGAL_nef3_forall_iterators(e,edges_) draw(e); glEndList(); glNewList(object_list_+2, GL_COMPILE); Halffacet_iterator f; - CGAL_forall_iterators(f,halffacets_) draw(f); + CGAL_nef3_forall_iterators(f,halffacets_) draw(f); glEndList(); glNewList(object_list_+3, GL_COMPILE); // axes: @@ -417,15 +417,15 @@ namespace OGL { os << "OGL::Polyhedron" << std::endl; os << "Vertices:" << std::endl; Vertex_iterator v; - CGAL_forall_iterators(v,vertices_) + CGAL_nef3_forall_iterators(v,vertices_) os << " "<<*v<<", mark="<mark()<debug(); os << std::endl; + CGAL_nef3_forall_iterators(f,halffacets_) f->debug(); os << std::endl; os << std::endl; } @@ -477,21 +477,21 @@ static void show (int mode) dx = dy = wx = wy = 0.0; s = 0.5; motion_mode = ROTATE; - CGAL_forall_iterators(it,polyhedra_) it->initialize(); + CGAL_nef3_forall_iterators(it,polyhedra_) it->initialize(); glutPostRedisplay(); break; case AXES: - CGAL_forall_iterators(it,polyhedra_) it->toggle_axes(); + CGAL_nef3_forall_iterators(it,polyhedra_) it->toggle_axes(); glutPostRedisplay(); break; case BOUNDARY: - CGAL_forall_iterators(it,polyhedra_) it->boundary_on(); - CGAL_forall_iterators(it,polyhedra_) it->draw(); + CGAL_nef3_forall_iterators(it,polyhedra_) it->boundary_on(); + CGAL_nef3_forall_iterators(it,polyhedra_) it->draw(); glutPostRedisplay(); break; case SKELETON: - CGAL_forall_iterators(it,polyhedra_) it->skeleton_on(); - CGAL_forall_iterators(it,polyhedra_) it->draw(); + CGAL_nef3_forall_iterators(it,polyhedra_) it->skeleton_on(); + CGAL_nef3_forall_iterators(it,polyhedra_) it->draw(); glutPostRedisplay(); break; case QUIT: @@ -742,11 +742,11 @@ public: void draw() const { Vertex_iterator v; - CGAL_forall_vertices(v,*sncp()) draw(v); + CGAL_nef3_forall_vertices(v,*sncp()) draw(v); Halfedge_iterator e; - CGAL_forall_edges(e,*sncp()) draw(e); + CGAL_nef3_forall_edges(e,*sncp()) draw(e); Halffacet_iterator f; - CGAL_forall_facets(f,*sncp()) draw(f); + CGAL_nef3_forall_facets(f,*sncp()) draw(f); } }; // SNC_visualizor_OGL diff --git a/Packages/Nef_3/include/CGAL/Nef_3/bounded_side_3.h b/Packages/Nef_3/include/CGAL/Nef_3/bounded_side_3.h index 485fa01e071..b9e729b599f 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/bounded_side_3.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/bounded_side_3.h @@ -87,14 +87,14 @@ Bounded_side bounded_side_3(IteratorForward first, TRACEN("pv*pxz: "<; - else if( !is_zero(pv*pyz) ) + else if( !CGAL_NTS is_zero(pv*pyz) ) /* the plane is not perpendicular to the YZ plane */ t = &point_3_get_y_z_point_2< Point_2, Point_3>; else { - CGAL_assertion( !is_zero(pv*pxy) ); + CGAL_assertion( !CGAL_NTS is_zero(pv*pxy) ); /* the plane is not perpendicular to the XY plane */ t = &point_3_get_x_y_point_2< Point_2, Point_3>; } diff --git a/Packages/Nef_3/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h b/Packages/Nef_3/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h index b66f8ddba44..5e2d17c3557 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h @@ -104,7 +104,6 @@ void polyhedron_3_to_nef_3(Polyhedron_& P, SNC_structure& S) // < typename Polyhedron::Plane_3>( std::cout, "\n")); SNC_decorator D(S); - SNC_constructor C(S); typename Polyhedron::Vertex_iterator pvi; for( pvi = P.vertices_begin(); pvi != P.vertices_end(); ++pvi ) { @@ -150,7 +149,7 @@ void polyhedron_3_to_nef_3(Polyhedron_& P, SNC_structure& S) } SM_overlayer O(nv); O.create_from_segments(ss_list.begin(),ss_list.end()); - O.simplify(); + /* why not? O.simplify(); */ #else // CGAL_P2NEF3_USE_SM_OVERLAY @@ -259,15 +258,15 @@ void polyhedron_3_to_nef_3(Polyhedron_& P, SNC_structure& S) #endif // CGAL_P2NEF3_USE_SM_OVERLAY -#ifdef SM_VISUALIZE - CGAL::OGL::add_sphere(); - SMV V(nv, CGAL::OGL::spheres_.back()); - V.draw_map(); +#ifdef SM_VISUALIZOR + // CGAL::OGL::add_sphere(); + // SMV V(nv, CGAL::OGL::spheres_.back()); + // V.draw_map(); #endif } -#ifdef SM_VISUALIZE - CGAL::OGL::start_viewer(); +#ifdef SM_VISUALIZOR + // CGAL::OGL::start_viewer(); #endif return; diff --git a/Packages/Nef_3/include/CGAL/Nef_polyhedron_3.h b/Packages/Nef_3/include/CGAL/Nef_polyhedron_3.h index dd47c86ccb2..4ff0ebff298 100644 --- a/Packages/Nef_3/include/CGAL/Nef_polyhedron_3.h +++ b/Packages/Nef_3/include/CGAL/Nef_polyhedron_3.h @@ -33,6 +33,7 @@ #include #include #define SNC_VISUALIZOR +// #define SM_VISUALIZOR #include #include #include @@ -46,7 +47,9 @@ #include #include #include -//#include +#ifdef SM_VISUALIZOR +#include +#endif // SM_VISUALIZOR #include #include @@ -85,7 +88,9 @@ class Nef_polyhedron_3_rep : public Rep typedef CGAL::SNC_SM_overlayer SM_overlayer; typedef CGAL::SNC_SM_point_locator SM_point_locator; typedef CGAL::SNC_SM_io_parser SM_io_parser; - //typedef CGAL::SNC_SM_visualizor SM_visualizor; +#ifdef SM_VISUALIZOR + typedef CGAL::SNC_SM_visualizor SM_visualizor; +#endif // SM_VISUALIZOR SNC_structure ews_; // SNC_point_locator* pl_; @@ -148,7 +153,9 @@ protected: typedef typename Nef_rep::SM_overlayer SM_overlayer; typedef typename Nef_rep::SM_point_locator SM_point_locator; typedef typename Nef_rep::SM_io_parser SM_io_parser; +#ifdef SM_VISUALIZOR //typedef typename Nef_rep::SM_visualizor SM_visualizor; +#endif // SM_VISUALIZOR SNC_structure& ews() { return ptr()->ews_; } const SNC_structure& ews() const { return ptr()->ews_; } @@ -250,10 +257,11 @@ protected: else f = D.face(D.twin(e)); D.mark(f) = space; - CGAL_forall_sedges_of(e, v) + CGAL_nef3_forall_sedges_of(e, v) D.mark(e) = D.mark(D.source(e)) = true; // D.mark_of_halfsphere(-1) = (x<0 && y>0 && z>0); // D.mark_of_halfsphere(+1) = (x>0 && y>0 && z<0); + return v; } void initialize_simple_cube_vertices(Content space) {