diff --git a/.gitattributes b/.gitattributes index 04d1209d655..4a944195231 100644 --- a/.gitattributes +++ b/.gitattributes @@ -440,6 +440,7 @@ Arrangement_of_spheres_3/demo/Arrangement_of_spheres_3/data/problem.spheres -tex Arrangement_of_spheres_3/demo/Arrangement_of_spheres_3/data/really_simple.spheres -text Arrangement_of_spheres_3/demo/Arrangement_of_spheres_3/data/simple.spheres -text Arrangement_of_spheres_3/demo/Arrangement_of_spheres_3/data/two.spheres -text +Arrangement_of_spheres_3/demo/Arrangement_of_spheres_3/interactive_point_location.cpp -text Arrangement_of_spheres_3/demo/Arrangement_of_spheres_3/show_circles.cpp -text Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3.h -text Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Arrangement_of_spheres_3_impl.h -text diff --git a/Arrangement_of_spheres_3/demo/Arrangement_of_spheres_3/compute_slice.cpp b/Arrangement_of_spheres_3/demo/Arrangement_of_spheres_3/compute_slice.cpp index cfdf47ccb93..77902b6a0b3 100644 --- a/Arrangement_of_spheres_3/demo/Arrangement_of_spheres_3/compute_slice.cpp +++ b/Arrangement_of_spheres_3/demo/Arrangement_of_spheres_3/compute_slice.cpp @@ -33,8 +33,8 @@ struct Compute_slice { arr.initialize_at(z_,cs); typedef typename CGAL_AOS3_INTERNAL_NS::Cross_section_qt_viewer CGAL_AOS3_TARG CSV; - CSV csv(tr, cs, qtv); - csv(z_); + CSV csv(tr, cs); + csv(z_, qtv); } std::vector spheres_; diff --git a/Arrangement_of_spheres_3/demo/Arrangement_of_spheres_3/interactive_point_location.cpp b/Arrangement_of_spheres_3/demo/Arrangement_of_spheres_3/interactive_point_location.cpp new file mode 100644 index 00000000000..b4b5fcfd03d --- /dev/null +++ b/Arrangement_of_spheres_3/demo/Arrangement_of_spheres_3/interactive_point_location.cpp @@ -0,0 +1,131 @@ +#define CGAL_CHECK_EXPENSIVE +#define CGAL_CHECK_EXACTNESS + +#include +#include +#include +#include +#include +#include +#include +#include + + +template +struct Do_work { + Do_work(const std::vector &ss, double z): + spheres_(ss), z_(z){} + + void operator()(CGAL::Qt_examiner_viewer_2 *q){ + typedef typename A::Traits::Geom_traits K; + typedef typename A::Traits Traits_t; + typedef typename K::Point_3 P; + typedef typename K::Sphere_3 S; + + CGAL_AOS3_INTERNAL_NS::Unprojector up(z_); + + std::vector ns; + for (unsigned int i=0; i< spheres_.size(); ++i) { + ns.push_back(S(P(spheres_[i].center().x(), + spheres_[i].center().y(), + spheres_[i].center().z()), + spheres_[i].squared_radius())); + std::cout << ns.back() << std::endl; + } + + typename A::Traits tr(ns.begin(), ns.end()); + A arr(tr); + typename A::Cross_section cs(tr.number_of_sphere_3s()); + arr.initialize_at(z_,cs); + + typedef typename CGAL_AOS3_INTERNAL_NS::Cross_section_qt_viewer CGAL_AOS3_TARG CSV; + CSV csv(tr, cs); + + + *q << CGAL::Layer(0); + csv(z_, q); + + q->show_everything(); + //q->redraw(); + + + typedef typename CGAL_AOS3_INTERNAL_NS::Irrational_cross_section CGAL_AOS3_TARG ICS; + ICS ics(tr, cs, z_); + + typedef typename CGAL_AOS3_INTERNAL_NS::Cross_section_qt_viewer_markup CGAL_AOS3_TARG MCSV; + MCSV mcsv(tr, cs, CGAL::Layer(1)); + + while (true) { + std::cout << "Enter coordinates: " << std::flush; + char buf[1000]; + std::cin.getline(buf,1000); + if (buf[0]== '\0') { + std::cout << "bye." << std::endl; + break; + } + mcsv.clear(); + + double x,y; + std::istringstream iss(buf); + iss >> x >> y; + if (!iss) { + std::cerr << "Can't parse line." << std::endl; + } else { + *q << CGAL::Layer(2); + *q << CGAL::RED; + *q << typename K::Point_2(x,y); + //q->redraw(); + typename A::Traits::Sphere_point_3 sp(up(typename K::Point_2(x,y)), + typename K::Line_3(up(typename K::Point_2(x,y)), + CGAL_AOS3_INTERNAL_NS::Sweep_coordinate::basis_3())); + try { + typename A::Cross_section::Face_const_handle f= ics.locate_point(sp); + //slice.new_marked_face(f); + std::cout << "Found face "; + cs.write(f, std::cout) << std::endl; + mcsv.new_face(f); + + } catch (ICS::On_edge_exception e) { + std::cout << "On edge!" < spheres_; + double z_; + +}; + + +int main(int argc, char *argv[]){ +#ifdef CGAL_AOS3_USE_TEMPLATES + typedef CGAL::Simple_cartesian K; + typedef CGAL::Arrangement_of_spheres_traits_3 Traits; + typedef CGAL::Arrangement_of_spheres_3 Arrangement; +#else + typedef CGAL::Arrangement_of_spheres_3 Arrangement; +#endif + + std::vector spheres; + + std::ifstream in(argv[2]); + + CGAL_AOS3_INTERNAL_NS::read_spheres(in, spheres); + + double z=std::atof(argv[1]); + + typedef Do_work CS; + CS cs(spheres, z); + + CGAL::Qt_multithreaded_examiner_viewer_2 qtv(cs, argc, argv); + + + return qtv(); +} diff --git a/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Arrangement_of_spheres_traits_3_impl.h b/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Arrangement_of_spheres_traits_3_impl.h index b43a8f3c4fe..a990b977289 100644 --- a/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Arrangement_of_spheres_traits_3_impl.h +++ b/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Arrangement_of_spheres_traits_3_impl.h @@ -51,5 +51,145 @@ Arrangement_of_spheres_traits_3 CGAL_AOS3_TARG::sphere_events(Sphere_3_key ind) Line_3(table_->center(ind), Vector_3(-v[0], -v[1], -v[2])))); } +CGAL_AOS3_TEMPLATE + CGAL::Bounded_side +Arrangement_of_spheres_traits_3 CGAL_AOS3_TARG::bounded_side_of_sphere(Sphere_3_key s, + const Sphere_point_3 &z) const{ + /*FT p[3]; + p[plane_coordinate(0).index()]= table_->center(x)[plane_coordinate(0).index()]; + p[plane_coordinate(1).index()]= table_->center(y)[plane_coordinate(1).index()]; + p[sweep_coordinate().index()]=0; + FT v[3]; + v[plane_coordinate(0).index()]=0; + v[plane_coordinate(1).index()]=0; + v[sweep_coordinate().index()]=1;*/ + Line_3 l= z.line();//(Point_3(p[0], p[1], p[2]), Vector_3(v[0],v[1],v[2])); + + Sphere_point_3 p0(table_->sphere(s), l); + if (!p0.is_valid()) { + return CGAL::ON_UNBOUNDED_SIDE; + } else { + Sphere_point_3 p1(table_->sphere(s), + l.opposite()); + CGAL::Comparison_result c0= compare_depths(p0, z); + CGAL::Comparison_result c1= compare_depths(p1, z); + if (c0 == CGAL::EQUAL || c1== CGAL::EQUAL) { + //std::cout << "Equal" << std::endl; + return CGAL::ON_BOUNDARY; + } + //CGAL_assertion(p0 <= p1); + if (c0== CGAL::SMALLER && c1 == CGAL::LARGER){ + return CGAL::ON_BOUNDED_SIDE; + } else { + return CGAL::ON_UNBOUNDED_SIDE; + } + } +} + + + +CGAL_AOS3_TEMPLATE +CGAL::Bounded_side +Arrangement_of_spheres_traits_3 CGAL_AOS3_TARG::bounded_side_of_sphere(Sphere_3_key s, + Sphere_3_key x, + Sphere_3_key y, + const Sphere_point_3 &z) const { + FT p[3]; + p[CGAL_AOS3_INTERNAL_NS::plane_coordinate(0).index()]= table_->center(x)[CGAL_AOS3_INTERNAL_NS::plane_coordinate(0).index()]; + p[CGAL_AOS3_INTERNAL_NS::plane_coordinate(1).index()]= table_->center(y)[CGAL_AOS3_INTERNAL_NS::plane_coordinate(1).index()]; + p[CGAL_AOS3_INTERNAL_NS::sweep_coordinate().index()]=0; + FT v[3]; + v[CGAL_AOS3_INTERNAL_NS::plane_coordinate(0).index()]=0; + v[CGAL_AOS3_INTERNAL_NS::plane_coordinate(1).index()]=0; + v[CGAL_AOS3_INTERNAL_NS::sweep_coordinate().index()]=1; + Line_3 l(Point_3(p[0], p[1], p[2]), Vector_3(v[0],v[1],v[2])); + + Sphere_point_3 p0(table_->sphere(s), l); + + if (!p0.is_valid()) { + return CGAL::ON_UNBOUNDED_SIDE; + } else { + Sphere_point_3 p1(table_->sphere(s), + l.opposite()); + CGAL::Comparison_result c0= compare_depths(p0, z); + CGAL::Comparison_result c1= compare_depths(p1, z); + if (c0 == CGAL::EQUAL || c1== CGAL::EQUAL) { + //std::cout << "Equal" << std::endl; + return CGAL::ON_BOUNDARY; + } + //CGAL_assertion(p0 <= p1); + if (c0== CGAL::SMALLER && c1 == CGAL::LARGER){ + return CGAL::ON_BOUNDED_SIDE; + } else { + return CGAL::ON_UNBOUNDED_SIDE; + } + } +} + + +CGAL_AOS3_TEMPLATE +bool +Arrangement_of_spheres_traits_3 CGAL_AOS3_TARG::is_over_circle_c(Sphere_3_key s, + const Sphere_point_3& z, + Coordinate_index C) const { + Line_3 l= z.line(); + FT p[3], v[3]; + for (unsigned int i=0; i< 3; ++i) { + p[i]= l.point()[i]; + v[i]= l.to_vector()[i]; + } + Coordinate_index oc= CGAL_AOS3_INTERNAL_NS::other_plane_coordinate(C); + p[oc.index()]= table_->center(s)[oc.index()]; + v[oc.index()]= 0; + Line_3 nl=Line_3(Point_3(p[0], p[1], p[2]),Vector_3(v[0], v[1], v[2])); + Sphere_point_3 sp(table_->sphere(s), nl); + if (!sp.is_valid()) return false; + else { + Sphere_point_3 spo(table_->sphere(s), nl.opposite()); + CGAL::Comparison_result c= sp.compare(z, CGAL_AOS3_INTERNAL_NS::sweep_coordinate()); + CGAL::Comparison_result co= spo.compare(z, CGAL_AOS3_INTERNAL_NS::sweep_coordinate()); + if (co == c) return true; + else return false; + } +} + +CGAL_AOS3_TEMPLATE +CGAL::Oriented_side +Arrangement_of_spheres_traits_3 CGAL_AOS3_TARG::oriented_side_of_separating_plane(Sphere_3_key a, + Sphere_3_key b, + const Sphere_point_3& ep) const { + Plane_3 sp= table_->separating_plane(a,b); + return oriented_side(sp, ep); +} + + +CGAL_AOS3_TEMPLATE +CGAL::Comparison_result +Arrangement_of_spheres_traits_3 CGAL_AOS3_TARG::compare_depths(const Sphere_point_3 &a, + const Sphere_point_3 &b) const{ + return a.compare(b, CGAL_AOS3_INTERNAL_NS::sweep_coordinate()); +} + + +CGAL_AOS3_TEMPLATE +CGAL::Oriented_side +Arrangement_of_spheres_traits_3 CGAL_AOS3_TARG::oriented_side(const Plane_3 &p, + const Sphere_point_3 &s) const{ + CGAL::Object o= geom_traits_object().intersect_3_object()(p, s.line()); + Point_3 pt; + Line_3 l; + if (CGAL::assign(pt, o)){ + CGAL::Comparison_result c= s.compare_on_line(pt); + CGAL::Sign sn= CGAL::sign(p.orthogonal_vector() * s.line().to_vector()); + if (sn ==CGAL::POSITIVE) return CGAL::enum_cast(c); + else return CGAL::enum_cast(-c); + } else if (CGAL::assign( l, o)){ + return CGAL::ON_ORIENTED_BOUNDARY; + } else { + return p.oriented_side(s.line().point()); + } +} + + CGAL_END_NAMESPACE diff --git a/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Combinatorial_cross_section.h b/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Combinatorial_cross_section.h index 399dc734399..dfc77dcf823 100644 --- a/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Combinatorial_cross_section.h +++ b/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Combinatorial_cross_section.h @@ -132,7 +132,7 @@ public: std::ostream &write(Halfedge_const_handle h, std::ostream &out) const; - std::ostream &write_face(Halfedge_const_handle h, std::ostream &out) const; + std::ostream &write(Face_const_handle h, std::ostream &out) const; bool is_in_slice(Vertex_const_handle v) const; bool is_in_slice(Halfedge_const_handle h) const; diff --git a/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Combinatorial_cross_section_impl.h b/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Combinatorial_cross_section_impl.h index 0320604a706..150fa56e01c 100644 --- a/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Combinatorial_cross_section_impl.h +++ b/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Combinatorial_cross_section_impl.h @@ -155,13 +155,13 @@ Combinatorial_cross_section CGAL_AOS3_TARG::split_face(Curve c, CGAL_precondition(o->face() == d->face()); std::cout << "Spliting face "; - write_face(o, std::cout) << std::endl; + write(o->face(), std::cout) << std::endl; CGAL::HalfedgeDS_decorator hdsd(hds_); Halfedge_handle h= hdsd.split_face(o,d); set_curve(h, c); std::cout << "Got "; - write_face(h, std::cout) << " and "; - write_face(h->opposite(), std::cout) << std::endl; + write(h->face(), std::cout) << " and "; + write(h->opposite()->face(), std::cout) << std::endl; return h; } @@ -210,8 +210,8 @@ CGAL_AOS3_TEMPLATE void Combinatorial_cross_section CGAL_AOS3_TARG::merge_faces(Halfedge_handle h) { std::cout << "Merging faces "; - write_face(h, std::cout) << " and "; - write_face(h->opposite(), std::cout) << std::endl; + write(h->face(), std::cout) << " and "; + write(h->opposite()->face(), std::cout) << std::endl; CGAL_precondition(degree(h->vertex()) >=3); CGAL_precondition(degree(h->opposite()->vertex()) >=3); @@ -228,7 +228,7 @@ Combinatorial_cross_section CGAL_AOS3_TARG::merge_faces(Halfedge_handle h) { dec.join_face(h); std::cout << "Got face "; - write_face(f->halfedge(), std::cout) << std::endl; + write(f->halfedge()->face(), std::cout) << std::endl; std::cout << "And edge "; write(sh, std::cout); std::cout << " and "; @@ -492,9 +492,9 @@ Combinatorial_cross_section CGAL_AOS3_TARG::new_circle(Curve::Key k, Face_handle } std::cout << "done." << std::endl; std::cout << "Outside: "; - write_face(vs[0], std::cout) << std::endl; + write(vs[0]->face(), std::cout) << std::endl; std::cout << "Inside: "; - write_face(ivs[0], std::cout) << std::endl; + write(ivs[0]->face(), std::cout) << std::endl; if (0) { std::cout << "Auditing const decorator..." << std::flush; @@ -562,10 +562,10 @@ Combinatorial_cross_section CGAL_AOS3_TARG::new_target(Curve::Key k, dec.set_face_in_face_loop(c[i], ft[i]); ft[i]->set_halfedge(c[i]); } - write_face(c[0], std::cout) << std::endl; - write_face(c[1], std::cout) << std::endl; - write_face(c[2], std::cout) << std::endl; - write_face(c[3], std::cout) << std::endl; + write(c[0]->face(), std::cout) << std::endl; + write(c[1]->face(), std::cout) << std::endl; + write(c[2]->face(), std::cout) << std::endl; + write(c[3]->face(), std::cout) << std::endl; std::cout << "Auditing const decorator..." << std::flush; CGAL::HalfedgeDS_const_decorator chds(hds_); @@ -613,7 +613,7 @@ Combinatorial_cross_section CGAL_AOS3_TARG::insert_target(Curve::Key k, Face_handle old_face= vs[0]->face(); std::cout << "Inserting into "; - write_face(vs[0], std::cout) << std::endl; + write(vs[0]->face(), std::cout) << std::endl; for (unsigned int i=0; i< 4; ++i){ std::cout << i << " is " << vs[i]->curve() << "--" << vs[i]->vertex()->point() @@ -633,7 +633,7 @@ Combinatorial_cross_section CGAL_AOS3_TARG::insert_target(Curve::Key k, std::cout << "Got:" << std::endl; for (unsigned int i=0; i< 4; ++i) { - write_face(vs[i], std::cout) << std::endl; + write(vs[i]->face(), std::cout) << std::endl; } CGAL::HalfedgeDS_items_decorator dec; @@ -730,7 +730,7 @@ Combinatorial_cross_section CGAL_AOS3_TARG::remove_target(Halfedge_handle ts[4], CGAL::HalfedgeDS_items_decorator dec; dec.set_face_in_face_loop(out, f); std::cout << "Got face "; - write_face(out, std::cout) << std::endl; + write(out->face(), std::cout) << std::endl; { Vertex_handle rv= new_vertex(Point::make_special(Curve::Key::target_key())); @@ -1098,9 +1098,9 @@ std::ostream &Combinatorial_cross_section CGAL_AOS3_TARG::write(Halfedge_const_h CGAL_AOS3_TEMPLATE -std::ostream &Combinatorial_cross_section CGAL_AOS3_TARG::write_face(Halfedge_const_handle h, - std::ostream &out) const { - Halfedge_const_handle e= h; +std::ostream &Combinatorial_cross_section CGAL_AOS3_TARG::write(Face_const_handle f, + std::ostream &out) const { + Halfedge_const_handle e= f->halfedge(), h= f->halfedge(); do { out << h->curve() << "--" << h->vertex()->point() << "--" << std::flush; h=h->next(); diff --git a/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Coordinate_index.h b/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Coordinate_index.h index afa0e81723b..81b7a1d6c3a 100644 --- a/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Coordinate_index.h +++ b/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Coordinate_index.h @@ -1,6 +1,6 @@ #ifndef CGAL_SPHERE_COORDINATE_H #define CGAL_SPHERE_COORDINATE_H -#include +//#include #include @@ -155,5 +155,38 @@ inline Point sweep_point(NT n) { return Point(v[0], v[1], v[2]); } +template +class Unprojector { + typename K::FT z_; +public: + Unprojector(typename K::FT z): z_(z){} + + typename K::Point_3 operator()(const typename K::Point_2 &pt) const { + typename K::FT v[3]; + v[Sweep_coordinate::index()]= z_; + v[Plane_coordinate_0::index()]= pt.x(); + v[Plane_coordinate_1::index()]= pt.y(); + return typename K::Point_3(v[0], v[1], v[2]); + } + + typename K::Vector_3 operator()(const typename K::Vector_2 &pt) const { + typename K::FT v[3]; + v[Sweep_coordinate::index()]= 0; + v[Plane_coordinate_0::index()]= pt.x(); + v[Plane_coordinate_1::index()]= pt.y(); + return typename K::Vector_3(v[0], v[1], v[2]); + } + typename K::Point_2 operator()(const typename K::Point_3 &pt) const { + return typename K::Point_2(pt[Plane_coordinate_0::index()], + pt[Plane_coordinate_1::index()]); + } + + typename K::Vector_2 operator()(const typename K::Vector_3 &pt) const { + return typename K::Vector_2(pt[Plane_coordinate_0::index()], + pt[Plane_coordinate_1::index()]); + } + +}; + CGAL_AOS3_END_INTERNAL_NAMESPACE #endif diff --git a/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Cross_section_qt_viewer.h b/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Cross_section_qt_viewer.h index ba4112adcc1..71c31f5b85e 100644 --- a/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Cross_section_qt_viewer.h +++ b/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/Cross_section_qt_viewer.h @@ -14,17 +14,16 @@ class Cross_section_qt_viewer { typedef CGAL::Simple_cartesian K; public: typedef CGAL_AOS3_TYPENAME Traits::FT NT; - Cross_section_qt_viewer(Traits tr, const CS &cs, Qt_examiner_viewer_2 *qtv): tr_(tr), + Cross_section_qt_viewer(Traits tr, const CS &cs): tr_(tr), cs_(cs), - rcs_(cs, tr_), - qtv_(qtv){} + rcs_(cs, tr_){} - void operator()(NT z) { + void operator()(NT z, Qt_examiner_viewer_2 *qtv) { rcs_.set_z(z); //t_.set_temp_sphere(T::Sphere_3(T::Point_3(0,0,z), 0)); - *qtv_ << CGAL::RED; - qtv_->set_updating_box(true); + *qtv << CGAL::RED; + qtv->set_updating_box(true); //T::Intersect_with_sweep is=t_.sphere_intersects_rule(z); @@ -38,8 +37,8 @@ public: c2= T::Circle_2(c2.center(), c2.squared_radius()*NT(.99)); } if (t_.sphere(*sit).center().z() != z){ - *qtv_ << CGAL::YELLOW; - *qtv_ << c2; + *qtv << CGAL::YELLOW; + *qtv << c2; } } }*/ @@ -48,28 +47,28 @@ public: hit != cs_.halfedges_end(); ++hit){ if (hit->curve().key().is_target()) continue; if (hit->curve().is_rule() && hit->curve().is_inside()){ - qtv_->set_updating_box(false); + qtv->set_updating_box(false); std::cout << "Displaying rule " << hit->curve() << std::endl; CGAL_AOS3_TYPENAME K::Point_2 t= display_point(hit->vertex()->point()); CGAL_AOS3_TYPENAME K::Point_2 s= display_point(hit->opposite()->vertex()->point()); - *qtv_ << CGAL::GRAY; - *qtv_ << CGAL_AOS3_TYPENAME K::Segment_2(t,s); + *qtv << CGAL::GRAY; + *qtv << CGAL_AOS3_TYPENAME K::Segment_2(t,s); } else if (hit->curve().is_arc() && hit->curve().is_inside()){ - qtv_->set_updating_box(true); + qtv->set_updating_box(true); std::cout << "Displaying arc " << hit->curve() << std::endl; CGAL_AOS3_TYPENAME K::Point_2 t= display_point(hit->vertex()->point()); CGAL_AOS3_TYPENAME K::Point_2 s= display_point(hit->opposite()->vertex()->point()); //DT::Circle_2 c= ; if (tr_.compare_sphere_center_c(hit->curve().key(), z, sweep_coordinate())== CGAL::LARGER) { - *qtv_ << CGAL::Color(150,50,50); + *qtv << CGAL::Color(150,50,50); } else { - *qtv_ << CGAL::Color(50,150,50); + *qtv << CGAL::Color(50,150,50); } CGAL_AOS3_TYPENAME Traits::Circle_2 c2= rcs_.circle(hit->curve().key()); - qtv_->new_circular_arc(c2, s, t); + qtv->new_circular_arc(c2, s, t); } } @@ -78,13 +77,13 @@ public: hit != cs_.vertices_end(); ++hit){ if (!cs_.is_in_slice(hit)) continue; CGAL_AOS3_TYPENAME K::Point_2 p= display_point(hit->point()); - *qtv_ << CGAL::BLUE; + *qtv << CGAL::BLUE; if (hit->point().is_finite()) { - qtv_->set_updating_box(true); + qtv->set_updating_box(true); } else { - qtv_->set_updating_box(false); + qtv->set_updating_box(false); } - *qtv_ << p; + *qtv << p; std::ostringstream out; out << hit->point(); @@ -105,28 +104,28 @@ public: }*/ //out << hit->point().first() << ":" << hit->point().second(); - *qtv_ << CGAL::GRAY; - *qtv_ << out.str().c_str(); + *qtv << CGAL::GRAY; + *qtv << out.str().c_str(); } /* - *qtv_ << CGAL::Color(255, 155, 155); + *qtv << CGAL::Color(255, 155, 155); for (CGAL_AOS3_TYPENAME Intersections_2::const_iterator it= intersections_2_.begin(); it != intersections_2_.end(); ++it) { if (it->second.first != Event_key()) { T::Event_point_3 ep= sim_->event_time(it->second.first); DT::Point_2 dp(ep.approximate_coordinate(plane_coordinate(0)), ep.approximate_coordinate(plane_coordinate(1))); - *qtv_ << dp; + *qtv << dp; } if (it->second.second != Event_key()) { T::Event_point_3 ep= sim_->event_time(it->second.second); DT::Point_2 dp(ep.approximate_coordinate(plane_coordinate(0)), ep.approximate_coordinate(plane_coordinate(1))); - *qtv_ << dp; + *qtv << dp; } } - *qtv_ << CGAL::Color(255, 255, 255); + *qtv << CGAL::Color(255, 255, 255); for (Intersections_3::const_iterator it= intersections_3_.begin(); it != intersections_3_.end(); ++it) { if (it->second.second != Event_key()) { @@ -134,13 +133,13 @@ public: T::Event_point_3 ep= sim_->event_time(it->second.second); DT::Point_2 dp(ep.approximate_coordinate(plane_coordinate(0)), ep.approximate_coordinate(plane_coordinate(1))); - *qtv_ << dp; + *qtv << dp; } { T::Event_point_3 ep= sim_->event_time(it->second.second); DT::Point_2 dp(ep.approximate_coordinate(plane_coordinate(0)), ep.approximate_coordinate(plane_coordinate(1))); - *qtv_ << dp; + *qtv << dp; } } } @@ -168,7 +167,6 @@ private: Traits tr_; const CS &cs_; RCS rcs_; - Qt_examiner_viewer_2 *qtv_; }; CGAL_AOS3_END_INTERNAL_NAMESPACE diff --git a/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/read_spheres.h b/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/read_spheres.h index cbfee786f7e..d3e6a5d61b9 100644 --- a/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/read_spheres.h +++ b/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_3/read_spheres.h @@ -17,8 +17,8 @@ void read_spheres(std::istream &in, std::vector &out) { while (true){ char buf[1000]; - std::cin.getline(buf, 1000); - if (!std::cin) break; + in.getline(buf, 1000); + if (!in) break; { std::istringstream iss(buf); if (buf[0]=='#') continue; diff --git a/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_traits_3.h b/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_traits_3.h index 4ff58fd4527..1c10562afe8 100644 --- a/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_traits_3.h +++ b/Arrangement_of_spheres_3/include/CGAL/Arrangement_of_spheres_traits_3.h @@ -151,10 +151,10 @@ struct Arrangement_of_spheres_traits_3 { CGAL::Oriented_side oriented_side_of_equipower_plane(Key sphere_0, Key sphere_1, const Sphere_point_3 &s) const; - + */ CGAL::Oriented_side oriented_side_of_separating_plane(Sphere_3_key sphere_0, Sphere_3_key sphere_1, const Sphere_point_3& sp) const ; - */ + CGAL::Comparison_result compare_sphere_centers_c(Sphere_3_key a, Sphere_3_key b, Coordinate_index C) const; CGAL::Comparison_result compare_sphere_center_c(Sphere_3_key a, @@ -164,11 +164,11 @@ struct Arrangement_of_spheres_traits_3 { CGAL::Comparison_result compare_sphere_center_c(Sphere_3_key a, const Sphere_point_3& d, Coordinate_index C) const; - /* // return true if the interval defined by the sphere in C contains d.C bool is_over_circle_c(Sphere_3_key c, const Sphere_point_3& d, Coordinate_index C) const; - + /* + CGAL::Comparison_result compare_sphere_sphere_at_sweep(const Sphere_point_3 &t, Sphere_3_key sphere0, Sphere_3_key Sphere1, @@ -183,17 +183,19 @@ struct Arrangement_of_spheres_traits_3 { Sphere_3_key planex, const Sphere_point_3 &pt, Coordinate_index C) const; + */ CGAL::Bounded_side bounded_side_of_sphere(Sphere_3_key sphere, const Sphere_point_3 &z) const; CGAL::Bounded_side bounded_side_of_sphere(Sphere_3_key sphere, Sphere_3_key x, Sphere_3_key y, const Sphere_point_3 &z) const; - + CGAL::Comparison_result compare_depths(const Sphere_point_3 &a, const Sphere_point_3 &b) const; + CGAL::Oriented_side oriented_side(const Plane_3 &p, - const Sphere_point_3 &pt) const;*/ + const Sphere_point_3 &pt) const; // Sweep types ------------------------------------------------------