From 6fa6923a58aa31d689fea09e79364a0e349ab513 Mon Sep 17 00:00:00 2001 From: Miguel Granados Date: Thu, 23 Oct 2003 11:34:15 +0000 Subject: [PATCH] undo of 1.42 (mistaken) revision --- .../Nef_3/include/CGAL/Nef_polyhedron_3.h | 107 ++++++++++++------ 1 file changed, 74 insertions(+), 33 deletions(-) diff --git a/Packages/Nef_3/include/CGAL/Nef_polyhedron_3.h b/Packages/Nef_3/include/CGAL/Nef_polyhedron_3.h index eb5c71a890c..740a5bf8efc 100644 --- a/Packages/Nef_3/include/CGAL/Nef_polyhedron_3.h +++ b/Packages/Nef_3/include/CGAL/Nef_polyhedron_3.h @@ -236,19 +236,19 @@ protected: void initialize_infibox_vertices(Content space) { SNC_constructor C(snc()); - Infi_box::initialize_infibox_vertices(C, space==COMPLETE); + Infi_box::initialize_infibox_vertices(C, space == COMPLETE); } void initialize_simple_cube_vertices(Content space) { SNC_constructor C(snc()); - C.create_box_corner( INT_MAX, INT_MAX, INT_MAX, space ); - C.create_box_corner(-INT_MAX, INT_MAX, INT_MAX, space ); - C.create_box_corner( INT_MAX,-INT_MAX, INT_MAX, space ); - C.create_box_corner(-INT_MAX,-INT_MAX, INT_MAX, space ); - C.create_box_corner( INT_MAX, INT_MAX,-INT_MAX, space ); - C.create_box_corner(-INT_MAX, INT_MAX,-INT_MAX, space ); - C.create_box_corner( INT_MAX,-INT_MAX,-INT_MAX, space ); - C.create_box_corner(-INT_MAX,-INT_MAX,-INT_MAX, space ); + C.create_extended_box_corner( 1, 1, 1, space == COMPLETE); + C.create_extended_box_corner(-1, 1, 1, space == COMPLETE); + C.create_extended_box_corner( 1,-1, 1, space == COMPLETE); + C.create_extended_box_corner(-1,-1, 1, space == COMPLETE); + C.create_extended_box_corner( 1, 1,-1, space == COMPLETE); + C.create_extended_box_corner(-1, 1,-1, space == COMPLETE); + C.create_extended_box_corner( 1,-1,-1, space == COMPLETE); + C.create_extended_box_corner(-1,-1,-1, space == COMPLETE); } /* @@ -354,7 +354,7 @@ public: OK = OK && in; OK = OK && snc().load(in); if(!OK) - std::cerr << "Failure while loading data" << std::endl; + std::cerr << "Failure while loading data" << std::endl; } template @@ -575,6 +575,18 @@ public: void simplify() { snc().simplify(); } + + template< class Selection > + Nef_polyhedron_3 bin_op( Nef_polyhedron_3& N1, + const Selection& BOP, + binop_intersection_tests& tests_impl ) + { + SNC_structure rsnc; + SNC_decorator D(snc()); + D.binary_operation( N1.snc(), BOP, rsnc, tests_impl ); + return Nef_polyhedron_3 (rsnc); + } public: void extract_complement(); @@ -639,14 +651,47 @@ public: return res; } - Nef_polyhedron_3 intersection(Nef_polyhedron_3& N1) + Nef_polyhedron_3 + intersection(Nef_polyhedron_3& N1, + CGAL::binop_intersection_tests& tests_impl ) + { + TRACEN(" intersection between nef3 "<<&*this<<" and "<<&N1); + return bin_op( N1, AND(), tests_impl ); + } + + Nef_polyhedron_3 + join(Nef_polyhedron_3& N1, + CGAL::binop_intersection_tests& tests_impl ) + { + TRACEN(" join between nef3 "<<&*this<<" and "<<&N1); + return bin_op( N1, OR(), tests_impl ); + } + + Nef_polyhedron_3 + difference(Nef_polyhedron_3& N1, + CGAL::binop_intersection_tests& tests_impl ) + { + TRACEN(" difference between nef3 "<<&*this<<" and "<<&N1); + return bin_op( N1, DIFF(), tests_impl ); + } + + Nef_polyhedron_3 + symmetric_difference(Nef_polyhedron_3& N1, + CGAL::binop_intersection_tests& tests_impl ) + { + TRACEN(" symmetric difference between nef3 "<<&*this<<" and "<<&N1); + return bin_op( N1, XOR(), tests_impl ); + } + + Nef_polyhedron_3 intersection(Nef_polyhedron_3& N1 ) /*{\Mop returns |\Mvar| $\cap$ |N1|. }*/ { - TRACEN(" intersection between nef3 "<<&*this<<" and "<<&N1); AND _and; + CGAL::binop_intersection_tests_allpairs tests_impl; SNC_structure rsnc; SNC_decorator D(snc()); - D.binary_operation( N1.snc(), _and, rsnc); + D.binary_operation( N1.snc(), _and, rsnc, tests_impl ); Nef_polyhedron_3 res(rsnc); // res.clear_box_marks(); return res; @@ -656,9 +701,10 @@ public: /*{\Mop returns |\Mvar| $\cup$ |N1|. }*/ { TRACEN(" join between nef3 "<<&*this<<" and "<<&N1); OR _or; + CGAL::binop_intersection_tests_allpairs tests_impl; SNC_structure rsnc; SNC_decorator D(snc()); - D.binary_operation( N1.snc(), _or, rsnc); + D.binary_operation( N1.snc(), _or, rsnc, tests_impl); Nef_polyhedron_3 res(rsnc); // res.clear_box_marks(); return res; @@ -668,9 +714,10 @@ public: /*{\Mop returns |\Mvar| $-$ |N1|. }*/ { TRACEN(" difference between nef3 "<<&*this<<" and "<<&N1); DIFF _diff; + CGAL::binop_intersection_tests_allpairs tests_impl; SNC_structure rsnc; SNC_decorator D(snc()); - D.binary_operation( N1.snc(), _diff, rsnc); + D.binary_operation( N1.snc(), _diff, rsnc, tests_impl); Nef_polyhedron_3 res(rsnc); // res.clear_box_marks(); return res; @@ -681,14 +728,16 @@ public: |T - \Mvar|. }*/ { TRACEN(" symmetic difference between nef3 "<<&*this<<" and "<<&N1); XOR _xor; + CGAL::binop_intersection_tests_allpairs tests_impl; SNC_structure rsnc; SNC_decorator D(snc()); - D.binary_operation( N1.snc(), _xor, rsnc); + D.binary_operation( N1.snc(), _xor, rsnc, tests_impl); Nef_polyhedron_3 res(rsnc); // res.clear_box_marks(); return res; } + /*{\Mtext Additionally there are operators |*,+,-,^,!| which implement the binary operations \emph{intersection}, \emph{union}, \emph{difference}, \emph{symmetric difference}, and the unary @@ -920,8 +969,12 @@ template Nef_polyhedron_3:: Nef_polyhedron_3(Content space) : Base(Nef_rep()) { TRACEN("construction from empty or space."); - initialize_simple_cube_vertices(space); - build_external_structure(); + if(Infi_box::extended_Kernel()) { + SNC_constructor C(snc()); + Infi_box::initialize_infibox_vertices(C,space == COMPLETE); + // initialize_simple_cube_vertices(space); + build_external_structure(); + } } template @@ -975,24 +1028,13 @@ void Nef_polyhedron_3::extract_interior() { SNC_decorator D(snc()); Vertex_iterator v; CGAL_nef3_forall_vertices(v,D){ - // if(Infi_box::is_standard(v->point())) { - D.mark(v) = false; - SM_decorator SM(v); - SM.extract_interior(); - // } + D.mark(v) = false; + SM_decorator SM(v); + SM.extract_interior(); } Halffacet_iterator f; CGAL_nef3_forall_facets(f,D) D.mark(f) = false; - /* - int count = 0; - Volume_iterator c; - CGAL_nef3_forall_volumes(c,D) { - count++; - if(count > 2) D.mark(c) = true; - } - */ - simplify(); } @@ -1012,7 +1054,6 @@ void Nef_polyhedron_3::extract_boundary() { CGAL_nef3_forall_facets(f,D) D.mark(f) = true; Volume_iterator c; CGAL_nef3_forall_volumes(c,D) D.mark(c) = false; - // clear_box_marks(); simplify(); }