From e9d7538aeabed2afe77d5cc201dcd7d8a59ea591 Mon Sep 17 00:00:00 2001 From: Peter Hachenberger Date: Thu, 31 Oct 2002 16:22:08 +0000 Subject: [PATCH] complete_face_support korrigiert Callback funktion fuer GLU_TESS_COMBINE hinzugefuegt --- .../include/CGAL/Nef_3/Pluecker_line_3.h | 15 +- .../include/CGAL/Nef_3/SNC_SM_io_parser.h | 2 +- .../include/CGAL/Nef_3/SNC_SM_overlayer.h | 173 +++++++++++++++++- .../include/CGAL/Nef_3/SNC_constructor.h | 19 +- .../Nef_3/include/CGAL/Nef_3/SNC_decorator.h | 80 ++++---- .../include/CGAL/Nef_3/SNC_visualizor_OGL.h | 8 + Packages/Nef_3/include/CGAL/Nef_3/debug.h | 31 ++-- .../Nef_3/include/CGAL/Nef_polyhedron_3.h | 31 ++-- 8 files changed, 276 insertions(+), 83 deletions(-) diff --git a/Packages/Nef_3/include/CGAL/Nef_3/Pluecker_line_3.h b/Packages/Nef_3/include/CGAL/Nef_3/Pluecker_line_3.h index 341329c6089..bc21280d19b 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/Pluecker_line_3.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/Pluecker_line_3.h @@ -136,8 +136,18 @@ void normalize() /*{\Mop reduces the Pluecker coefficients to a minimal representation. This is done by dividing all Pluecker coefficients by their common gcd.}*/ -{ RT D = c_[0]; - for(int i=1; i<6; ++i) +{ + int i=0; + while(i<6 && c_[i]==0) + i++; + + if(i>5) + return; + + RT D = c_[i]; + CGAL_assertion(D!=0); + + for(++i; i<6; ++i) D = (c_[i]==0 ? D : CGAL_NTS gcd(D, c_[i])); if (D==0) return; for(int i=0; i<6; ++i) c_[i]/=D; @@ -205,7 +215,6 @@ struct Pluecker_line_lt { { return CGAL::Pluecker_line_3::cmp(l1,l2)<0; } }; - CGAL_END_NAMESPACE #endif //CGAL_PLUECKER_LINE_3_H 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 c87189e0075..d7297f3a3b7 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 @@ -401,7 +401,7 @@ void SNC_SM_io_parser::debug_edge(SHalfedge_handle e) const { out << index(e) << "(" << index(source(e)) << "," << index(target(e)) << ") " - << index(twin(e)) << " " << index(face(e)) + << index(twin(e)) << " " << index(face(e)) << " " << mark(face(e)) << " ["<< mark(e) << "] " << circle(e) << endl; } 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 1846801d347..6a0c1ae3b87 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 @@ -745,29 +745,44 @@ subdivide(Vertex_handle v0, Vertex_handle v1) SVertex_iterator v; CGAL_nef3_forall_svertices(v,PI[i]) { if ( !PI[i].is_isolated(v) ) continue; + TRACEN("isolated " << PH(v)); L.push_back(trivial_segment(PI[i],v)); From[--L.end()] = Seg_info(v,i); } SHalfedge_iterator e; CGAL_nef3_forall_sedges(e,PI[i]) { if ( source(e) == target(e) ) { + TRACEN("degenerierte Kante " << PH(e)); Seg_pair p = two_segments(PI[i],e); L.push_back(p.first); L.push_back(p.second); From[--L.end()] = From[--(--L.end())] = Seg_info(e,i); } else { + TRACEN("normale Kante " << PH(e)); L.push_back(segment(PI[i],e)); From[--L.end()] = Seg_info(e,i); } } if ( PI[i].has_loop() ) { - Seg_pair p = two_segments(PI[i],PI[i].shalfloop()); + TRACEN("halfloop"); + SHalfloop_handle shl = PI[i].shalfloop(); + Seg_pair p = two_segments(PI[i],shl); L.push_back(p.first); L.push_back(p.second); From[--L.end()] = From[--(--L.end())] = - Seg_info(PI[i].shalfloop(),i); + Seg_info(shl,i); + /* + p = two_segments(PI[i],PI[i].twin(shl)); + L.push_back(p.first); + L.push_back(p.second); + From[--L.end()] = From[--(--L.end())] = + Seg_info(PI[i].twin(shl),i); + */ } } + + typename Seg_list::iterator it; + CGAL_nef3_forall_iterators(it,L) TRACEN(" "<<*it); Seg_list L_pos,L_neg; partition_to_halfsphere(L.begin(), L.end(), L_pos, From, +1); @@ -814,12 +829,13 @@ subdivide(Vertex_handle v0, Vertex_handle v1) // now two CCs of sphere graph are calculated // v = first vertex of CC in negative x-sphere // e = first edge of CC in negative x-sphere - + create_face_objects(shalfedges_begin(), e, svertices_begin(), v, O, PH_geometry()); create_face_objects(e, shalfedges_end(), v, svertices_end(), O, NH_geometry()); + SHalfedge_iterator u; CGAL_nef3_forall_sedges(u,*this) { Sphere_segment s(point(source(u)),point(target(u))); @@ -830,6 +846,8 @@ subdivide(Vertex_handle v0, Vertex_handle v1) complete_face_support(svertices_begin(), v, O, +1); complete_face_support(v, svertices_end(), O, -1); + + /* DEBUG CODE: to do: have all svertices a halfedge below associated? */ TRACEN("Vertex info after swep"); for( svi=svertices_begin(); svi!=svertices_end(); svi++) { @@ -975,12 +993,39 @@ complete_face_support(SVertex_iterator v_start, SVertex_iterator v_end, TRACEN("VERTEX = "< 0 ? (point(v).hx() >= 0) : (point(v).hx()<=0)) ); @@ -1044,6 +1089,8 @@ complete_face_support(SVertex_iterator v_start, SVertex_iterator v_end, TRACEN(" mark of "<point()); + + SVertex_handle v; + CGAL_nef3_forall_svertices(v,*this) + TRACEN(PH(v) << " " << mark(v,0)); + TRACEN(" "); + CGAL_nef3_forall_svertices(v,PI[0]) + TRACEN(PH(v)); + TRACEN(" "); + CGAL_nef3_forall_svertices(v,*this) + TRACEN(PH(v) << " " << mark(v,1)); + TRACEN(" "); + CGAL_nef3_forall_svertices(v,PI[1]) + TRACEN(PH(v)); + TRACEN(" "); + + SHalfedge_handle e; + CGAL_nef3_forall_shalfedges(e,*this) + TRACEN(PH(e)<< " " << mark(e,0)); + TRACEN(" "); + CGAL_nef3_forall_shalfedges(e,PI[0]) + TRACEN(PH(e)<< " " << PI[0].mark(e) << " " << PI[0].mark(PI[0].face(e))); + TRACEN(" "); + CGAL_nef3_forall_shalfedges(e,*this) + TRACEN(PH(e) << " " << mark(e,1)); + TRACEN(" "); + CGAL_nef3_forall_shalfedges(e,PI[1]) + TRACEN(PH(e) << " " << PI[1].mark(e) << " " << PI[1].mark(PI[1].face(e))); + TRACEN(" "); + + SFace_handle ff; + CGAL_nef3_forall_sfaces(ff,*this) + TRACEN(&*ff << " " << mark(ff,0)); + TRACEN(" "); + CGAL_nef3_forall_sfaces(ff,PI[0]) + TRACEN(&*ff << " " << PI[0].mark(ff)); + TRACEN(" "); + CGAL_nef3_forall_sfaces(ff,*this) + TRACEN(&*ff << " " << mark(ff,1)); + TRACEN(" "); + CGAL_nef3_forall_sfaces(ff,PI[1]) + TRACEN(&*ff << " " << PI[1].mark(ff)); + TRACEN(" "); } @@ -1072,7 +1162,9 @@ merge_nodes(SHalfedge_handle e1, SHalfedge_handle e2, CGAL_For_all(eav,ee) { set_source(eav,v1); } link_as_prev_next_pair(e2,e1); link_as_prev_next_pair(ep1,en2); - D.assert_equal_marks(v1,v2); + //D.assert_equal_marks(v1,v2); + mark(v1,0) = mark(v1,0) || mark(v2,0); + mark(v1,1) = mark(v1,1) || mark(v2,1); D.discard_info(v2); delete_vertex_only(v2); } @@ -1107,6 +1199,8 @@ merge_halfsphere_maps(SVertex_handle v1, SVertex_handle v2, set_face(e1,f); if ( e2 == first_out_edge(source(e2)) ) set_first_out_edge(source(e2),e1t); + mark(e1,0) = mark(e1,0) || mark(e2,0); + mark(e1,1) = mark(e1,1) || mark(e2,1); D.discard_info(e2); delete_edge_pair_only(e2); } @@ -1173,6 +1267,23 @@ void SNC_SM_overlayer::simplify() const set_face(target(e),face(e)); delete_edge_pair(e); } + + SVertex_handle v; + CGAL_nef3_forall_svertices(v,*this) + TRACEN(PH(v) << " " << mark(v)); + TRACEN(" "); + + + SHalfedge_handle e; + CGAL_nef3_forall_shalfedges(e,*this) + TRACEN(PH(e)<< " " << mark(e)); + TRACEN(" "); + + SFace_handle ff; + CGAL_nef3_forall_sfaces(ff,*this) + TRACEN(&*ff << " " << mark(ff)); + TRACEN(" "); + } CGAL::Unique_hash_map linked(false); @@ -1191,6 +1302,20 @@ void SNC_SM_overlayer::simplify() const link_as_loop(twin(l),f); } + SVertex_handle vi; + CGAL_nef3_forall_svertices(vi,*this) + TRACEN(PH(vi) << " " << mark(vi)); + TRACEN(" "); + + SHalfedge_handle ei; + CGAL_nef3_forall_shalfedges(ei,*this) + TRACEN(PH(ei)<< " " << mark(ei)); + TRACEN(" "); + + SFace_handle ff; + CGAL_nef3_forall_sfaces(ff,*this) + TRACEN(&*ff << " " << mark(ff)); + TRACEN(" "); SVertex_iterator v,vn; for(v = svertices_begin(); v != svertices_end(); v=vn) { @@ -1213,6 +1338,23 @@ void SNC_SM_overlayer::simplify() const } } + + + CGAL_nef3_forall_svertices(vi,*this) + TRACEN(PH(vi) << " " << mark(vi)); + TRACEN(" "); + + + CGAL_nef3_forall_shalfedges(ei,*this) + TRACEN(PH(ei)<< " " << mark(ei)); + TRACEN(" "); + + + + CGAL_nef3_forall_sfaces(ff,*this) + TRACEN(&*ff << " " << mark(ff)); + TRACEN(" "); + SFace_iterator fn; for (f = fn = sfaces_begin(); f != sfaces_end(); f=fn) { ++fn; @@ -1222,6 +1364,21 @@ void SNC_SM_overlayer::simplify() const } + CGAL_nef3_forall_svertices(vi,*this) + TRACEN(PH(vi) << " " << mark(vi)); + TRACEN(" "); + + + CGAL_nef3_forall_shalfedges(ei,*this) + TRACEN(PH(ei)<< " " << mark(ei)); + TRACEN(" "); + + + + CGAL_nef3_forall_sfaces(ff,*this) + TRACEN(&*ff << " " << mark(ff)); + TRACEN(" "); + } 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 46840a14b23..225ca8dfb74 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_constructor.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_constructor.h @@ -41,7 +41,7 @@ #include #include #include -#include +#include #ifdef SM_VISUALIZOR #include #endif // SM_VISUALIZOR @@ -146,7 +146,7 @@ public: typedef CGAL::SNC_constructor Self; typedef CGAL::SNC_decorator Base; typedef CGAL::SNC_decorator SNC_decorator; - typedef CGAL::SNC_ray_shoter SNC_ray_shoter; + typedef CGAL::SNC_ray_shooter SNC_ray_shooter; typedef CGAL::SNC_FM_decorator FM_decorator; typedef CGAL::SNC_SM_decorator SM_decorator; typedef CGAL::SNC_SM_overlayer SM_overlayer; @@ -336,14 +336,14 @@ public: } Halffacet_handle get_facet_below( Vertex_handle vi) const - /*{\Mop determines the facet below a vertex |vi| via ray shoting. }*/ { + /*{\Mop determines the facet below a vertex |vi| via ray shooting. }*/ { Halffacet_handle f_below; Point_3 p = point(vi); // ######### Non-generic code ########## Segment_3 ray( p, Point_3( p.hx(), p.hy(), -INT_MAX*p.hw(), p.hw())); // #################################### - SNC_ray_shoter rs(*sncp()); - Object_handle o = rs.shot(ray); + SNC_ray_shooter rs(*sncp()); + Object_handle o = rs.shoot(ray); Vertex_handle v; Halfedge_handle e; Halffacet_handle f; @@ -435,6 +435,8 @@ create_box_corner(int x, int y, int z, bool space, bool boundary) const { // Creates the local graph of a facet f at point p. // Precondition is that p ist part of f. +#define CGAL_NEF3_BUGGY_CODE + template typename SNC_::Vertex_handle SNC_constructor:: @@ -549,17 +551,16 @@ pair_up_halfedges() const 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),"")); + TRACEN("search opposite "<first<< "\n " <<(debug_container(it->second),"")<< std::endl); typename Halfedge_list::iterator itl; CGAL_nef3_forall_iterators(itl,it->second) { Halfedge_handle e1 = itl->e; @@ -702,7 +703,7 @@ create_volumes() const V.increment_shell_number(); } /* 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 + shootting 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(); // outermost volume (nirvana) 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 d4403479310..d59b4d5d3c1 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/SNC_decorator.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/SNC_decorator.h @@ -38,7 +38,7 @@ #include #include #include -#include +#include #ifdef CGAL_NEF3_SM_VISUALIZOR #include #endif // CGAL_NEF3_SM_VISUALIZOR @@ -54,7 +54,7 @@ class SNC_decorator { typedef SNC_structure_ SNC_structure; typedef SNC_decorator Self; typedef SNC_constructor SNC_constructor; - typedef SNC_ray_shoter SNC_ray_shoter; + typedef SNC_ray_shooter SNC_ray_shooter; typedef SNC_SM_decorator SM_decorator; typedef SNC_SM_overlayer SM_overlayer; typedef SNC_SM_point_locator SM_point_locator; @@ -403,7 +403,7 @@ public: Halffacet_handle get_visible_facet( const Vertex_handle v, const Segment_3& ray) const - /*{\Mop when one shot a ray |ray| in order to find the facet below to + /*{\Mop when one shoot a ray |ray| in order to find the facet below to an object, and vertex |v| is hit, we need to choose one of the facets in the adjacency list of |v| such that it could be 'seen' from the piercing point of the |ray| on the sphere map on |v|. We make it just @@ -445,7 +445,7 @@ public: Halffacet_handle get_visible_facet( const Halfedge_handle e, const Segment_3& ray) const - /*{\Mop when one shot a ray |ray| in order to find the facet below to + /*{\Mop when one shoot a ray |ray| in order to find the facet below to an object, and an edge |e| is hit, we need to choose one of the two facets in the adjacency list of |e| that could be 'seen' from the piercing point of the |ray| on the local (virtual) view of |e| @@ -479,7 +479,7 @@ public: Halffacet_handle get_visible_facet( const Halffacet_handle f, const Segment_3& ray) const - /*{\Mop when one shot a ray |ray| in order to find the facet below to + /*{\Mop when one shoot a ray |ray| in order to find the facet below to an object, and a facet |f| is hit, we need to choose the right facet from the halffacet pair |f| that could be 'seen' from the piercing point of the |ray| on the local (virtual) view of |f|. @@ -497,6 +497,7 @@ public: Vertex_handle binop_local_views( Vertex_handle v0, Vertex_handle v1, const Selection& BOP, SNC_structure& rsnc) /*{\opOverlays two spheres maps.}*/ { + #ifdef CGAL_NEF3_DUMP_SPHERE_MAPS typedef SNC_SM_io_parser SNC_SM_io_parser; SNC_SM_io_parser IO0( std::cerr, v0); @@ -514,7 +515,7 @@ public: O.subdivide( v0, v1); O.select( BOP); O.simplify(); - // O.check_integrity_and_topological_planarity(); + O.check_integrity_and_topological_planarity(); #ifdef CGAL_NEF3_DUMP_SPHERE_MAPS TRACEN(" result sphere map:"); @@ -567,7 +568,7 @@ public: SNC_structure& P1i, SNC_structure& result) /*{\op }*/ { - SNC_ray_shoter rs(P1i); + SNC_ray_shooter rs(P1i); Vertex_handle v; Halfedge_handle e; Halffacet_handle f; @@ -619,6 +620,8 @@ public: O1.print(); #endif // CGAL_NEF3_DUMP_SNC_OPERATORS + // SETDTHREAD(131*19*43); + TRACEN("=> for all v0 in snc0, qualify v0 with respect snc1"); TRACEN("vertices on snc0:"); @@ -636,9 +639,8 @@ public: snc1i.number_of_vertices()<<' '<< result.number_of_vertices()); - //cerr << "Checkpoint SNC_d 1 " << std::endl; - CGAL_nef3_forall_vertices( v0, *sncp()) { + CGAL_nef3_assertion(!Ignore[v0]); v1 = qualify_with_respect( point(v0), snc1i, result); TRACEN("=> overlay of vertices v0 "<<&*v0<<" v1 "<<&*v1); @@ -648,16 +650,12 @@ public: else Ignore[v1] = true; - //cerr << "Checkpoint SNC_d 2 " << std::endl; - TRACEN("vertices on snc0 sn1 snc01: "<< sncp()->number_of_vertices()<<' '<< snc1i.number_of_vertices()<<' '<< result.number_of_vertices()); } - //cerr << "Checkpoint SNC_d 2c " << std::endl; - TRACEN("=> for all v1 in snc1, qualify v1 with respect snc0"); TRACEN("vertices on snc0:"); @@ -671,6 +669,7 @@ public: TRACEN("end vertices"< overlay of vertices v1 "<<&*v1<<" v0 "<<&*v0); @@ -683,9 +682,7 @@ public: snc1i.number_of_vertices()<<' '<< result.number_of_vertices()); } - - //cerr << "Checkpoint SNC_d 2d " << std::endl; - + TRACEN("=> edge facet intersection"); TRACEN("vertices on snc0:"); @@ -698,30 +695,50 @@ public: CGAL_nef3_forall_vertices( v0, result) TRACEN(point(v0)<<&*(v0->sncp_)); TRACEN("end vertices"< Ignore_halfedge(false); + CGAL_nef3_forall_halfedges( e0, *sncp()) { + TRACEN(PH(e0)); + if(!Ignore_halfedge[e0]) { + CGAL_nef3_forall_facets( f1, snc1i) { + Point_3 ip; + if( rs.does_intersect_internally( segment(e0), f1, ip )) { + TRACEN(" edge0 face1 intersection..."); + v0 = qualify_with_respect( ip, *sncp(), result); + v1 = qualify_with_respect( ip, snc1i, result); + binop_local_views( v0, v1, BOP, result); + result.delete_vertex(v0); + result.delete_vertex(v1); + Ignore_halfedge[twin(e0)]=true; + } } } } + CGAL_nef3_forall_edges( e1, snc1i) { CGAL_nef3_forall_facets( f0, *sncp()) { Point_3 ip; if( rs.does_intersect_internally( segment(e1), f0, ip )) { TRACEN(" edge1 face0 intersection..."); + + Halffacet_cycle_iterator it; + CGAL_nef3_forall_facet_cycles_of(it,f0){ + TRACEN("facet cycle"); + SHalfedge_handle es; + if ( assign(es,it)) { + SHalfedge_around_facet_circulator start(es), end(es); + CGAL_For_all(start,end) { + TRACEN("vertex " << PH(source(previous(start)))); + } + } + } + v1 = qualify_with_respect( ip, snc1i, result); v0 = qualify_with_respect( ip, *sncp(), result); + binop_local_views( v0, v1, BOP, result); result.delete_vertex(v0); result.delete_vertex(v1); @@ -752,9 +769,7 @@ public: SNC_io_parser O(std::cout, result); O.print(); #endif // CGAL_NEF3_DUMP_SNC_OPERATORS - - //cerr << "Checkpoint SNC_d 3 " << std::endl; - + // remove vertices whose local view is not that of a vertex Vertex_iterator vi, vin; for( vi = result.vertices_begin(); vi != result.vertices_end(); vi = vin) { @@ -771,7 +786,7 @@ public: mark(vi) == SD.mark(SD.svertices_begin()))) result.delete_vertex(vi); } - + // synthesis of spatial structure SNC_constructor C(result); C.pair_up_halfedges(); @@ -780,9 +795,6 @@ public: C.create_volumes(); result.simplify(); - - //cerr << "Checkpoint SNC_d 4 " << std::endl; - #ifdef CGAL_NEF3_DUMP_SNC_OPERATORS TRACEN("=> construction completed, result: "); SNC_io_parser Op(std::cout, result); 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 377f2166db7..695c251b157 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 @@ -244,6 +244,12 @@ namespace OGL { glNormal3dv(pu); } + inline void combineCallback(GLdouble coords[3], void *vertex_data[4], GLfloat weight[4], void **outData) + { + + *outData = vertex_data; + } + class Polyhedron { std::list vertices_; std::list edges_; @@ -320,6 +326,8 @@ namespace OGL { (GLvoid (*)()) &endCallback); gluTessCallback(tess_, GLenum(GLU_TESS_ERROR), (GLvoid (*)()) &errorCallback); + gluTessCallback(tess_, GLenum(GLU_TESS_COMBINE), + (GLvoid (*)()) &combineCallback); gluTessProperty(tess_, GLenum(GLU_TESS_WINDING_RULE), GLU_TESS_WINDING_POSITIVE); diff --git a/Packages/Nef_3/include/CGAL/Nef_3/debug.h b/Packages/Nef_3/include/CGAL/Nef_3/debug.h index 69779570c72..5c627f66187 100644 --- a/Packages/Nef_3/include/CGAL/Nef_3/debug.h +++ b/Packages/Nef_3/include/CGAL/Nef_3/debug.h @@ -27,6 +27,23 @@ #include + + +#ifndef CGAL_DEBUG_H +#define CGAL_DEBUG_H + +static int debugthread=1; + +template +void debug_container(const C& container, + std::ostream& os = std::cerr) +{ typename C::const_iterator it; + for(it = container.begin(); it != container.end(); ++it) + os << *it << std::endl; +} + +#endif //CGAL_DEBUG_H + #undef TRACE #undef TRACEN #undef TRACEV @@ -77,19 +94,5 @@ #define CTRACEN(b,t) #endif -#ifndef CGAL_DEBUG_H -#define CGAL_DEBUG_H - -static int debugthread=3141592; - -template -void debug_container(const C& container, - std::ostream& os = std::cerr) -{ typename C::const_iterator it; - for(it = container.begin(); it != container.end(); ++it) - os << *it << std::endl; -} - -#endif //CGAL_DEBUG_H diff --git a/Packages/Nef_3/include/CGAL/Nef_polyhedron_3.h b/Packages/Nef_3/include/CGAL/Nef_polyhedron_3.h index f1c205886b5..fb4b4c6450d 100644 --- a/Packages/Nef_3/include/CGAL/Nef_polyhedron_3.h +++ b/Packages/Nef_3/include/CGAL/Nef_polyhedron_3.h @@ -39,7 +39,7 @@ #include #include #include -#include +#include #ifdef CGAL_NEF3_VISUALIZOR #include #endif // CGAL_NEF3_VISUALIZOR @@ -82,7 +82,7 @@ class Nef_polyhedron_3_rep : public Ref_counted typedef CGAL::SNC_structure SNC_structure; typedef CGAL::SNC_decorator SNC_decorator; typedef CGAL::SNC_constructor SNC_constructor; - typedef CGAL::SNC_ray_shoter SNC_ray_shoter; + typedef CGAL::SNC_ray_shooter SNC_ray_shooter; typedef CGAL::SNC_io_parser SNC_io_parser; #ifdef CGAL_NEF3_VISUALIZOR @@ -151,7 +151,7 @@ protected: typedef typename Nef_rep::SNC_structure SNC_structure; typedef typename Nef_rep::SNC_decorator SNC_decorator; typedef typename Nef_rep::SNC_constructor SNC_constructor; - typedef typename Nef_rep::SNC_ray_shoter SNC_ray_shoter; + typedef typename Nef_rep::SNC_ray_shooter SNC_ray_shooter; typedef typename Nef_rep::SNC_io_parser SNC_io_parser; #ifdef CGAL_NEF3_VISUALIZOR @@ -252,6 +252,7 @@ protected: void build_external_structure() { SNC_constructor C(snc()); + // SETDTHREAD(43); C.pair_up_halfedges(); C.link_shalfedges_to_facet_cycles(); C.categorize_facet_cycles_and_create_facets(); @@ -299,30 +300,32 @@ public: class Visitor { - Object_index *VI; - Polyhedron_incremental_builder_3 *B; - SNC_decorator *D; + const Object_index& VI; + Polyhedron_incremental_builder_3& B; + SNC_decorator& D; public: - Visitor(Polyhedron_incremental_builder_3 *BB, - SNC_decorator *sd, - Object_index *vi) {B=BB; D=sd; VI=vi;} + Visitor(Polyhedron_incremental_builder_3& BB, + SNC_decorator& sd, + Object_index& vi) : VI(vi), D(sd), B(BB){} - void visit(Halffacet_handle f) { + void visit(Halffacet_handle opposite_facet) { SHalfedge_handle se; Halffacet_cycle_iterator fc; - B->begin_facet(); + Halffacet_handle f = D.twin(opposite_facet); + + B.begin_facet(); fc = f->facet_cycles_begin(); assign(se,fc); CGAL_assertion(se!=0); SHalfedge_around_facet_circulator hc_start(se); SHalfedge_around_facet_circulator hc_end(hc_start); CGAL_For_all(hc_start,hc_end) { - B->add_vertex_to_facet((*VI)[D->vertex(hc_start)]); + B.add_vertex_to_facet(VI[D.vertex(hc_start)]); } - B->end_facet(); + B.end_facet(); } void visit(SFace_handle s) {} @@ -360,7 +363,7 @@ public: int outer_volume = 0; Shell_entry_iterator it; - Visitor V(&B,&D,&VI); + Visitor V(B,D,VI); Volume_handle c; CGAL_nef3_forall_volumes(c,snc) { if(outer_volume++ > 1)