From d86ec409a3565c1aa7e186dc7e3ee5296b32294f Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 17 Nov 2013 08:54:42 +0200 Subject: [PATCH 01/50] commented out unused vars. --- .../ArrangementDemoGraphicsView.cpp | 2 +- .../Arrangement_on_surface_2/ColorItemEditor.cpp | 13 ++++++------- .../GraphicsViewSegmentInput.cpp | 12 ++++++------ .../Arrangement_on_surface_2/PointsGraphicsItem.cpp | 6 +++--- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp index b95c393bcdf..cb935ab0e26 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp @@ -76,7 +76,7 @@ QColor ArrangementDemoGraphicsView::getBackgroundColor( ) const } void ArrangementDemoGraphicsView::drawForeground( QPainter* painter, - const QRectF& rect ) + const QRectF& /* rect */) { QRectF viewportRect = this->getViewportRect( ); if ( this->showGrid ) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp index 26a8fc853e6..79ab960ca78 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp @@ -45,7 +45,7 @@ #include "ColorItemEditor.h" ColorItemEditor::ColorItemEditor( QWidget* widget ) : QPushButton( widget ) -{ +{ this->setText( tr("Select a color") ); } @@ -59,14 +59,13 @@ void ColorItemEditor::setColor( QColor color ) this->m_color = color; } -void ColorItemEditor::mousePressEvent( QMouseEvent* e ) +void ColorItemEditor::mousePressEvent(QMouseEvent* /* e */) { - QColor selectedColor = QColorDialog::getColor( this->m_color ); - if ( selectedColor.isValid( ) ) - { - // std::cout << selectedColor.name( ).toStdString( ) << std::endl; + QColor selectedColor = QColorDialog::getColor(this->m_color); + if (selectedColor.isValid()) { + // std::cout << selectedColor.name().toStdString() << std::endl; this->setColor( selectedColor ); } - emit confirmed( ); + emit confirmed(); } diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.cpp index df35391b3d1..b5ba7c2fe3d 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.cpp @@ -43,13 +43,13 @@ QGraphicsScene* GraphicsViewSegmentInputBase::getScene( ) const return this->scene; } -void -GraphicsViewSegmentInputBase::mouseMoveEvent(QGraphicsSceneMouseEvent* event) +void GraphicsViewSegmentInputBase:: +mouseMoveEvent(QGraphicsSceneMouseEvent* /* event */) { } -void -GraphicsViewSegmentInputBase::mousePressEvent(QGraphicsSceneMouseEvent* event) -{ +void GraphicsViewSegmentInputBase:: +mousePressEvent(QGraphicsSceneMouseEvent* /* event */) +{ // std::cout << "GraphicsViewSegmentInputBase::mousePressEvent" << std::endl; } @@ -67,7 +67,7 @@ bool GraphicsViewSegmentInputBase::eventFilter( QObject* obj, QEvent* event ) static_cast< QGraphicsSceneMouseEvent* >( event ); this->mousePressEvent( mouseEvent ); } - + return QObject::eventFilter( obj, event ); } diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp index 9cac0942dcc..1b7c8435dbf 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp @@ -28,9 +28,9 @@ PointsGraphicsItem::PointsGraphicsItem( ) : color( ::Qt::blue ) { } -void PointsGraphicsItem::paint( QPainter* painter, - const QStyleOptionGraphicsItem* option, - QWidget* widget ) +void PointsGraphicsItem::paint(QPainter* painter, + const QStyleOptionGraphicsItem* /* option */, + QWidget* /* widget */) { double scale = painter->worldTransform( ).m11( ); double radius = this->pointRadius; From 42906f161a1b8b99928876f7b7295a3082379360 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 17 Nov 2013 08:55:47 +0200 Subject: [PATCH 02/50] fixed triangulation point-location --- .../Arr_triangulation_pl_functions.h | 275 ++++++-------- .../CGAL/Arr_triangulation_point_location.h | 359 +++++++++--------- .../Point_location_test.h | 66 ++-- 3 files changed, 332 insertions(+), 368 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h index 54125aa80f0..02c6a589c80 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Idit Haran @@ -22,106 +22,107 @@ #define CGAL_ARR_TRIANGULATION_POINT_LOCATION_FUNCTIONS_H /*! \file -* Member-function definitions for the Arr_triangulation_point_location -* class. +* Member-function definitions for the +* Arr_triangulation_point_location class. */ -//#define CGAL_TRG_DEBUG +// #define CGAL_TRG_DEBUG #ifdef CGAL_TRG_DEBUG - #define CGAL_TRG_PRINT_DEBUG(expr) std::cout << expr << std::endl + #define CGAL_TRG_PRINT_DEBUG(expr) std::cout << expr << std::endl #else - #define CGAL_TRG_PRINT_DEBUG(expr) + #define CGAL_TRG_PRINT_DEBUG(expr) #endif namespace CGAL { +template +typename Arr_triangulation_point_location::result_type +Arr_triangulation_point_location:: +locate_in_unbounded(const Point_2& p) const +{ + CGAL_TRG_PRINT_DEBUG("unbounded face"); + + //! \todo Here we assume that there is only one unbounded face. + Face_const_handle face_found = this->arrangement()->unbounded_faces_begin(); + + // Check whether the query point coincides with any of the isolated + // vertices contained inside this face. + typename Traits_adaptor_2::Equal_2 equal = m_traits->equal_2_object(); + Isolated_vertex_const_iterator iso_verts_it; + for (iso_verts_it = face_found->isolated_vertices_begin(); + iso_verts_it != face_found->isolated_vertices_end(); ++iso_verts_it) + { + if (equal (p, iso_verts_it->point())) { + Vertex_const_handle vh = iso_verts_it; + return make_result(vh); + } + } + return make_result(face_found); +} + //----------------------------------------------------------------------------- // Locate the arrangement feature containing the given point. // -template -typename Arr_triangulation_point_location::result_type -Arr_triangulation_point_location::locate(const Point_2& p) const +template +typename Arr_triangulation_point_location::result_type +Arr_triangulation_point_location::locate(const Point_2& p) + const { - CGAL_TRG_PRINT_DEBUG("------ locate point "<< p); + typedef Arrangement_2_ Arrangement; - //init output - Face_const_handle face_found = this->arrangement()->unbounded_face(); + CGAL_TRG_PRINT_DEBUG("------ locate point " << p); //locate in the CDT - CDT_Point p1 = static_cast (p); + CDT_Point p1 = static_cast (p); //locate point int li; CDT_Locate_type cdt_lt; - CDT_Face_handle fh = cdt.locate(p1,cdt_lt,li); + CDT_Face_handle fh = cdt.locate(p1, cdt_lt, li); switch (cdt_lt) { case CDT::OUTSIDE_AFFINE_HULL: case CDT::OUTSIDE_CONVEX_HULL: - { - CGAL_TRG_PRINT_DEBUG("unbounded face" ); - - // we still have to check whether the query point coincides with - // any of the isolated vertices contained inside this face. - Isolated_vertex_const_iterator iso_verts_it; - typename Traits_adaptor_2::Equal_2 equal = traits->equal_2_object(); - - for (iso_verts_it = face_found->isolated_vertices_begin(); - iso_verts_it != face_found->isolated_vertices_end(); ++iso_verts_it) - { - if (equal (p, iso_verts_it->point())) { - Vertex_const_handle vh = iso_verts_it; - return make_result(vh); - } - } - - return make_result(face_found); - } + return locate_in_unbounded(p); case CDT::VERTEX: - { - //get the vertex from li, which is the index of the vertex - Vertex_const_handle vertex_found = fh->vertex(li)->info(); - CGAL_TRG_PRINT_DEBUG("vertex: "<< vertex_found->point()); - return make_result(vertex_found); - } + //get the vertex from li, which is the index of the vertex + CGAL_TRG_PRINT_DEBUG("vertex: "<< fh->vertex(li)->info()->point()); + return make_result(fh->vertex(li)->info()); case CDT::EDGE: - { - CGAL_TRG_PRINT_DEBUG("locate type = edge"<
  • target()->point()); - } - } while (++circ1 != circ1_done); - - return make_result(edeg_found); - } - //if the edge is not a constrained - its not an edge of the - //plannar map, which means we're inside of a pm face - - //lets look at the face as if it was a face case. - // no break - continue to the face caes + Halfedge_const_handle edge_found; + do { + if (v2_of_edge == (*circ1).source()) { + edge_found = circ1; + CGAL_TRG_PRINT_DEBUG("edge_found = " + << edge_found->source()->point() + << " towards " + << edge_found->target()->point()); + } + } while (++circ1 != circ1_done); + return make_result(edge_found); } + // if the edge is not a constrained - its not an edge of the + // plannar map, which means we're inside of a pm face - + // lets look at the face as if it was a face case. + // no break - continue to the face caes case CDT::FACE: break; @@ -131,78 +132,56 @@ Arr_triangulation_point_location::locate(const Point_2& p) const CGAL_TRG_PRINT_DEBUG("FACE "); //get 3 pm vertices of face - Vertex_const_handle v0 = fh->vertex(0)->info(); + Vertex_const_handle v0 = fh->vertex(0)->info(); Vertex_const_handle v1 = fh->vertex(1)->info(); Vertex_const_handle v2 = fh->vertex(2)->info(); //the vertices should not be isolated, since we do not insert the - //isolated vertices as points in the triangulation, only edges - // (and thus vertices inceident to this edge). - //in the future it is possible to add isolated vertices to the + //isolated vertices as points in the triangulation, only edges + // (and thus vertices inceident to this edge). + //in the future it is possible to add isolated vertices to the // triangulation, and then, when found, take its incident_face CGAL_assertion(!v0->is_isolated()); CGAL_assertion(!v1->is_isolated()); CGAL_assertion(!v2->is_isolated()); - if (v0->is_isolated()) return make_result(v0->face()); - if (v1->is_isolated()) return make_result(v1->face()); - if (v2->is_isolated()) return make_result(v2->face()); + // if (v0->is_isolated()) return make_result(v0->face()); + // if (v1->is_isolated()) return make_result(v1->face()); + // if (v2->is_isolated()) return make_result(v2->face()); - //find the face in the pm correspond to the 3 vertices - Halfedge_around_vertex_const_circulator havc0 = v0->incident_halfedges(); - Halfedge_around_vertex_const_circulator havc0_done (havc0); - - Halfedge_around_vertex_const_circulator havc1 = v1->incident_halfedges(); - Halfedge_around_vertex_const_circulator havc1_done (havc1); - - Halfedge_around_vertex_const_circulator havc2 = v2->incident_halfedges(); - Halfedge_around_vertex_const_circulator havc2_done (havc2); - - //loop to find face - bool found = false; - bool found_unbounded = false; + // Find the face in the arrangement that contains the triangle + // Loop over the incident vertices of v0, and try to find a ccb that first + // contains v1 and then v2 in that order. If such a face does not exists, + // the unbounded face contains the triangle. + Halfedge_around_vertex_const_circulator havc0 = v0->incident_halfedges(); + Halfedge_around_vertex_const_circulator havc0_done(havc0); + bool found_v2 = false; + Halfedge_const_handle he; do { - //get face from halfedge - Face_const_handle f0 = (*havc0).face(); + bool found_v1 = false; + found_v2 = false; + he = havc0->twin(); + Halfedge_const_handle he_done(he); do { - Face_const_handle f1 = (*havc1).face(); - if ( f0 == f1 ) - { - CGAL_TRG_PRINT_DEBUG("f0 == f1"); - do { - Face_const_handle f2 = (*havc2).face(); - if ( f1 == f2 ) - { - CGAL_TRG_PRINT_DEBUG("f1 == f2"); - if (face_found != f0) { - face_found = f0; - found = true; - } - else - found_unbounded = true; - } - } while ((++havc2 != havc2_done) && !found ); + if (!found_v1) { + if (he->target() == v1) found_v1 = true; } - } while ((++havc1 != havc1_done)&& !found ); - } while ((++havc0 != havc0_done)&& !found ); + else if (!found_v2) { + if (he->target() == v2) { + found_v2 = true; + break; + } + } + he = he->next(); + } while (he != he_done); + } while ((++havc0 != havc0_done) && !found_v2); - if (face_found == this->arrangement()->unbounded_face()) - { - if (! found_unbounded) - { - std::cerr<< "NOT GOOD - face not found" << std::endl; - //debug - print some more info - std::cout << "p = "<< p <arrangement()->edges_begin(); - - for (eit = this->arrangement()->edges_begin(); - eit != this->arrangement()->edges_end(); eit++) - { + Edge_const_iterator eit = this->arrangement()->edges_begin(); + for (; eit != this->arrangement()->edges_end(); ++eit) { //get vertices from edge Vertex_const_handle pm_vh1 = (*eit).source(); Vertex_const_handle pm_vh2 = (*eit).target(); @@ -261,10 +231,9 @@ void Arr_triangulation_point_location CDT_Point cdt_p2 = static_cast (pm_p2); //check if source point is equal to destination point - if (traits->equal_2_object()(pm_p1, pm_p2)) - { - std::cerr << "WARNING: source point is equal to destination point!!! " - << pm_p1 << std::endl ; + if (m_traits->equal_2_object()(pm_p1, pm_p2)) { + std::cerr << "WARNING: source point is equal to destination point!!! " + << pm_p1 << std::endl ; CDT_Vertex_handle cdt_vh1 = cdt.insert(cdt_p1); cdt_vh1->info() = pm_vh1; continue; @@ -282,14 +251,14 @@ void Arr_triangulation_point_location cdt.insert_constraint(cdt_vh1, cdt_vh2); //print - CGAL_TRG_PRINT_DEBUG("source = " << pm_p1 << " , target = " << pm_p2 ); + CGAL_TRG_PRINT_DEBUG("source = " << pm_p1 << " , target = " << pm_p2); } //the triangulation is now updated updated_cdt = true; CGAL_assertion(cdt.is_valid()); - CGAL_TRG_PRINT_DEBUG("finished updating the CDT " ); + CGAL_TRG_PRINT_DEBUG("finished updating the CDT "); } } //namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h index 2b076bf9d7a..1b7bd00f57d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h @@ -14,16 +14,13 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Idit Haran #ifndef CGAL_ARR_TRIANGULATION_POINT_LOCATION_H #define CGAL_ARR_TRIANGULATION_POINT_LOCATION_H -#include -#ifdef CGAL_DONT_SUBMIT - /*! \file * Definition of the Arr_triangulation_point_location template. */ @@ -46,14 +43,14 @@ namespace CGAL { * on a planar arrangement using the triangulation algorithm. * The Arrangement parameter corresponds to an arrangement instantiation. */ -template +template class Arr_triangulation_point_location : public Arr_observer { public: typedef Arrangement_ Arrangement_2; - typedef typename Arrangement_2::Traits_2 Traits_2; - typedef typename Traits_2::Kernel Kernel; + typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2; + typedef typename Geometry_traits_2::Kernel Kernel; typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; @@ -64,29 +61,29 @@ public: typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator; typedef typename Arrangement_2::Edge_const_iterator Edge_const_iterator; - typedef typename Arrangement_2::Hole_const_iterator Hole_const_iterator; - typedef typename Arrangement_2::Halfedge_const_iterator + typedef typename Arrangement_2::Face_const_iterator Face_const_iterator; + typedef typename Arrangement_2::Halfedge_const_iterator Halfedge_const_iterator; - typedef typename Arrangement_2::Halfedge_around_vertex_const_circulator + typedef typename Arrangement_2::Halfedge_around_vertex_const_circulator Halfedge_around_vertex_const_circulator; - typedef typename Arrangement_2::Ccb_halfedge_const_circulator + typedef typename Arrangement_2::Ccb_halfedge_const_circulator Ccb_halfedge_const_circulator; - typedef typename Arrangement_2::Ccb_halfedge_circulator + typedef typename Arrangement_2::Ccb_halfedge_circulator Ccb_halfedge_circulator; typedef typename Arrangement_2::Isolated_vertex_const_iterator Isolated_vertex_const_iterator; - typedef typename Traits_2::Point_2 Point_2; - typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2; + typedef typename Geometry_traits_2::Point_2 Point_2; + typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2; - typedef std::list Edge_list; - typedef typename Edge_list::iterator Std_edge_iterator; + typedef std::list Edge_list; + typedef typename Edge_list::iterator Std_edge_iterator; //---------------------------------------------------------- // Triangulation Types //---------------------------------------------------------- - typedef Triangulation_vertex_base_with_info_2 - Vbb; + typedef Triangulation_vertex_base_with_info_2 + Vbb; typedef Triangulation_hierarchy_vertex_base_2 Vb; //typedef Triangulation_face_base_with_info_2 Fbt; typedef Constrained_triangulation_face_base_2 Fb; @@ -113,13 +110,13 @@ public: typedef Result_type result_type; protected: - typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; + typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; // Data members: const Traits_adaptor_2* m_traits; // Its associated traits object. - bool ignore_notifications; - CDT cdt; - bool updated_cdt; + bool ignore_notifications; + CDT cdt; + bool updated_cdt; template Result_type make_result(T t) const { return Result::make_result(t); } @@ -129,13 +126,13 @@ public: /*! Default constructor. */ Arr_triangulation_point_location() : m_traits(NULL) {} - /*! Constructor given an arrangement. */ + /*! Constructor given an arrangement. + */ Arr_triangulation_point_location(const Arrangement_2& arr) : - Arr_observer(const_cast(arr)) + Arr_observer(const_cast(arr)) { build_triangulation(); } - - /*! - * Locate the arrangement feature containing the given point. + + /*! Locate the arrangement feature containing the given point. * \param p The query point. * \return An object representing the arrangement feature containing the * query point. This object is either a Face_const_handle or a @@ -143,195 +140,191 @@ public: */ result_type locate(const Point_2& p) const; - //Observer functions that are relevant to overload - //------------------------------------------------- + //Observer functions that are relevant to overload + //------------------------------------------------- - /*! Attach an arrangement object. */ - virtual void before_attach(const Arrangement_2& arr) - { m_traits = static_cast(arr.traits()); } + /*! Attach an arrangement object. + */ + virtual void before_attach(const Arrangement_2& arr) + { m_traits = static_cast(arr.geometry_traits()); } - virtual void after_attach() - { build_triangulation(); } + virtual void after_attach() { build_triangulation(); } - virtual void before_detach() - { clear_triangulation(); } + virtual void before_detach() { clear_triangulation(); } - /*! - * Notification after the arrangement has been assigned with another - * arrangement. - * \param u A handle to the unbounded face. - */ - virtual void after_assign() - { + /*! Notification after the arrangement has been assigned with another + * arrangement. + */ + virtual void after_assign() + { + clear_triangulation(); + build_triangulation(); + } + + /*! Notification after the arrangement is cleared. + */ + virtual void after_clear() + { + clear_triangulation(); + build_triangulation(); + } + + /*! Notification before a global operation modifies the arrangement. + */ + virtual void before_global_change() + { + clear_triangulation(); + ignore_notifications = true; + } + + /*! Notification after a global operation is completed. + */ + virtual void after_global_change() + { + build_triangulation(); + ignore_notifications = false; + } + + /*! Notification after the creation of a new vertex. + * \param v A handle to the created vertex. + */ + virtual void after_create_vertex(Vertex_handle /* v */) + { + if (! ignore_notifications) { clear_triangulation(); build_triangulation(); } + } - /*! - * Notification after the arrangement is cleared. - * \param u A handle to the unbounded face. - */ - virtual void after_clear() - { + /*! Notification after the creation of a new edge. + * \param e A handle to one of the twin halfedges that were created. + */ + virtual void after_create_edge(Halfedge_handle /* e */) + { + if (! ignore_notifications) { clear_triangulation(); build_triangulation(); } + } - /*! Notification before a global operation modifies the arrangement. */ - virtual void before_global_change() - { + /*! Notification after an edge was split. + * \param e1 A handle to one of the twin halfedges forming the first edge. + * \param e2 A handle to one of the twin halfedges forming the second edge. + */ + virtual void after_split_edge(Halfedge_handle /* e1 */, + Halfedge_handle /* e2 */) + { + if (! ignore_notifications) { clear_triangulation(); - ignore_notifications = true; - } - - /*! Notification after a global operation is completed. */ - virtual void after_global_change() - { build_triangulation(); - ignore_notifications = false; } + } - /*! - * Notification after the creation of a new vertex. - * \param v A handle to the created vertex. - */ - virtual void after_create_vertex(Vertex_handle /* v */) - { - if (! ignore_notifications) { - clear_triangulation(); - build_triangulation(); - } + /*! Notification after a face was split. + * \param f A handle to the face we have just split. + * \param new_f A handle to the new face that has been created. + * \param is_hole Whether the new face forms a hole inside f. + */ + virtual void after_split_face(Face_handle /* f */, + Face_handle /* new_f */, + bool /* is_hole */) + { + if (! ignore_notifications) { + clear_triangulation(); + build_triangulation(); } + } - /*! - * Notification after the creation of a new edge. - * \param e A handle to one of the twin halfedges that were created. - */ - virtual void after_create_edge(Halfedge_handle /* e */) - { - if (! ignore_notifications) { - clear_triangulation(); - build_triangulation(); - } + /*! Notification after a hole was created inside a face. + * \param h A circulator representing the boundary of the new hole. + */ + virtual void after_add_hole(Ccb_halfedge_circulator /* h */) + { + if (! ignore_notifications) { + clear_triangulation(); + build_triangulation(); } + } - /*! - * Notification after an edge was split. - * \param e1 A handle to one of the twin halfedges forming the first edge. - * \param e2 A handle to one of the twin halfedges forming the second edge. - */ - virtual void after_split_edge(Halfedge_handle /* e1 */, - Halfedge_handle /* e2 */) - { - if (! ignore_notifications) { - clear_triangulation(); - build_triangulation(); - } + /*! Notification after an edge was merged. + * \param e A handle to one of the twin halfedges forming the merged edge. + */ + virtual void after_merge_edge(Halfedge_handle /* e */) + { + if (! ignore_notifications) { + clear_triangulation(); + build_triangulation(); } + } - /*! - * Notification after a face was split. - * \param f A handle to the face we have just split. - * \param new_f A handle to the new face that has been created. - * \param is_hole Whether the new face forms a hole inside f. - */ - virtual void after_split_face(Face_handle /* f */, - Face_handle /* new_f */, - bool /* is_hole */) - { - if (! ignore_notifications) { - clear_triangulation(); - build_triangulation(); - } + /*! Notification after a face was merged. + * \param f A handle to the merged face. + */ + virtual void after_merge_face(Face_handle /* f */) + { + if (! ignore_notifications) { + clear_triangulation(); + build_triangulation(); } + } - /*! - * Notification after a hole was created inside a face. - * \param h A circulator representing the boundary of the new hole. - */ - virtual void after_add_hole(Ccb_halfedge_circulator /* h */) - { - if (! ignore_notifications) { - clear_triangulation(); - build_triangulation(); - } + /*! Notification after a hole is moved from one face to another. + * \param h A circulator representing the boundary of the hole. + */ + virtual void after_move_hole(Ccb_halfedge_circulator /* h */) + { + if (! ignore_notifications) { + clear_triangulation(); + build_triangulation(); } + } - /*! - * Notification after an edge was merged. - * \param e A handle to one of the twin halfedges forming the merged edge. - */ - virtual void after_merge_edge(Halfedge_handle /* e */) - { - if (! ignore_notifications) { - clear_triangulation(); - build_triangulation(); - } + /*! Notificaion before the removal of a vertex. + * \param v A handle to the vertex to be deleted. + */ + virtual void after_remove_vertex() + { + if (! ignore_notifications) { + clear_triangulation(); + build_triangulation(); } + } - /*! - * Notification after a face was merged. - * \param f A handle to the merged face. - */ - virtual void after_merge_face(Face_handle /* f */) - { - if (! ignore_notifications) { - clear_triangulation(); - build_triangulation(); - } + /*! Notification before the removal of an edge. + * \param e A handle to one of the twin halfedges to be deleted. + */ + virtual void after_remove_edge() + { + if (! ignore_notifications) { + clear_triangulation(); + build_triangulation(); } + } - /*! - * Notification after a hole is moved from one face to another. - * \param h A circulator representing the boundary of the hole. - */ - virtual void after_move_hole(Ccb_halfedge_circulator /* h */) - { - if (! ignore_notifications) { - clear_triangulation(); - build_triangulation(); - } - } - - /*! - * Notificaion before the removal of a vertex. - * \param v A handle to the vertex to be deleted. - */ - virtual void after_remove_vertex() - { - if (! ignore_notifications) { - clear_triangulation(); - build_triangulation(); - } - } - - /*! - * Notification before the removal of an edge. - * \param e A handle to one of the twin halfedges to be deleted. - */ - virtual void after_remove_edge() - { - if (! ignore_notifications) { - clear_triangulation(); - build_triangulation(); - } - } - - /*! - * Notification before the removal of a hole. - * \param h A circulator representing the boundary of the hole. - */ - virtual void after_remove_hole() - { - if (! ignore_notifications) { - clear_triangulation(); - build_triangulation(); - } + /*! Notification before the removal of a hole. + * \param h A circulator representing the boundary of the hole. + */ + virtual void after_remove_hole() + { + if (! ignore_notifications) { + clear_triangulation(); + build_triangulation(); } + } protected: + /*! Locate the arrangement feature containing the given point in the + * unbounded face(s). + * \param p The query point. + * \return An object representing the arrangement feature containing the + * query point. This object is either a Face_const_handle + * representing an unbounded face or a Vertex_const_handle + * representing an isolated vertex. + */ + result_type locate_in_unbounded(const Point_2& p) const; + void clear_triangulation(); - void build_triangulation(); + void build_triangulation(); }; } //namespace CGAL @@ -339,6 +332,4 @@ protected: // The member-function definitions can be found under: #include -#endif // CGAL_DONT_SUBMIT - #endif diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h index fc59a8d7c9e..d3087016800 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h @@ -15,7 +15,7 @@ #include #include #include -//#include +#include #include "IO_test.h" @@ -97,9 +97,8 @@ protected: typedef typename CGAL::Arr_trapezoid_ric_point_location Trapezoid_ric_point_location; - // typedef CGAL::Arr_triangulation_point_location - - // Triangulation_point_location; + typedef CGAL::Arr_triangulation_point_location + Triangulation_point_location; // ===> Add new point location type here <=== @@ -125,7 +124,7 @@ protected: Lm_halton_point_location* m_halton_lm_pl; // 6 Lm_middle_edges_point_location* m_middle_edges_lm_pl; // 7 Lm_specified_points_point_location* m_specified_points_lm_pl; // 8 - // Triangulation_point_location m_triangulation_pl; // 9 + Triangulation_point_location* m_triangulation_pl; // 9 Trapezoid_ric_point_location* m_trapezoid_ric_pl; // 10 Trapezoid_ric_point_location* m_trapezoid_ric_no_grnt_pl; // 11 @@ -137,7 +136,7 @@ protected: // // ===> Change the number of point-location startegies // // when a new point location is added. <=== - #define MAX_NUM_POINT_LOCATION_STRATEGIES 11 + #define MAX_NUM_POINT_LOCATION_STRATEGIES 12 int verify(Objects_vector objs[MAX_NUM_POINT_LOCATION_STRATEGIES], size_t size, unsigned int pls_num); @@ -222,7 +221,7 @@ Point_location_test(const Geom_traits& geom_traits) : m_halton_lm_pl(NULL), m_middle_edges_lm_pl(NULL), m_specified_points_lm_pl(NULL), - // m_triangulation_pl(NULL), + m_triangulation_pl(NULL), m_trapezoid_ric_pl(NULL), m_trapezoid_ric_no_grnt_pl(NULL), m_random_g(NULL), @@ -334,10 +333,13 @@ deallocate_pl_strategies() } #endif - // if (m_triangulation_pl) { - // delete m_triangulation_pl; - // m_triangulation_pl = NULL; - // } +#if (TEST_GEOM_TRAITS == SEGMENT_GEOM_TRAITS) + if (m_triangulation_pl) { + delete m_triangulation_pl; + m_triangulation_pl = NULL; + } +#endif + if (m_trapezoid_ric_pl) { delete m_trapezoid_ric_pl; m_trapezoid_ric_pl = NULL; @@ -408,10 +410,10 @@ allocate_pl_strategies() return false; if (!(m_specified_points_lm_pl = new Lm_specified_points_point_location())) return false; +#endif - // if (!(m_triangulation_pl = new Triangulation_point_location())) - // return false; - +#if (TEST_GEOM_TRAITS == SEGMENT_GEOM_TRAITS) + if (!(m_triangulation_pl = new Triangulation_point_location())) return false; #endif if (!(m_trapezoid_ric_pl = new Trapezoid_ric_point_location())) return false; @@ -474,13 +476,14 @@ construct_pl_strategies() timer.stop(); std::cout << "Specified_points lm construction took " << timer.time() << std::endl; +#endif - // timer.reset(); timer.start(); - // m_triangulation_pl = new Triangulation_point_location(*m_arr); // 9 - // timer.stop(); - // std::cout << "Triangulation lm construction took " - // << timer.time() << std::endl; - +#if (TEST_GEOM_TRAITS == SEGMENT_GEOM_TRAITS) + timer.reset(); timer.start(); + m_triangulation_pl = new Triangulation_point_location(*m_arr); // 9 + timer.stop(); + std::cout << "Triangulation lm construction took " + << timer.time() << std::endl; #endif timer.reset(); timer.start(); @@ -550,13 +553,14 @@ bool Point_location_test::attach_pl_strategies() timer.stop(); std::cout << "Specified_points lm construction took " << timer.time() << std::endl; +#endif - // timer.reset(); timer.start(); - // m_location triangulation_lm_pl->attach(*m_arr); - // timer.stop(); - // std::cout << "Triangulation lm construction took " - // << timer.time() << std::endl; - +#if (TEST_GEOM_TRAITS == SEGMENT_GEOM_TRAITS) + timer.reset(); timer.start(); + m_triangulation_pl->attach(*m_arr); + timer.stop(); + std::cout << "Triangulation lm construction took " + << timer.time() << std::endl; #endif timer.reset(); timer.start(); @@ -631,12 +635,12 @@ bool Point_location_test::perform() query(*m_specified_points_lm_pl, "Landmarks specified points", m_query_points.begin(), m_query_points.end(), std::back_inserter(objs[pl_index++])); // Landmarks specified points +#endif - // Triangulation - // query(*m_triangulation_pl, "Triangulation", - // m_query_points.begin(), m_query_points.end(), - // std::back_inserter(objs[pl_index++])); // Triangulation - +#if (TEST_GEOM_TRAITS == SEGMENT_GEOM_TRAITS) + query(*m_triangulation_pl, "Triangulation", + m_query_points.begin(), m_query_points.end(), + std::back_inserter(objs[pl_index++])); // Triangulation #endif query(*m_trapezoid_ric_pl, "Trapezoidal RIC", From affa4e71ad954cfbacc828c891dd950f035c6eb3 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 17 Nov 2013 12:01:31 +0200 Subject: [PATCH 03/50] Fixed triangulation point-location --- .../Arr_triangulation_pl_functions.h | 2 +- .../CGAL/Arr_triangulation_point_location.h | 113 ++++++++++++++---- 2 files changed, 89 insertions(+), 26 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h index 02c6a589c80..e776e811343 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h @@ -26,7 +26,7 @@ * Arr_triangulation_point_location class. */ -// #define CGAL_TRG_DEBUG +#define CGAL_TRG_DEBUG #ifdef CGAL_TRG_DEBUG #define CGAL_TRG_PRINT_DEBUG(expr) std::cout << expr << std::endl diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h index 1b7bd00f57d..25a534d92bf 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h @@ -114,7 +114,8 @@ protected: // Data members: const Traits_adaptor_2* m_traits; // Its associated traits object. - bool ignore_notifications; + bool m_ignore_notifications; + bool m_ignore_remove_edge; CDT cdt; bool updated_cdt; @@ -124,12 +125,19 @@ protected: public: /*! Default constructor. */ - Arr_triangulation_point_location() : m_traits(NULL) {} + Arr_triangulation_point_location() : + m_traits(NULL), + m_ignore_notifications(false), + m_ignore_remove_edge(false) + {} /*! Constructor given an arrangement. */ Arr_triangulation_point_location(const Arrangement_2& arr) : - Arr_observer(const_cast(arr)) + Arr_observer(const_cast(arr)), + m_traits(static_cast(arr.geometry_traits())), + m_ignore_notifications(false), + m_ignore_remove_edge(false) { build_triangulation(); } /*! Locate the arrangement feature containing the given point. @@ -173,16 +181,27 @@ public: */ virtual void before_global_change() { + std::cout << "before_global_change()" << std::endl; clear_triangulation(); - ignore_notifications = true; + m_ignore_notifications = true; } /*! Notification after a global operation is completed. */ virtual void after_global_change() { + std::cout << "after_global_change()" << std::endl; build_triangulation(); - ignore_notifications = false; + m_ignore_notifications = false; + } + + /*! Notification before the removal of an edge. + * \param e A handle to one of the twin halfedges to be deleted. + */ + virtual void before_remove_edge(Halfedge_handle /* e */) + { + std::cout << "before_remove_edge()" << std::endl; + m_ignore_remove_edge = true; } /*! Notification after the creation of a new vertex. @@ -190,7 +209,7 @@ public: */ virtual void after_create_vertex(Vertex_handle /* v */) { - if (! ignore_notifications) { + if (! m_ignore_notifications) { clear_triangulation(); build_triangulation(); } @@ -201,7 +220,7 @@ public: */ virtual void after_create_edge(Halfedge_handle /* e */) { - if (! ignore_notifications) { + if (! m_ignore_notifications) { clear_triangulation(); build_triangulation(); } @@ -214,7 +233,8 @@ public: virtual void after_split_edge(Halfedge_handle /* e1 */, Halfedge_handle /* e2 */) { - if (! ignore_notifications) { + std::cout << "after_split_edge()" << std::endl; + if (! m_ignore_notifications) { clear_triangulation(); build_triangulation(); } @@ -229,18 +249,20 @@ public: Face_handle /* new_f */, bool /* is_hole */) { - if (! ignore_notifications) { + std::cout << "after_split_face()" << std::endl; + if (! m_ignore_notifications) { clear_triangulation(); build_triangulation(); } } - /*! Notification after a hole was created inside a face. - * \param h A circulator representing the boundary of the new hole. + /*! Notification after an outer CCB was created inside a face. + * \param h A circulator representing the boundary of the new outer CCB. */ - virtual void after_add_hole(Ccb_halfedge_circulator /* h */) + virtual void after_add_outer_ccb(Ccb_halfedge_circulator /* h */) { - if (! ignore_notifications) { + std::cout << "after_add_outer_ccb()" << std::endl; + if (! m_ignore_notifications) { clear_triangulation(); build_triangulation(); } @@ -251,7 +273,7 @@ public: */ virtual void after_merge_edge(Halfedge_handle /* e */) { - if (! ignore_notifications) { + if (! m_ignore_notifications) { clear_triangulation(); build_triangulation(); } @@ -262,18 +284,20 @@ public: */ virtual void after_merge_face(Face_handle /* f */) { - if (! ignore_notifications) { + std::cout << "after_merge_face() " << std::endl; + if (! m_ignore_notifications && ! m_ignore_remove_edge) { clear_triangulation(); build_triangulation(); } } - /*! Notification after a hole is moved from one face to another. - * \param h A circulator representing the boundary of the hole. + /*! Notification after an outer CCB is moved from one face to another. + * \param h A circulator representing the boundary of the component. */ - virtual void after_move_hole(Ccb_halfedge_circulator /* h */) + virtual void after_move_outer_ccb(Ccb_halfedge_circulator /* h */) { - if (! ignore_notifications) { + std::cout << "after_move_outer_ccb()" << std::endl; + if (! m_ignore_notifications) { clear_triangulation(); build_triangulation(); } @@ -284,7 +308,7 @@ public: */ virtual void after_remove_vertex() { - if (! ignore_notifications) { + if (! m_ignore_notifications && ! m_ignore_remove_edge) { clear_triangulation(); build_triangulation(); } @@ -295,18 +319,57 @@ public: */ virtual void after_remove_edge() { - if (! ignore_notifications) { + std::cout << "after_remove_edge()" << std::endl; + if (! m_ignore_notifications) { + clear_triangulation(); + build_triangulation(); + } + m_ignore_remove_edge = false; + } + + /*! Notification before the removal of an outer CCB. + * \param f The face that used to own the outer CCB. + */ + virtual void after_remove_outer_ccb(Face_handle /* f */) + { + std::cout << "after_remove_outer_ccb()" << std::endl; + if (! m_ignore_notifications && ! m_ignore_remove_edge) { clear_triangulation(); build_triangulation(); } } - /*! Notification before the removal of a hole. - * \param h A circulator representing the boundary of the hole. + /*! Notification after an inner CCB was created inside a face. + * \param h A circulator representing the boundary of the new inner CCB. */ - virtual void after_remove_hole() + virtual void after_add_inner_ccb(Ccb_halfedge_circulator /* h */) { - if (! ignore_notifications) { + std::cout << "after_add_inner_ccb()" << std::endl; + if (! m_ignore_notifications) { + clear_triangulation(); + build_triangulation(); + } + } + + /*! Notification after an inner CCB is moved from one face to another. + * \param h A circulator representing the boundary of the component. + */ + virtual void after_move_inner_ccb(Ccb_halfedge_circulator /* h */) + { + std::cout << "after_move_inner_ccb()" << std::endl; + if (! m_ignore_notifications) { + clear_triangulation(); + build_triangulation(); + } + } + + /*! Notificaion after the removal of an inner CCB. + * \param f The face that used to contain the inner CCB. + */ + virtual void after_remove_inner_ccb(Face_handle /* f */) + { + std::cout << "after_remove_inner_ccb()" << std::endl; + if (! m_ignore_notifications && ! m_ignore_remove_edge) { clear_triangulation(); build_triangulation(); } From 9adebbed4c8b75efffcf521bf7f955a7fde9a817 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 17 Nov 2013 16:16:44 +0200 Subject: [PATCH 04/50] Cleanup --- .../Point_location_dynamic_test.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_dynamic_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_dynamic_test.h index 703122a3eda..5735c5884b5 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_dynamic_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_dynamic_test.h @@ -78,7 +78,8 @@ construct_arrangement() { std::ifstream in_com(this->m_filename_commands.c_str()); if (!in_com.is_open()) { - this->print_error(std::string("cannot open file ").append(this->m_filename_commands)); + this->print_error(std::string("cannot open file "). + append(this->m_filename_commands)); return false; } @@ -131,7 +132,7 @@ read_perform_opts(std::istream& is) rc = false; continue; } - if (cmd == 'i') CGAL::insert(*(this->m_arr), this->m_xcurves[id]); + if (cmd == 'i') insert(*(this->m_arr), this->m_xcurves[id]); if (cmd == 'd') { if (!remove(this->m_xcurves[id])) rc = false; @@ -154,9 +155,8 @@ remove(const X_monotone_curve_2& xcv) const Geom_traits* traits = this->m_arr->geometry_traits(); typename Geom_traits::Equal_2 equal = traits->equal_2_object(); - typename Arrangement::Edge_iterator eit; - for (eit = this->m_arr->edges_begin(); eit != this->m_arr->edges_end(); ++eit) - { + typename Arrangement::Edge_iterator eit = this->m_arr->edges_begin(); + for (; eit != this->m_arr->edges_end(); ++eit) { const X_monotone_curve_2& xcv_arr = eit->curve(); if (equal(xcv, xcv_arr)) { this->m_arr->remove_edge(eit); From 4001c28082732c8a7f605cc3f879306ab512c8a3 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Mon, 18 Nov 2013 00:16:51 +0200 Subject: [PATCH 05/50] Documented triangulation point-location and fixed landmark point-location --- .../Arrangement_on_surface_2.txt | 41 +- .../CGAL/Arr_landmarks_point_location.h | 78 ++-- .../Arr_lm_generator_base.h | 410 +++++++++++------- .../Arr_lm_grid_generator.h | 116 ++--- .../Arr_lm_halton_generator.h | 38 +- .../Arr_lm_middle_edges_generator.h | 40 +- .../Arr_lm_random_generator.h | 59 ++- .../Arr_lm_specified_points_generator.h | 48 +- .../Arr_lm_vertices_generator.h | 31 +- .../Arr_triangulation_pl_functions.h | 21 +- .../CGAL/Arr_triangulation_point_location.h | 79 ++-- 11 files changed, 506 insertions(+), 455 deletions(-) diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt index 98fb644aa3e..22cf76d240a 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt @@ -870,9 +870,12 @@ print_point_location \subsection arr_sssecpl_strat Choosing a Point-Location Strategy Each of the various point-location class templates employs a different -algorithm or strategy\cgalFootnote{We use the term strategy -is borrowed from the design-pattern taxonomy \cgalCite{cgal:ghjv-dpero-95}, Chapter 5.} -for answering queries: +algorithm or strategy\cgalFootnote{The term strategy +is borrowed from the design-pattern taxonomy \cgalCite{cgal:ghjv-dpero-95}, +Chapter 5. A strategy provides the means to define a family of +algorithms, each implemented by a separate class. All classes that implement +the various algorithms are made interchangeable, letting the algorithm in use +vary according to the user choice.} for answering queries:
    • `Arr_naive_point_location` employes the naive strategy. It locates the query point naively, @@ -883,14 +886,15 @@ for answering queries: It simulates a traversal, in reverse order, along an imaginary vertical ray emanating from the query point. It starts from the unbounded face of the arrangement and moves downward toward the - query point until locating the arrangement cell containing it. + query point until it locates the arrangement cell containing it. + %
    • `Arr_landmarks_point_location` - uses a set of landmark points the location of which in the - arrangement is known. It employs the - landmark strategy. Given a query point, it uses a - nearest-neighbor search-structure (a Kd-tree is used by default) - to find the nearest landmark and then traverses the straight-line - segment connecting this landmark to the query point. + uses a set of landmark points, the location of which in the + arrangement is known. It employs the landmark strategy. Given a + query point, it uses a nearest-neighbor search-structure (a + Kd-tree is used by default) to find the + nearest landmark, and then traverses the straight-line segment + connecting this landmark to the query point. There are various ways to select the landmark set in the arrangement. The selection is governed by the `Generator` @@ -910,15 +914,20 @@ for answering queries: Section \ref arr_sssectr_lanmarks_concept for details. Most traits classes included in the 2D Arrangement package are models of this refined concept. -
    • `Arr_trapezoid_ric_point_location` implements - Mulmuley's point-location algorithm \cgalCite{m-fppa-90}; see - also \cgalCite{bkos-cgaa-00}, Chapter 6. The arrangement faces are - decomposed into simpler cells each of constant complexity, known as - pseudo-trapezoids, and a search structure (a directed acyclic + % +
    • `Arr_trapezoid_ric_point_location` implements an + improved variant of Mulmuley's point-location algorithm + \cgalCite{m-fppa-90}; see also \cgalCite{bkos-cgaa-00}, Chapter 6. + The (expected) query-time is logarithmic. The arrangement faces + are decomposed into simpler cells each of constant complexity, known + as pseudo-trapezoids, and a search structure (a directed acyclic graph) is constructed on top of these cells, facilitating the search of the pseudo trapezoid (hence the arrangement cell) containing a query point in expected logarithmic time. The trapezoidal map and - the search structure are built by a algorithm (RIC). + the search structure are built by a randomized incremental construction + algorithm (RIC). + % +
    The first two strategies do not require any extra data. The class diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h index 50eca2c36cd..8541ee5660b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Idit Haran // Ron Wein @@ -46,7 +46,7 @@ namespace CGAL { * Generator is a class that generates the set of landmarks. */ -template > class Arr_landmarks_point_location { @@ -105,10 +105,10 @@ protected: template Result_type make_result(T t) const { return Result::make_result(t); } inline Result_type default_result() const { return Result::default_result(); } - + public: /*! Default constructor. */ - Arr_landmarks_point_location() : + Arr_landmarks_point_location() : p_arr(NULL), m_traits(NULL), lm_gen(NULL), @@ -117,30 +117,29 @@ public: /*! Constructor given an arrangement only. */ Arr_landmarks_point_location(const Arrangement_2& arr) : - p_arr(&arr) - { - // Allocate the landmarks generator. - m_traits = static_cast(p_arr->geometry_traits()); - lm_gen = new Generator(arr); - own_gen = true; - } + p_arr(&arr), + m_traits(static_cast(p_arr->geometry_traits())), + lm_gen(new Generator(arr)), // allocate the landmarks generator. + own_gen(true) + { } /*! Constructor given an arrangement, and landmarks generator. */ - Arr_landmarks_point_location(const Arrangement_2& arr, Generator *gen) : + Arr_landmarks_point_location(const Arrangement_2& arr, Generator* gen) : p_arr(&arr), + m_traits(static_cast(p_arr->geometry_traits())), lm_gen(gen), own_gen(false) - { - m_traits = static_cast(p_arr->geometry_traits()); - } + { } /*! Destructor. */ - ~Arr_landmarks_point_location() + ~Arr_landmarks_point_location() { - if (own_gen) + if (own_gen) { delete lm_gen; + lm_gen = NULL; + } } - + /*! Attach an arrangement object (and a generator, if supplied). */ void attach(const Arrangement_2& arr, Generator* gen = NULL) { @@ -158,8 +157,8 @@ public: else if (lm_gen != NULL) { // In case a generator exists internally, make sure it is attached to // the given arrangement. - Arrangement_2 &non_const_arr = const_cast(*p_arr); - lm_gen->attach(non_const_arr); + Arrangement_2& non_const_arr = const_cast(*p_arr); + lm_gen->attach(non_const_arr); } else { // Allocate a new generator, attached to the given arrangement. @@ -169,7 +168,7 @@ public: } /*! Detach the instance from the arrangement object. */ - void detach() + void detach() { p_arr = NULL; m_traits = NULL; @@ -178,7 +177,7 @@ public: if (lm_gen) lm_gen->detach(); } - + /*! * Locate the arrangement feature containing the given point. * \param p The query point. @@ -189,9 +188,7 @@ public: result_type locate(const Point_2& p) const; protected: - - /*! - * Walks from the given vertex to the query point. + /*! Walk from the given vertex to the query point. * \param vh The given vertex handle. * \param p The query point. * \param crossed_edges In/Out: The set of edges crossed so far. @@ -200,11 +197,10 @@ protected: * Halfedge_const_handle or a Vertex_const_handle. */ result_type _walk_from_vertex(Vertex_const_handle vh, - const Point_2 & p, + const Point_2& p, Halfedge_set& crossed_edges) const; - /*! - * Locate an edge around a given vertex that is the predecessor of the + /*! Locate an edge around a given vertex that is the predecessor of the * curve connecting the vertex to the query point in a clockwise order. * \param vh The vertex. * \param p The query point. @@ -212,11 +208,10 @@ protected: * \return The desired object (a halfedge handle or a vertex handle). */ result_type _find_face_around_vertex(Vertex_const_handle vh, - const Point_2& p, + const Point_2& p, bool& new_vertex) const; - /*! - * Walks from a point on a given halfedge to the query point. + /*! Walk from a point on a given halfedge to the query point. * \param eh The given halfedge handle. * \param np The point that the walk starts from. * \param p The query point. @@ -226,11 +221,10 @@ protected: * Halfedge_const_handle or a Vertex_const_handle. */ result_type _walk_from_edge(Halfedge_const_handle eh, - const Point_2& np, + const Point_2& np, const Point_2& p, Halfedge_set& crossed_edges) const; - /*! - * In case the arrangement's curve contained in the segment + /*! In case the arrangement's curve contained in the segment * from the nearest landmark to the query point * \param he The given halfedge handle. * \param p_is_left Is the query point the left endpoint of seg. @@ -246,8 +240,7 @@ protected: const Point_2& p, Halfedge_set& crossed_edges) const; - /*! - * Walks from a point in a face to the query point. + /*! Walk from a point in a face to the query point. * \param fh A halfedge handle that points to the face. * \param np The point that the walk starts from. * \param p The query point. @@ -257,12 +250,11 @@ protected: * Halfedge_const_handle or a Vertex_const_handle. */ result_type _walk_from_face(Face_const_handle fh, - const Point_2 & np, - const Point_2 & p, + const Point_2& np, + const Point_2& p, Halfedge_set& crossed_edges) const; - /*! - * Find a halfedge on the given CCB that intersects the given x-monotone + /*! Find a halfedge on the given CCB that intersects the given x-monotone * curve, connecting the current landmark to the query point. * \param circ The CCB circulator. * \param seg The segment connecting the landmark and the query point. @@ -287,8 +279,7 @@ protected: bool& cv_is_contained_in_seg, Vertex_const_handle& new_vertex) const; - /*! - * Return the halfedge that contains the query point. + /*! Return the halfedge that contains the query point. * \param he The halfedge handle. * \param crossed_edges In/Out: The set of edges crossed so far. * \param p The query point. @@ -300,8 +291,7 @@ protected: const Point_2& p, bool& is_target) const; - /*! - * Check whether the given curve intersects a simple segment, which connects + /*! Check whether the given curve intersects a simple segment, which connects * the current landmark to the query point, an odd number of times. * \param cv The curve. * \param seg The segment connecting the landmark and the query point. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h index 42da5327077..ecce904547f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h @@ -18,8 +18,8 @@ // Author(s) : Idit Haran // Ron Wein -#ifndef CGAL_ARR_LANDMARKS_GENERATOR_H -#define CGAL_ARR_LANDMARKS_GENERATOR_H +#ifndef CGAL_ARR_LANDMARKS_GENERATOR_BASE_H +#define CGAL_ARR_LANDMARKS_GENERATOR_BASE_H /*! \file * Definition of the Arr_landmarks_generator_base template. @@ -87,70 +87,71 @@ protected: typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; // Data members: - const Traits_adaptor_2 *m_traits; // The associated traits object. - Nearest_neighbor nn; // The associated nearest neighbor object. - bool ignore_notifications; - bool updated; - int num_small_not_updated_changes; + const Traits_adaptor_2* m_traits; // The associated traits object. + Nearest_neighbor nn; // The associated nearest neighbor object. + bool m_ignore_notifications; + bool m_ignore_remove_edge; + bool updated; + int num_small_not_updated_changes; template PL_result_type pl_make_result(T t) { return PL_result::make_result(t); } - inline PL_result_type pl_default_result() { return PL_result::default_result(); } + inline PL_result_type pl_default_result() + { return PL_result::default_result(); } public: bool is_empty() const { return nn.is_empty(); } private: /*! Copy constructor - not supported. */ - Arr_landmarks_generator_base (const Self& ); + Arr_landmarks_generator_base(const Self&); /*! Assignment operator - not supported. */ - Self& operator= (const Self& ); + Self& operator=(const Self& ); public: - /*! Constructor. */ - Arr_landmarks_generator_base (const Arrangement_2& arr) : + /*! Constructor from an arrangement. + * \param arr (in) The arrangement. + */ + Arr_landmarks_generator_base(const Arrangement_2& arr) : Arr_observer (const_cast(arr)), - ignore_notifications (false), - updated (false), + m_traits(static_cast(arr.geometry_traits())), + m_ignore_notifications(false), + m_ignore_remove_edge(false), + updated(false), num_small_not_updated_changes(0) { - m_traits = static_cast (arr.geometry_traits()); // One needs to call build_landmark_set() in the constructor of any // inherited class. } - /*! - * Creates the landmarks set (choosing the landmarks) , + /*! Create the landmarks set (choosing the landmarks) , * and saving them in the nearest-neighbor search structure. */ - virtual void build_landmark_set () + virtual void build_landmark_set() { // Create the landmark points. - NN_Points_set nn_points; - + NN_Points_set nn_points; _create_nn_points_set(nn_points); // Update the search structure. nn.clear(); - nn.init (nn_points.begin(), nn_points.end()); + nn.init(nn_points.begin(), nn_points.end()); num_small_not_updated_changes = 0; updated = true; } - /*! - * clear the set of landmarks. + /*! clear the set of landmarks. */ - virtual void clear_landmark_set () + virtual void clear_landmark_set() { nn.clear(); num_small_not_updated_changes = 0; updated = false; } - /*! - * Get the nearest neighbor (landmark) to the given point. + /*! Obtain the nearest neighbor (landmark) to the given point. * \param p The query point. * \param obj Output: The location of the nearest landmark point in the * arrangement (a vertex, halfedge, or face handle). @@ -170,208 +171,295 @@ public: * arrangement. * \param arr The arrangement to be copied. */ - virtual void before_assign (const Arrangement_2& arr) + virtual void before_assign(const Arrangement_2& arr) { this->clear_landmark_set(); - m_traits = static_cast (arr.geometry_traits()); - ignore_notifications = true; + m_traits = static_cast(arr.geometry_traits()); + m_ignore_notifications = true; } - /*! - * Notification after the arrangement has been assigned with another + /*! Notification after the arrangement has been assigned with another * arrangement. */ - virtual void after_assign () + virtual void after_assign() { this->build_landmark_set(); - ignore_notifications = false; + m_ignore_notifications = false; } - /*! - * Notification before the observer is attached to an arrangement. + /*! Notification before the observer is attached to an arrangement. * \param arr The arrangement we are about to attach the observer to. */ - virtual void before_attach (const Arrangement_2& arr) + virtual void before_attach(const Arrangement_2& arr) { this->clear_landmark_set(); - m_traits = static_cast (arr.geometry_traits()); - ignore_notifications = true; + m_traits = static_cast(arr.geometry_traits()); + m_ignore_notifications = true; } - /*! - * Notification after the observer has been attached to an arrangement. + /*! Notification after the observer has been attached to an arrangement. */ - virtual void after_attach () + virtual void after_attach() { this->build_landmark_set(); - ignore_notifications = false; + m_ignore_notifications = false; } - /*! - * Notification before the observer is detached from the arrangement. + /*! Notification before the observer is detached from the arrangement. */ - virtual void before_detach () - { - this->clear_landmark_set(); - } + virtual void before_detach() + { this->clear_landmark_set(); } - /*! - * Notification after the arrangement is cleared. + /*! Notification after the arrangement is cleared. * \param u A handle to the unbounded face. */ - virtual void after_clear () + virtual void after_clear() { this->clear_landmark_set(); this->build_landmark_set(); } - /*! Notification before a global operation modifies the arrangement. */ - virtual void before_global_change () + /*! Notification before a global operation modifies the arrangement. + */ + virtual void before_global_change() { this->clear_landmark_set(); - ignore_notifications = true; + m_ignore_notifications = true; } - /*! Notification after a global operation is completed. */ - virtual void after_global_change () + /*! Notification after a global operation is completed. + */ + virtual void after_global_change() { this->build_landmark_set(); - ignore_notifications = false; + m_ignore_notifications = false; } //@} /// \name Overloaded observer functions on local changes. //@{ + /*! Notification before the removal of an edge. + * \param e (in) A handle to one of the twin halfedges to be removed. + */ + virtual void before_remove_edge(Halfedge_handle /* e */) + { m_ignore_remove_edge = true; } + /*! Notification after the creation of a new vertex. */ - virtual void after_create_vertex (Vertex_handle ) + virtual void after_create_vertex(Vertex_handle) { - this->_handle_local_change_notification(); - } - - /*! Notification after the creation of a new edge. */ - virtual void after_create_edge (Halfedge_handle ) - { this->_handle_local_change_notification(); } - - /*! Notification after an edge was split. */ - virtual void after_split_edge(Halfedge_handle, Halfedge_handle) - { this->_handle_local_change_notification(); } - - /*! Notification after a face was split. */ - virtual void after_split_face(Face_handle, Face_handle, bool) - { this->_handle_local_change_notification(); } - - /*! Notification after an outer CCB was split.*/ - virtual void after_split_outer_ccb (Face_handle , - Ccb_halfedge_circulator , - Ccb_halfedge_circulator ) - { this->_handle_local_change_notification(); } - - /*! Notification after an inner CCB was split. */ - virtual void after_split_inner_ccb (Face_handle , - Ccb_halfedge_circulator , - Ccb_halfedge_circulator ) - { this->_handle_local_change_notification(); } - - /*! Notification after an outer CCB was added to a face. */ - virtual void after_add_outer_ccb (Ccb_halfedge_circulator ) - { - this->_handle_local_change_notification(); - } - - /*! Notification after an inner CCB was created inside a face. */ - virtual void after_add_inner_ccb (Ccb_halfedge_circulator ) - { this->_handle_local_change_notification(); } - - /*! Notification after an isolated vertex was created inside a face. */ - virtual void after_add_isolated_vertex (Vertex_handle ) - { this->_handle_local_change_notification(); } - - /*! Notification after an edge was merged. */ - virtual void after_merge_edge (Halfedge_handle ) - { this->_handle_local_change_notification(); } - - /*! Notification after a face was merged. */ - virtual void after_merge_face (Face_handle ) - { this->_handle_local_change_notification(); } - - /*! Notification after an outer CCB was merged. */ - virtual void after_merge_outer_ccb(Face_handle, Ccb_halfedge_circulator) - { this->_handle_local_change_notification(); } - - /*! Notification after an inner CCB was merged. */ - virtual void after_merge_inner_ccb(Face_handle, Ccb_halfedge_circulator) - { this->_handle_local_change_notification(); } - - /*! Notification after an outer CCB is moved from one face to another. */ - virtual void after_move_outer_ccb (Ccb_halfedge_circulator ) - { this->_handle_local_change_notification(); } - - /*! Notification after an inner CCB is moved from one face to another. */ - virtual void after_move_inner_ccb (Ccb_halfedge_circulator ) - { this->_handle_local_change_notification(); } - - /*! Notification after an isolated vertex is moved. */ - virtual void after_move_isolated_vertex (Vertex_handle ) - { this->_handle_local_change_notification(); } - - /*! Notificaion after the removal of a vertex. */ - virtual void after_remove_vertex () - { this->_handle_local_change_notification(); } - - /*! Notification after the removal of an edge. */ - virtual void after_remove_edge () - { this->_handle_local_change_notification(); } - - /*! Notificaion after the removal of an outer CCB. */ - virtual void after_remove_outer_ccb (Face_handle ) - { this->_handle_local_change_notification(); } - - /*! Notificaion after the removal of an inner CCB. */ - virtual void after_remove_inner_ccb (Face_handle ) - { this->_handle_local_change_notification(); } - //@} - -protected: - /*! Handle a change notification. */ - void _handle_local_change_notification () - { - if (! ignore_notifications) { + if (! m_ignore_notifications) { clear_landmark_set(); build_landmark_set(); } } - /*! - * This function creates the list of landmarks with their location. + /*! Notification after the creation of a new edge. */ + virtual void after_create_edge(Halfedge_handle) + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after an edge was split. */ + virtual void after_split_edge(Halfedge_handle, Halfedge_handle) + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after a face was split. */ + virtual void after_split_face(Face_handle, Face_handle, bool) + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after an outer CCB was split.*/ + virtual void after_split_outer_ccb(Face_handle, + Ccb_halfedge_circulator, + Ccb_halfedge_circulator) + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after an inner CCB was split. */ + virtual void after_split_inner_ccb(Face_handle, + Ccb_halfedge_circulator, + Ccb_halfedge_circulator) + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after an outer CCB was added to a face. */ + virtual void after_add_outer_ccb(Ccb_halfedge_circulator) + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after an inner CCB was created inside a face. */ + virtual void after_add_inner_ccb(Ccb_halfedge_circulator) + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after an isolated vertex was created inside a face. */ + virtual void after_add_isolated_vertex(Vertex_handle) + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after an edge was merged. */ + virtual void after_merge_edge(Halfedge_handle) + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after a face was merged. */ + virtual void after_merge_face(Face_handle) + { + if (! m_ignore_notifications && ! m_ignore_remove_edge) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after an outer CCB was merged. */ + virtual void after_merge_outer_ccb(Face_handle, Ccb_halfedge_circulator) + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after an inner CCB was merged. */ + virtual void after_merge_inner_ccb(Face_handle, Ccb_halfedge_circulator) + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after an outer CCB is moved from one face to another. */ + virtual void after_move_outer_ccb(Ccb_halfedge_circulator ) + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after an inner CCB is moved from one face to another. */ + virtual void after_move_inner_ccb(Ccb_halfedge_circulator ) + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after an isolated vertex is moved. */ + virtual void after_move_isolated_vertex(Vertex_handle ) + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notificaion after the removal of a vertex. */ + virtual void after_remove_vertex() + { + if (! m_ignore_notifications && ! m_ignore_remove_edge) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notification after the removal of an edge. */ + virtual void after_remove_edge() + { + if (! m_ignore_notifications) { + clear_landmark_set(); + build_landmark_set(); + } + m_ignore_remove_edge = false; + } + + /*! Notificaion after the removal of an outer CCB. */ + virtual void after_remove_outer_ccb(Face_handle) + { + if (! m_ignore_notifications && ! m_ignore_remove_edge) { + clear_landmark_set(); + build_landmark_set(); + } + } + + /*! Notificaion after the removal of an inner CCB. */ + virtual void after_remove_inner_ccb(Face_handle) + { + if (! m_ignore_notifications && ! m_ignore_remove_edge) { + clear_landmark_set(); + build_landmark_set(); + } + } + //@} + +protected: + /*! Create the list of landmarks with their location. * This is a pure virtual function, and the class that inherites from * this generator must implement it. */ - virtual void _create_points_set (Points_set &) = 0; + virtual void _create_points_set(Points_set&) = 0; - virtual void _create_nn_points_set (NN_Points_set &nn_points) + virtual void _create_nn_points_set(NN_Points_set& nn_points) { - Points_set points; - Pairs_set pairs; + Points_set points; + Pairs_set pairs; // Create the set of landmark points. _create_points_set(points); // Locate the landmarks in the arrangement using batched point-location // global function. - locate (*(this->arrangement()), points.begin(), points.end(), - std::back_inserter(pairs)); + locate(*(this->arrangement()), points.begin(), points.end(), + std::back_inserter(pairs)); // Apply a random shuffle on the points, since the batched point-location // returns them sorted. - std::random_shuffle (pairs.begin(), pairs.end()); + std::random_shuffle(pairs.begin(), pairs.end()); // Insert all landmarks (paired with their current location in the // arrangement) into the nearest-neighbor search structure. - Pairs_iterator itr; - + Pairs_iterator itr; for (itr = pairs.begin(); itr != pairs.end(); ++itr) { - NN_Point_2 np(itr->first, itr->second); + NN_Point_2 np(itr->first, itr->second); nn_points.push_back(np); } } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h index a706e3d0b9a..3709e86a5c2 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h @@ -17,8 +17,9 @@ // // Author(s) : Idit Haran // Ron Wein -#ifndef CGAL_ARR_LM_GRID_GENERATOR_H -#define CGAL_ARR_LM_GRID_GENERATOR_H + +#ifndef CGAL_ARR_LANDMARKS_GRID_GENERATOR_H +#define CGAL_ARR_LANDMARKS_GRID_GENERATOR_H /*! \file * Definition of the Arr_grid_landmarks_generator template. @@ -73,17 +74,17 @@ protected: typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; // Data members: - const Traits_adaptor_2* m_traits; - unsigned int num_landmarks; - Pairs_set lm_pairs; + const Traits_adaptor_2* m_traits; + unsigned int num_landmarks; + Pairs_set lm_pairs; - ANT x_min, y_min; // Bounding box for the - ANT x_max, y_max; // arrangement vertices. - ANT step_x, step_y; // Grid step sizes. - unsigned int sqrt_n; + ANT x_min, y_min; // Bounding box for the + ANT x_max, y_max; // arrangement vertices. + ANT step_x, step_y; // Grid step sizes. + unsigned int sqrt_n; - bool fixed_number_of_lm; // indicates if the constructor got - // number of landmarks as parameter + bool fixed_number_of_lm; // indicates if the constructor got + // number of landmarks as parameter private: /*! Copy constructor - not supported. */ @@ -93,34 +94,35 @@ private: Self& operator=(const Self&); public: - /*! Constructor. */ + /*! Constructor from an arrangement. + * \param arr (in) The arrangement. + */ Arr_grid_landmarks_generator(const Arrangement_2& arr) : Base(arr), + m_traits(static_cast(arr.geometry_traits())), num_landmarks(0), fixed_number_of_lm(false) { - m_traits = static_cast(arr.geometry_traits()); build_landmark_set();//this-> } Arr_grid_landmarks_generator(const Arrangement_2& arr, unsigned int n_landmarks) : Base(arr), + m_traits(static_cast(arr.geometry_traits())), num_landmarks(n_landmarks), fixed_number_of_lm(true) { - m_traits = static_cast(arr.geometry_traits()); build_landmark_set();//this-> } - /*! - * Create the landmarks set (choosing the landmarks), + /*! Create the landmarks set (choosing the landmarks), * and store them in the nearest neighbor search structure. */ virtual void build_landmark_set() { // Create a set of points on a grid. - Points_set points; + Points_set points; _create_points_set(points); // Locate the landmarks in the arrangement using batched point-location // global function. Note that the resulting pairs are returned sorted by @@ -131,8 +133,7 @@ public: this->updated = true; } - /*! - * Clear the set of landmarks. + /*! Clear the set of landmarks. */ virtual void clear_landmark_set() { @@ -140,11 +141,10 @@ public: this->updated = false; } - /*! - * Get the nearest neighbor (landmark) to the given point. + /*! Obtain the nearest neighbor (landmark) to the given point. * \param q The query point. - * \param obj Output: The location of the nearest landmark point in the - * arrangement (a vertex, halfedge, or face handle). + * \param obj (out) The location of the nearest landmark point in the + * arrangement (a vertex, halfedge, or face handle). * \return The nearest landmark point. */ virtual Point_2 closest_landmark(const Point_2& q, PL_result_type& obj) @@ -152,26 +152,17 @@ public: CGAL_assertion(this->updated); // Calculate the index of the nearest grid point point to q. - const ANT qx = m_traits->approximate_2_object()(q, 0); - const ANT qy = m_traits->approximate_2_object()(q, 1); - unsigned int i, j; - unsigned int index; - - if (CGAL::compare(qx, x_min) == SMALLER) - i = 0; - else if (CGAL::compare(qx, x_max) == LARGER) - i = sqrt_n - 1; - else - i = static_cast(((qx - x_min) / step_x) + 0.5); - - if (CGAL::compare(qy, y_min) == SMALLER) - j = 0; - else if (CGAL::compare(qy, y_max) == LARGER) - j = sqrt_n - 1; - else - j = static_cast(((qy - y_min) / step_y) + 0.5); - - index = sqrt_n * i + j; + typename Geometry_traits_2::Approximate_2 approximate = + m_traits->approximate_2_object(); + const ANT qx = approximate(q, 0); + const ANT qy = approximate(q, 1); + unsigned int i = (CGAL::compare(qx, x_min) == SMALLER) ? 0 : + (CGAL::compare(qx, x_max) == LARGER) ? (sqrt_n - 1) : + static_cast(((qx - x_min) / step_x) + 0.5); + unsigned int j = (CGAL::compare(qy, y_min) == SMALLER) ? 0 : + (CGAL::compare(qy, y_max) == LARGER) ? (sqrt_n - 1) : + static_cast(((qy - y_min) / step_y) + 0.5); + unsigned int index = sqrt_n * i + j; // Return the result. obj = lm_pairs[index].second; @@ -179,8 +170,7 @@ public: } protected: - /*! - * Create a set of landmark points on a grid. + /*! Create a set of landmark points on a grid. */ virtual void _create_points_set(Points_set& points) { @@ -203,34 +193,29 @@ protected: return; } - ANT x, y; - Vertex_const_iterator left, right, top, bottom; + ANT x, y; + Vertex_const_iterator left, right, top, bottom; left = right = top = bottom = vit; - for (++vit; vit != arr->vertices_end(); ++vit) - { + for (++vit; vit != arr->vertices_end(); ++vit) { x = m_traits->approximate_2_object()(vit->point(), 0); y = m_traits->approximate_2_object()(vit->point(), 1); - if (CGAL::compare(x, x_min) == SMALLER) - { + if (CGAL::compare(x, x_min) == SMALLER) { x_min = x; left = vit; } - else if (CGAL::compare(x, x_max) == LARGER) - { + else if (CGAL::compare(x, x_max) == LARGER) { x_max = x; right = vit; } - if (CGAL::compare(y, y_min) == SMALLER) - { + if (CGAL::compare(y, y_min) == SMALLER) { y_min = y; bottom = vit; } - else if (CGAL::compare(y, y_max) == LARGER) - { + else if (CGAL::compare(y, y_max) == LARGER) { y_max = y; top = vit; } @@ -249,20 +234,15 @@ protected: CGAL_assertion(sqrt_n > 1); // Calculate the step sizes for the grid. - ANT delta_x = m_traits->approximate_2_object()(right->point(), 0) - - m_traits->approximate_2_object()(left->point(), 0); - ANT delta_y = m_traits->approximate_2_object()(top->point(), 1) - - m_traits->approximate_2_object()(bottom->point(), 1); - - if (CGAL::sign(delta_x) == CGAL::ZERO) - delta_x = delta_y; - - if (CGAL::sign(delta_y) == CGAL::ZERO) - delta_y = delta_x; + ANT delta_x = m_traits->approximate_2_object()(right->point(), 0) - + m_traits->approximate_2_object()(left->point(), 0); + ANT delta_y = m_traits->approximate_2_object()(top->point(), 1) - + m_traits->approximate_2_object()(bottom->point(), 1); + if (CGAL::sign(delta_x) == CGAL::ZERO) delta_x = delta_y; + if (CGAL::sign(delta_y) == CGAL::ZERO) delta_y = delta_x; CGAL_assertion((CGAL::sign(delta_x) == CGAL::POSITIVE) && (CGAL::sign(delta_y) == CGAL::POSITIVE)); - step_x = delta_x / (sqrt_n - 1); step_y = delta_y / (sqrt_n - 1); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h index f033b79de13..a173a551fd4 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h @@ -17,8 +17,9 @@ // // Author(s) : Idit Haran // Ron Wein -#ifndef CGAL_ARR_LM_HALTON_GENERATOR_H -#define CGAL_ARR_LM_HALTON_GENERATOR_H + +#ifndef CGAL_ARR_LANDMARKS_HALTON_GENERATOR_H +#define CGAL_ARR_LANDMARKS_HALTON_GENERATOR_H /*! \file * Definition of the Arr_halton_landmarks_generator template. @@ -55,7 +56,7 @@ public: protected: // Data members: - unsigned int num_landmarks; + unsigned int num_landmarks; private: /*! Copy constructor - not supported. */ @@ -64,10 +65,12 @@ private: /*! Assignment operator - not supported. */ Self& operator=(const Self&); -public: - /*! Constructor. */ +public: + /*! Constructor from an arrangement. + * \param arr (in) The arrangement. + */ Arr_halton_landmarks_generator(const Arrangement_2& arr, - unsigned int n_landmarks = 0) : + unsigned int n_landmarks = 0) : Base(arr), num_landmarks(n_landmarks) { this->build_landmark_set(); } @@ -79,18 +82,18 @@ protected: * The Halton points are constructed in the bounding rectangle of the * arrangement vertices. */ - virtual void _create_points_set (Points_set& points) + virtual void _create_points_set(Points_set& points) { points.clear(); // Go over the arrangement vertices and construct their boundig box. const Arrangement_2* arr = this->arrangement(); - Vertex_const_iterator vit; + Vertex_const_iterator vit; double x_min = 0, x_max = 1, y_min = 0, y_max = 1; double x, y; bool first = true; - for (vit=arr->vertices_begin(); vit != arr->vertices_end(); ++vit) { + for (vit = arr->vertices_begin(); vit != arr->vertices_end(); ++vit) { x = CGAL::to_double(vit->point().x()); y = CGAL::to_double(vit->point().y()); @@ -100,15 +103,11 @@ protected: first = false; } else { - if (x < x_min) - x_min = x; - else if (x > x_max) - x_max = x; + if (x < x_min) x_min = x; + else if (x > x_max) x_max = x; - if (y < y_min) - y_min = y; - else if (y > y_max) - y_max = y; + if (y < y_min) y_min = y; + else if (y > y_max) y_max = y; } } @@ -117,11 +116,10 @@ protected: if (num_landmarks == 0) num_landmarks = static_cast(arr->number_of_vertices()); - if (num_landmarks == 0) - return; + if (num_landmarks == 0) return; if (num_landmarks == 1) { - points.push_back (Point_2 (x_max, y_max)); + points.push_back (Point_2 (x_max, y_max)); return; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h index 8e87b2b634d..7145e9b65d4 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h @@ -17,8 +17,9 @@ // // // Author(s) : Idit Haran -#ifndef CGAL_ARR_LM_MIDDLE_EDGES_GENERATOR_H -#define CGAL_ARR_LM_MIDDLE_EDGES_GENERATOR_H + +#ifndef CGAL_ARR_LANDMARKS_MIDDLE_EDGES_GENERATOR_H +#define CGAL_ARR_LANDMARKS_MIDDLE_EDGES_GENERATOR_H /*! \file * Definition of the Arr_middle_edges_landmarks_generator template. @@ -81,7 +82,10 @@ private: Self& operator=(const Self&); public: - /*! Constructor. */ + /*! Constructor from an arrangement. + * \param arr(in) The arrangement. + * \param lm_num(in) + */ Arr_middle_edges_landmarks_generator(const Arrangement_2& arr, int /* lm_num */ = -1) : Base(arr) @@ -93,20 +97,19 @@ public: // Observer functions that should be empty, because they // got nothing to do with middle edges //------------------------------------------------- - virtual void after_create_vertex (Vertex_handle /* v */) {} - virtual void after_split_face (Face_handle /* f */, - Face_handle /* new_f */, bool /* is_hole */) + virtual void after_create_vertex(Vertex_handle /* v */) {} + virtual void after_split_face(Face_handle /* f */, + Face_handle /* new_f */, bool /* is_hole */) {} - virtual void after_add_hole (Ccb_halfedge_circulator /* h */) {} + virtual void after_add_hole(Ccb_halfedge_circulator /* h */) {} - virtual void after_merge_face (Face_handle /* f */) {} - virtual void after_move_hole (Ccb_halfedge_circulator /* h */) {} - virtual void after_remove_vertex () {} - virtual void after_remove_hole (Face_handle /* f */) {} + virtual void after_merge_face(Face_handle /* f */) {} + virtual void after_move_hole(Ccb_halfedge_circulator /* h */) {} + virtual void after_remove_vertex() {} + virtual void after_remove_hole(Face_handle /* f */) {} protected: - /*! - * create a set of middle_edges points + /*! Create a set of middle_edges points * the number of points is equal to the number of edges in the arrangement. */ virtual void _create_nn_points_set(NN_Points_set& nn_points) @@ -116,12 +119,11 @@ protected: Halfedge_const_handle hh; Arrangement_2* arr = this->arrangement(); - if (arr->number_of_vertices() == 1) - { + if (arr->number_of_vertices() == 1) { //special treatment for arrangement with one isolated verrtex Vertex_const_iterator vit = arr->vertices_begin(); PL_result_type obj = this->pl_make_result(vit); - Point_2 p (vit->point()); + Point_2 p(vit->point()); NN_Point_2 np(p, obj); nn_points.push_back(np); @@ -132,7 +134,7 @@ protected: hh = eit; const Point_2& p1 = hh->source()->point(); const Point_2& p2 = hh->target()->point(); - Point_2 p ((p1.x()+p2.x())/2, (p1.y()+p2.y())/2); + Point_2 p((p1.x()+p2.x())/2, (p1.y()+p2.y())/2); //CGAL_PRINT_DEBUG("mid point is= " << p); @@ -142,9 +144,9 @@ protected: } } - virtual void _create_points_set (Points_set & /* points */) + virtual void _create_points_set(Points_set& /* points */) { - std::cerr << "should not reach here!"<< std::endl; + std::cerr << "should not reach here!" << std::endl; CGAL_error(); } }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h index 09206e2a0e1..92cf9950403 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h @@ -14,11 +14,12 @@ // // $URL$ // $Id$ -// +// // Author(s) : Idit Haran // Ron Wein -#ifndef CGAL_ARR_LM_RANDOM_GENERATOR_H -#define CGAL_ARR_LM_RANDOM_GENERATOR_H + +#ifndef CGAL_ARR_LANDMARKS_RANDOM_GENERATOR_H +#define CGAL_ARR_LANDMARKS_RANDOM_GENERATOR_H /*! \file * Definition of the Arr_random_landmarks_generator template. @@ -57,40 +58,41 @@ public: protected: // Data members: - unsigned int num_landmarks; + unsigned int num_landmarks; private: /*! Copy constructor - not supported. */ - Arr_random_landmarks_generator (const Self& ); + Arr_random_landmarks_generator(const Self&); /*! Assignment operator - not supported. */ - Self& operator= (const Self& ); + Self& operator=(const Self&); -public: - /*! Constructor. */ - Arr_random_landmarks_generator (const Arrangement_2& arr, - unsigned int n_landmarks = 0) : - Base (arr), - num_landmarks (n_landmarks) +public: + /*! Constructor from an arrangement. + * \param arr (in) The arrangement. + */ + Arr_random_landmarks_generator(const Arrangement_2& arr, + unsigned int n_landmarks = 0) : + Base(arr), + num_landmarks(n_landmarks) { this->build_landmark_set(); } protected: - /*! - * Create a set of random points (the number of points is given as a + /*! Create a set of random points (the number of points is given as a * parameter to the constructor, or is taken from the arrangement size). * The coordinates of the landmarks are selected randomly in the - * bounding rectangle of the Arrangement's vertices + * bounding rectangle of the Arrangement's vertices */ - virtual void _create_points_set (Points_set& points) + virtual void _create_points_set(Points_set& points) { points.clear(); // Go over the arrangement vertices and construct their boundig box. - const Arrangement_2 *arr = this->arrangement(); - Vertex_const_iterator vit; - double x_min = 0, x_max = 1, y_min = 0, y_max = 1; - double x, y; - bool first = true; + const Arrangement_2* arr = this->arrangement(); + Vertex_const_iterator vit; + double x_min = 0, x_max = 1, y_min = 0, y_max = 1; + double x, y; + bool first = true; for (vit=arr->vertices_begin(); vit != arr->vertices_end(); ++vit) { x = CGAL::to_double(vit->point().x()); @@ -102,15 +104,11 @@ protected: first = false; } else { - if (x < x_min) - x_min = x; - else if (x > x_max) - x_max = x; + if (x < x_min) x_min = x; + else if (x > x_max) x_max = x; - if (y < y_min) - y_min = y; - else if (y > y_max) - y_max = y; + if (y < y_min) y_min = y; + else if (y > y_max) y_max = y; } } @@ -123,10 +121,9 @@ protected: for (unsigned int i = 0; i < num_landmarks; ++i) { double px = (x_min == x_max) ? x_min : random.get_double(x_min, x_max); double py = (y_min == y_max) ? y_min : random.get_double(y_min, y_max); - points.push_back(Point_2 (px, py)); + points.push_back(Point_2(px, py)); } } - }; } //namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h index 0e4dc4f3994..813d9277cd0 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h @@ -14,11 +14,11 @@ // // $URL$ // $Id$ -// +// // Author(s) : Shlomo Golubev -#ifndef CGAL_ARR_SPECIFIED_POINTS_GENERATOR_H -#define CGAL_ARR_SPECIFIED_POINTS_GENERATOR_H +#ifndef CGAL_ARR_LANDMARKS_SPECIFIED_POINTS_GENERATOR_H +#define CGAL_ARR_LANDMARKS_SPECIFIED_POINTS_GENERATOR_H /*! \file * Definition of the Arr_lm_specified_points_generator template. @@ -65,7 +65,7 @@ public: typedef typename Nearest_neighbor::NN_Point_2 NN_Point_2; typedef std::list NN_Point_list; - + protected: typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; typedef typename Base::PL_result_type PL_result_type; @@ -85,26 +85,28 @@ private: /*! Assignment operator - not supported. */ Self& operator=(const Self&); -public: - /*! Constructor. */ +public: + /*! Constructor. + * Create landmarks in the points that are given to it. + */ Arr_landmarks_specified_points_generator(const Arrangement_2& arr, const Points_set points) : Base(arr), + m_traits(static_cast(arr.geometry_traits())), + m_points(points), num_landmarks(points.size()) - { - //this constructor creates landmarks in the points that are given to it - m_traits = static_cast(arr.geometry_traits()); - m_points = points; - build_landmark_set(); - } + { build_landmark_set(); } + /*! Constructor. from an arrangement. + * \param arr (in) The arrangement. + */ Arr_landmarks_specified_points_generator(const Arrangement_2& arr) : - Base(arr) + Base(arr), + m_traits(static_cast (arr.geometry_traits())), + num_landmarks(1) { //this constructor creates a single landmark in the origin m_points.push_back(Point_2(0,0)); - num_landmarks = 1; - m_traits = static_cast (arr.geometry_traits()); build_landmark_set(); } @@ -114,28 +116,24 @@ public: CGAL_error(); } - /*! - * Creates the landmark set, using all arrangement vertices. + /*! Create the landmark set, using all arrangement vertices. */ void build_landmark_set() { - lm_pairs.clear(); - locate (*(this->arrangement()), m_points.begin(), m_points.end(), - std::back_inserter(lm_pairs)); + locate(*(this->arrangement()), m_points.begin(), m_points.end(), + std::back_inserter(lm_pairs)); // Go over the container of the specified points and insert them as // landmarks. - NN_Point_list nnp_list; + NN_Point_list nnp_list; typename Points_set::iterator pt_it; typename Pairs_set::iterator pairs_it; - for (pt_it = m_points.begin(); pt_it != m_points.end(); ++pt_it) - { + for (pt_it = m_points.begin(); pt_it != m_points.end(); ++pt_it) { for (pairs_it = lm_pairs.begin(); pairs_it != lm_pairs.end() && (*pairs_it).first != (*pt_it); ++pairs_it) {}; - if ((*pairs_it).first == (*pt_it)) - { + if ((*pairs_it).first == (*pt_it)) { nnp_list.push_back (NN_Point_2 ((*pt_it),(*pairs_it).second)); } } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h index 806f7b35626..8b3c2bc183e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // Author(s) : Idit Haran // Ron Wein #ifndef CGAL_ARR_LANDMARKS_VERTICES_GENERATOR_H @@ -57,7 +57,7 @@ public: typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; typedef typename Arrangement_2::Face_handle Face_handle; typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator; - + typedef typename Arrangement_2::Point_2 Point_2; typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2; @@ -81,28 +81,29 @@ private: Self& operator=(const Self&); public: - /*! Constructor. */ + /*! Constructor from an arrangement. + * \param arr (in) The arrangement. + */ Arr_landmarks_vertices_generator(const Arrangement_2& arr) : - Base (arr), + Base(arr), num_landmarks(0) { - m_traits = static_cast (arr.geometry_traits()); + m_traits = static_cast(arr.geometry_traits()); build_landmark_set();//this-> } virtual void _create_points_set(Points_set & /* points */) { - std::cerr << "should not reach here!"<< std::endl; + std::cerr << "should not reach here!" << std::endl; CGAL_error(); } - /*! - * Creates the landmark set, using all arrangement vertices. + /*! Create the landmark set, using all arrangement vertices. */ virtual void build_landmark_set() { // Go over the arrangement, and insert all its vertices as landmarks. - NN_Point_list nnp_list; + NN_Point_list nnp_list; const Arrangement_2* arr = this->arrangement(); Vertex_const_iterator vit; num_landmarks = 0; @@ -120,10 +121,9 @@ public: this->updated = true; } - /*! - * Clear the landmark set. + /*! Clear the landmark set. */ - virtual void clear_landmark_set () + virtual void clear_landmark_set() { this->nn.clear(); num_landmarks = 0; @@ -132,13 +132,14 @@ public: } protected: - /*! Handle a local change. */ + /*! Handle a local change. + */ void _handle_local_change_notification() { // Rebuild the landmark set only if the number of small // changes is greater than sqrt(num_landmarks). - double nl = static_cast(num_landmarks); - const int sqrt_num_landmarks = static_cast (std::sqrt (nl) + 0.5); + double nl = static_cast(num_landmarks); + const int sqrt_num_landmarks = static_cast(std::sqrt(nl) + 0.5); this->num_small_not_updated_changes++; if ((num_landmarks < 10) || diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h index e776e811343..9788270153c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h @@ -26,7 +26,7 @@ * Arr_triangulation_point_location class. */ -#define CGAL_TRG_DEBUG +// #define CGAL_TRG_DEBUG #ifdef CGAL_TRG_DEBUG #define CGAL_TRG_PRINT_DEBUG(expr) std::cout << expr << std::endl @@ -79,7 +79,7 @@ Arr_triangulation_point_location::locate(const Point_2& p) //locate point int li; CDT_Locate_type cdt_lt; - CDT_Face_handle fh = cdt.locate(p1, cdt_lt, li); + CDT_Face_handle fh = m_cdt.locate(p1, cdt_lt, li); switch (cdt_lt) { case CDT::OUTSIDE_AFFINE_HULL: @@ -94,7 +94,7 @@ Arr_triangulation_point_location::locate(const Point_2& p) case CDT::EDGE: CGAL_TRG_PRINT_DEBUG("locate type = edge" << li); //li is the index of the vertex OPOSITE to the edge - if (cdt.is_constrained(CDT_Edge(fh,li))) { + if (m_cdt.is_constrained(CDT_Edge(fh,li))) { //the edge found is an edge in the plannar map CGAL_TRG_PRINT_DEBUG("the edge is a constrained"); //get the 2 vertices incident to the edge in the plannar map @@ -201,7 +201,7 @@ go over all halfedges, and insert each halfedge as a constraint to the cdt. */ template void Arr_triangulation_point_location::clear_triangulation() -{ cdt.clear(); } +{ m_cdt.clear(); } //---------------------------------------------------- /*! triangulate the arrangement into a cdt (Constaint Delauney Triangulation): @@ -234,30 +234,27 @@ void Arr_triangulation_point_location::build_triangulation() if (m_traits->equal_2_object()(pm_p1, pm_p2)) { std::cerr << "WARNING: source point is equal to destination point!!! " << pm_p1 << std::endl ; - CDT_Vertex_handle cdt_vh1 = cdt.insert(cdt_p1); + CDT_Vertex_handle cdt_vh1 = m_cdt.insert(cdt_p1); cdt_vh1->info() = pm_vh1; continue; } //insert vertices to the CDT - CDT_Vertex_handle cdt_vh1 = cdt.insert(cdt_p1); - CDT_Vertex_handle cdt_vh2 = cdt.insert(cdt_p2); + CDT_Vertex_handle cdt_vh1 = m_cdt.insert(cdt_p1); + CDT_Vertex_handle cdt_vh2 = m_cdt.insert(cdt_p2); //connect new CDT vertex with Pm vertex cdt_vh1->info() = pm_vh1; cdt_vh2->info() = pm_vh2; //add constraint from the two points - cdt.insert_constraint(cdt_vh1, cdt_vh2); + m_cdt.insert_constraint(cdt_vh1, cdt_vh2); //print CGAL_TRG_PRINT_DEBUG("source = " << pm_p1 << " , target = " << pm_p2); } - //the triangulation is now updated - updated_cdt = true; - - CGAL_assertion(cdt.is_valid()); + CGAL_assertion(m_cdt.is_valid()); CGAL_TRG_PRINT_DEBUG("finished updating the CDT "); } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h index 25a534d92bf..e531adc5112 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h @@ -15,7 +15,6 @@ // $URL$ // $Id$ // -// // Author(s) : Idit Haran #ifndef CGAL_ARR_TRIANGULATION_POINT_LOCATION_H @@ -39,9 +38,8 @@ namespace CGAL { /*! \class - * A class that answers point-location and queries - * on a planar arrangement using the triangulation algorithm. - * The Arrangement parameter corresponds to an arrangement instantiation. + * A class that answers point-location queries on an arrangement using the + * triangulation algorithm. */ template class Arr_triangulation_point_location : public Arr_observer @@ -116,8 +114,7 @@ protected: const Traits_adaptor_2* m_traits; // Its associated traits object. bool m_ignore_notifications; bool m_ignore_remove_edge; - CDT cdt; - bool updated_cdt; + CDT m_cdt; template Result_type make_result(T t) const { return Result::make_result(t); } @@ -131,7 +128,8 @@ public: m_ignore_remove_edge(false) {} - /*! Constructor given an arrangement. + /*! Constructor from an arrangement. + * \param arr (in) The arrangement. */ Arr_triangulation_point_location(const Arrangement_2& arr) : Arr_observer(const_cast(arr)), @@ -141,7 +139,7 @@ public: { build_triangulation(); } /*! Locate the arrangement feature containing the given point. - * \param p The query point. + * \param p (in) The query point. * \return An object representing the arrangement feature containing the * query point. This object is either a Face_const_handle or a * Halfedge_const_handle or a Vertex_const_handle. @@ -151,7 +149,8 @@ public: //Observer functions that are relevant to overload //------------------------------------------------- - /*! Attach an arrangement object. + /*! Attach an arrangement. + * \param arr (in) The arrangement. */ virtual void before_attach(const Arrangement_2& arr) { m_traits = static_cast(arr.geometry_traits()); } @@ -160,6 +159,9 @@ public: virtual void before_detach() { clear_triangulation(); } + /// \name Overloaded observer functions on global changes. + //@{ + /*! Notification after the arrangement has been assigned with another * arrangement. */ @@ -181,7 +183,6 @@ public: */ virtual void before_global_change() { - std::cout << "before_global_change()" << std::endl; clear_triangulation(); m_ignore_notifications = true; } @@ -190,22 +191,22 @@ public: */ virtual void after_global_change() { - std::cout << "after_global_change()" << std::endl; build_triangulation(); m_ignore_notifications = false; } + //@} + + /// \name Overloaded observer functions on local changes. + //@{ /*! Notification before the removal of an edge. - * \param e A handle to one of the twin halfedges to be deleted. + * \param e (in) A handle to one of the twin halfedges to be removed. */ virtual void before_remove_edge(Halfedge_handle /* e */) - { - std::cout << "before_remove_edge()" << std::endl; - m_ignore_remove_edge = true; - } + { m_ignore_remove_edge = true; } /*! Notification after the creation of a new vertex. - * \param v A handle to the created vertex. + * \param v (in) A handle to the created vertex. */ virtual void after_create_vertex(Vertex_handle /* v */) { @@ -216,7 +217,7 @@ public: } /*! Notification after the creation of a new edge. - * \param e A handle to one of the twin halfedges that were created. + * \param e (in) A handle to one of the twin halfedges that were created. */ virtual void after_create_edge(Halfedge_handle /* e */) { @@ -227,13 +228,12 @@ public: } /*! Notification after an edge was split. - * \param e1 A handle to one of the twin halfedges forming the first edge. - * \param e2 A handle to one of the twin halfedges forming the second edge. + * \param e1 (in) A handle to one of the twin halfedges forming the first edge. + * \param e2 (in) A handle to one of the twin halfedges forming the second edge. */ virtual void after_split_edge(Halfedge_handle /* e1 */, Halfedge_handle /* e2 */) { - std::cout << "after_split_edge()" << std::endl; if (! m_ignore_notifications) { clear_triangulation(); build_triangulation(); @@ -241,15 +241,14 @@ public: } /*! Notification after a face was split. - * \param f A handle to the face we have just split. - * \param new_f A handle to the new face that has been created. - * \param is_hole Whether the new face forms a hole inside f. + * \param f (in) A handle to the face we have just split. + * \param new_f (in) A handle to the new face that has been created. + * \param is_hole (in) Whether the new face forms a hole inside f. */ virtual void after_split_face(Face_handle /* f */, Face_handle /* new_f */, bool /* is_hole */) { - std::cout << "after_split_face()" << std::endl; if (! m_ignore_notifications) { clear_triangulation(); build_triangulation(); @@ -257,11 +256,10 @@ public: } /*! Notification after an outer CCB was created inside a face. - * \param h A circulator representing the boundary of the new outer CCB. + * \param h (in) A circulator representing the boundary of the new outer CCB. */ virtual void after_add_outer_ccb(Ccb_halfedge_circulator /* h */) { - std::cout << "after_add_outer_ccb()" << std::endl; if (! m_ignore_notifications) { clear_triangulation(); build_triangulation(); @@ -269,7 +267,7 @@ public: } /*! Notification after an edge was merged. - * \param e A handle to one of the twin halfedges forming the merged edge. + * \param e (in) A handle to one of the twin halfedges forming the merged edge. */ virtual void after_merge_edge(Halfedge_handle /* e */) { @@ -280,11 +278,10 @@ public: } /*! Notification after a face was merged. - * \param f A handle to the merged face. + * \param f (in) A handle to the merged face. */ virtual void after_merge_face(Face_handle /* f */) { - std::cout << "after_merge_face() " << std::endl; if (! m_ignore_notifications && ! m_ignore_remove_edge) { clear_triangulation(); build_triangulation(); @@ -292,11 +289,10 @@ public: } /*! Notification after an outer CCB is moved from one face to another. - * \param h A circulator representing the boundary of the component. + * \param h (in) A circulator representing the boundary of the component. */ virtual void after_move_outer_ccb(Ccb_halfedge_circulator /* h */) { - std::cout << "after_move_outer_ccb()" << std::endl; if (! m_ignore_notifications) { clear_triangulation(); build_triangulation(); @@ -304,7 +300,7 @@ public: } /*! Notificaion before the removal of a vertex. - * \param v A handle to the vertex to be deleted. + * \param v (in) A handle to the vertex to be deleted. */ virtual void after_remove_vertex() { @@ -315,11 +311,10 @@ public: } /*! Notification before the removal of an edge. - * \param e A handle to one of the twin halfedges to be deleted. + * \param e (in) A handle to one of the twin halfedges to be deleted. */ virtual void after_remove_edge() { - std::cout << "after_remove_edge()" << std::endl; if (! m_ignore_notifications) { clear_triangulation(); build_triangulation(); @@ -328,11 +323,10 @@ public: } /*! Notification before the removal of an outer CCB. - * \param f The face that used to own the outer CCB. + * \param f (in) The face that used to own the outer CCB. */ virtual void after_remove_outer_ccb(Face_handle /* f */) { - std::cout << "after_remove_outer_ccb()" << std::endl; if (! m_ignore_notifications && ! m_ignore_remove_edge) { clear_triangulation(); build_triangulation(); @@ -340,11 +334,10 @@ public: } /*! Notification after an inner CCB was created inside a face. - * \param h A circulator representing the boundary of the new inner CCB. + * \param h (in) A circulator representing the boundary of the new inner CCB. */ virtual void after_add_inner_ccb(Ccb_halfedge_circulator /* h */) { - std::cout << "after_add_inner_ccb()" << std::endl; if (! m_ignore_notifications) { clear_triangulation(); build_triangulation(); @@ -352,11 +345,10 @@ public: } /*! Notification after an inner CCB is moved from one face to another. - * \param h A circulator representing the boundary of the component. + * \param h (in) A circulator representing the boundary of the component. */ virtual void after_move_inner_ccb(Ccb_halfedge_circulator /* h */) { - std::cout << "after_move_inner_ccb()" << std::endl; if (! m_ignore_notifications) { clear_triangulation(); build_triangulation(); @@ -364,11 +356,10 @@ public: } /*! Notificaion after the removal of an inner CCB. - * \param f The face that used to contain the inner CCB. + * \param f (in) The face that used to contain the inner CCB. */ virtual void after_remove_inner_ccb(Face_handle /* f */) { - std::cout << "after_remove_inner_ccb()" << std::endl; if (! m_ignore_notifications && ! m_ignore_remove_edge) { clear_triangulation(); build_triangulation(); @@ -378,7 +369,7 @@ public: protected: /*! Locate the arrangement feature containing the given point in the * unbounded face(s). - * \param p The query point. + * \param p (in) The query point. * \return An object representing the arrangement feature containing the * query point. This object is either a Face_const_handle * representing an unbounded face or a Vertex_const_handle From b599a1d9117870fbc54aaa00185ab333050311b7 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 1 Dec 2013 11:55:01 +0200 Subject: [PATCH 06/50] Introduced batched point-location test --- .../Batched_point_location_test.h | 473 ++++++++++++++++++ .../Point_location_test.h | 146 +++--- .../Arrangement_on_surface_2/cgal_test_base | 16 +- .../curves/test01.txt | 12 + .../queries/test01.txt | 16 + .../test_batched_point_location.cpp | 133 +++++ .../test_batched_point_location.segments.cmd | 1 + .../test_point_location_dynamic.cpp | 1 + 8 files changed, 725 insertions(+), 73 deletions(-) create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_segments/curves/test01.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_segments/queries/test01.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.cpp create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.segments.cmd diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h new file mode 100644 index 00000000000..52e1ec835ee --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h @@ -0,0 +1,473 @@ +#ifndef CGAL_BATCHED_POINT_LOCATION_TEST_H +#define CGAL_BATCHED_POINT_LOCATION_TEST_H + +#include +#include +#include + +#include +#include +#include + +#include "IO_test.h" + +/*! Point location test */ +template +class Batched_point_location_test : public IO_test { +public: + typedef GeomTraits_T Geom_traits; + typedef TopolTraits_T Topol_traits; + +private: + typedef IO_test Base; + +public: + typedef typename Base::Point_2 Point_2; + typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; + typedef typename Base::Curve_2 Curve_2; + + typedef typename Base::Points_vector Points_vector; + typedef typename Base::Xcurves_vector Xcurves_vector; + typedef typename Base::Curves_vector Curves_vector; + + typedef CGAL::Arrangement_on_surface_2 + Arrangement; + + typedef typename Arrangement::Vertex_handle Vertex_handle; + typedef typename Arrangement::Halfedge_handle Halfedge_handle; + typedef typename Arrangement::Face_handle Face_handle; + + typedef typename Arrangement::Vertex_const_handle Vertex_const_handle; + typedef typename Arrangement::Halfedge_const_handle Halfedge_const_handle; + typedef typename Arrangement::Face_const_handle Face_const_handle; + + typedef typename Arrangement::Edge_const_iterator Edge_const_iterator; + typedef typename Arrangement::Vertex_const_iterator Vertex_const_iterator; + + typedef typename Points_vector::iterator Point_iterator; + + typedef std::vector Objects_vector; + typedef Objects_vector::iterator Object_iterator; + + typedef typename boost::variant Cell_handle; + + typedef CGAL::Arr_point_location_result Point_location_result; + typedef typename Point_location_result::Type Result_type; + typedef std::pair Query_result; + +protected: + /*! The geometry traits. */ + const Geom_traits& m_geom_traits; + + /*! The arrangement. */ + Arrangement m_arr; + + /*! The input data file of the query points. */ + std::string m_filename_queries; + + /*! The query points. */ + Points_vector m_query_points; + + /*! Verbosity */ + size_t m_verbose_level; + + /*! Verify the results. + */ + template + bool verify(InputIterator begin, InputIterator end); + + /*! print the results. + */ + void print_results(const std::pair& res); + + /*! print the results. + */ + void print_results(const std::pair& res); + + /*! Compare the results. + */ + bool compare(const Cell_handle& expected, const Cell_handle& actual); + + /*! Compare the results. + */ + bool compare(const CGAL::Object& expected, const CGAL::Object& actual); + +public: + /*! Constructor from a geometry traits object. + */ + Batched_point_location_test(const Geom_traits& geom_traits); + + /*! Destructor */ + virtual ~Batched_point_location_test() { clear(); } + + /*! Perform the test. + * \return true upon success and false otherwise. + */ + virtual bool perform(); + + /*! Clear the data structure. */ + virtual void clear(); + + /*! Initialize the data structure. + * \return true upon success and false otherwise. + */ + virtual bool init(); + + /*! Set the file names. + */ + void set_filenames(const char* points_filename, const char* xcurves_filename, + const char* curves_filename, const char* queries_filename); + + /*! Set the verbosity level. + */ + void set_verbose_level(size_t verbose_level); +}; + +/*! + * Constructor from a geometry traits object. + */ +template +Batched_point_location_test:: +Batched_point_location_test(const Geom_traits& geom_traits) : + Base(geom_traits), + m_geom_traits(geom_traits), + m_verbose_level(0) +{} + +//! \brief sets the file names. +template +void Batched_point_location_test:: +set_filenames(const char* points_filename, + const char* xcurves_filename, + const char* curves_filename, + const char* queries_filename) +{ + Base::set_filenames(points_filename, xcurves_filename, curves_filename); + m_filename_queries.assign(queries_filename); +} + +//! \brief sets the verbosity level. +template +void Batched_point_location_test:: +set_verbose_level(size_t verbose_level) +{ m_verbose_level = verbose_level; } + +/*! Clear the data structures */ +template +void Batched_point_location_test::clear() +{ + m_arr.clear(); + Base::clear(); + m_query_points.clear(); + m_filename_queries.clear(); +} + +template +bool Batched_point_location_test::init() +{ + // Initialize the input. + if (!Base::init()) return false; + + // Read the query points + if (!this->read_points(m_filename_queries.c_str(), m_query_points)) + return false; + + // Insert all into the arrangement + CGAL::insert(m_arr, this->m_xcurves.begin(), this->m_xcurves.end()); + // insert(*m_arr, m_points.begin(), m_points.end()); + CGAL::insert(m_arr, this->m_curves.begin(), this->m_curves.end()); + + // Print the size of the arrangement. + if (m_verbose_level > 1) + std::cout << "V = " << m_arr.number_of_vertices() + << ", E = " << m_arr.number_of_edges() + << ", F = " << m_arr.number_of_faces() << std::endl; + + return true; +} + +//! \brief performs the test. +template +bool Batched_point_location_test::perform() +{ + // Apply batched point location. + std::list results; + locate(m_arr, m_query_points.begin(), m_query_points.end(), + std::back_inserter(results)); + + // Verify the results. + return verify(results.begin(), results.end()); +} + +//! \brief verifies the results. +template +template +bool Batched_point_location_test:: +verify(InputIterator begin, InputIterator end) +{ + typedef TopolTraits_T TopolTraits; + + if (m_verbose_level > 1) { + for (InputIterator it = begin; it != end; ++it) print_results(*it); + } + + typename TopolTraits::Default_point_location_strategy pl(m_arr); + for (InputIterator it = begin; it != end; ++it) { + // Perform (single) point location. + Result_type obj = pl.locate(it->first); + + // Compare the results. + if (!compare(obj, it->second)) return false; + } + return true; +} + +//! \brief compares the results. +template +bool Batched_point_location_test:: +compare(const Cell_handle& expected, const Cell_handle& actual) +{ + // Assign object to a face + const Face_const_handle* fh_expected = + boost::get(&(expected)); + if (fh_expected) { + const Face_const_handle* fh_actual = + boost::get(&(actual)); + if (fh_actual) { + if ((*fh_actual) == (*fh_expected)) return true; + + std::cout << "Error: batched point location!" << std::endl; + std::cout << "Expected: a face." << std::endl; + std::cout << "Actual: a different face." << std::endl; + return false; + } + std::cout << "Error: batched point location!" << std::endl; + std::cout << "Expected a face." << std::endl; + const Halfedge_const_handle* hh_actual = + boost::get(&(actual)); + if (hh_actual) { + std::cout << "Actual: a halfedge." << std::endl; + return false; + } + const Vertex_const_handle* vh_actual = + boost::get(&(actual)); + if (vh_actual) { + std::cout << "Actual: a vertex." << std::endl; + return false; + } + std::cout << "Actual: an unknowen object." + << std::endl; + return false; + } + + // Assign object to a halfedge + const Halfedge_const_handle* hh_expected = + boost::get(&(expected)); + if (hh_expected) { + const Halfedge_const_handle* hh_actual = + boost::get(&(actual)); + if (hh_actual) { + if (((*hh_actual) == (*hh_expected)) || + ((*hh_actual)->twin() == (*hh_expected))) + return true; + + std::cout << "Error: batched point location!" << std::endl; + std::cout << "Expected: a halfedge, " << (*hh_expected)->curve() + << std::endl; + std::cout << "Actual: a different halfedge, " << (*hh_actual)->curve() + << std::endl; + return false; + } + + std::cout << "Error: batched point location!" << std::endl; + std::cout << "Expected: a halfedge, " << (*hh_expected)->curve() + << std::endl; + const Face_const_handle* fh_actual = + boost::get(&(actual)); + if (fh_actual) { + std::cout << "Actual: a face." << std::endl; + return false; + } + const Vertex_const_handle* vh_actual = + boost::get(&(actual)); + if (vh_actual) { + std::cout << "Actual: a vertex." << std::endl; + return false; + } + std::cout << "Actual: an unknowen object." << std::endl; + return false; + } + + // Assign object to a vertex + const Vertex_const_handle* vh_expected = + boost::get(&(expected)); + if (vh_expected) { + const Vertex_const_handle* vh_actual = + boost::get(&(actual)); + if (vh_actual) { + if ((*vh_actual) == (*vh_expected)) return true; + + std::cout << "Error: batched point location!" << std::endl; + std::cout << "Expected: a vertex, "<< (*vh_expected)->point() + << std::endl; + std::cout << "Actual: a different vertex, " << (*vh_actual)->point() + << std::endl; + return false; + } + std::cout << "Error: batched point location!"; + std::cout << "Expected: a vertex, "<< (*vh_expected)->point() << std::endl; + const Face_const_handle* fh_actual = + boost::get(&(actual)); + if (fh_actual) { + std::cout << "Actual: a face" << std::endl; + return false; + } + const Halfedge_const_handle* hh_actual = + boost::get(&(actual)); + if (hh_actual) { + std::cout << "Actual: a halfedge." << std::endl; + return false; + } + std::cout << "Actual: an unknown object." << std::endl; + return false; + } + + std::cout << "Error: Unknown!" << std::endl; + return false; +} + +//! \brief compares the results. +template +bool Batched_point_location_test:: +compare(const CGAL::Object& expected, const CGAL::Object& actual) +{ + Face_const_handle fh_expected; + if (CGAL::assign(fh_expected, expected)) { + Face_const_handle fh_actual; + if (CGAL::assign(fh_actual, actual)) { + if (fh_actual == fh_expected) return true; + + std::cout << "Error: batched point location!" << std::endl; + std::cout << "Expected: a face" << std::endl; + std::cout << "Actual: a different face." << std::endl; + return false; + } + std::cout << "Error: batched point location!" << std::endl; + std::cout << "Expected: a face" << std::endl; + Halfedge_const_handle hh_actual; + if (CGAL::assign(hh_actual, actual)) { + std::cout << "Actual: a halfedge." << std::endl; + return false; + } + Vertex_const_handle vh_actual; + if (CGAL::assign(vh_actual, actual)) { + std::cout << "Actual: a vertex." << std::endl; + return false; + } + std::cout << "Actual: an unknowen object." << std::endl; + return false; + } + + // Assign object to a halfedge + Halfedge_const_handle hh_expected; + if (CGAL::assign(hh_expected, expected)) { + Halfedge_const_handle hh_actual; + if (CGAL::assign(hh_actual, actual)) { + if ((hh_actual == hh_expected) || (hh_actual->twin() == hh_expected)) + return true; + + std::cout << "Error: batched point location!" << std::endl; + std::cout << "Expected: a halfedge, " << hh_expected->curve() + << std::endl; + std::cout << "Actual: a different halfedge, " << hh_actual->curve() + << std::endl; + return false; + } + std::cout << "Error: batched point location!" << std::endl; + std::cout << "Expected: a halfedge, " << hh_expected->curve() << std::endl; + Face_const_handle fh_actual; + if (CGAL::assign(fh_actual, actual)) { + std::cout << "Actual: a face" << std::endl; + return false;; + } + Vertex_const_handle vh_actual; + if (CGAL::assign(vh_actual, actual)) { + std::cout << "Actual: a vertex." << std::endl; + return false;; + } + std::cout << "Actual: an unknowen object." << std::endl; + return false; + } + + // Assign object to a vertex + Vertex_const_handle vh_expected; + if (CGAL::assign(vh_expected, expected)) { + Vertex_const_handle vh_actual; + if (CGAL::assign(vh_actual, actual)) { + if (vh_actual == vh_expected) return true; + + std::cout << "Error: batched point location!" << std::endl; + std::cout << "Expected: a vertex, "<< vh_expected->point() << std::endl; + std::cout << "Actual: a different vertex: "<< vh_actual->point() + << std::endl; + return false; + } + std::cout << "Error: batched point location!" << std::endl; + std::cout << "Expected: a vertex, "<< vh_expected->point() << std::endl; + Face_const_handle fh_actual; + if (CGAL::assign(fh_actual, actual)) { + std::cout << "Actual: a face." << std::endl; + return false; + } + Halfedge_const_handle hh_actual; + if (CGAL::assign(hh_actual, actual)) { + std::cout << "Actual: a halfedge." << std::endl; + return false; + } + std::cout << "Actual: an unknown object." << std::endl; + return false; + } + + std::cout << "Error: Unknown!" << std::endl; + return false; +} + +//! \brief prints the results. +template +void Batched_point_location_test:: +print_results(const std::pair& res) +{ + // Print the results. + std::cout << "The point (" << res.first << ") is located "; + if (const Face_const_handle* f = + boost::get(&(res.second))) // inside a face + std::cout << "inside " + << (((*f)->is_unbounded()) ? "the unbounded" : "a bounded") + << " face." << std::endl; + else if (const Halfedge_const_handle* e = + boost::get(&(res.second))) // on an edge + std::cout << "on an edge: " << (*e)->curve() << std::endl; + else if (const Vertex_const_handle* v = + boost::get(&(res.second))) // on a vertex + std::cout << "on " + << (((*v)->is_isolated()) ? "an isolated" : "a") + << " vertex: " << (*v)->point() << std::endl; +} + +//! \brief prints the results. +template +void Batched_point_location_test:: +print_results(const std::pair& res) +{ + // Print the results. + std::cout << "The point (" << res.first << ") is located "; + Face_const_handle fh; + if (CGAL::assign(fh, res.second)) + std::cout << "inside " + << ((fh->is_unbounded()) ? "the unbounded" : "a bounded") + << " face." << std::endl; +} + +#endif diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h index d3087016800..bf4b8837a30 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h @@ -139,10 +139,10 @@ protected: #define MAX_NUM_POINT_LOCATION_STRATEGIES 12 int verify(Objects_vector objs[MAX_NUM_POINT_LOCATION_STRATEGIES], - size_t size, unsigned int pls_num); + size_t size, size_t pls_num); int verify(Variants_vector objs[MAX_NUM_POINT_LOCATION_STRATEGIES], - size_t size, unsigned int pls_num); + size_t size, size_t pls_num); public: /*! Constructor */ @@ -257,7 +257,7 @@ bool Point_location_test::init() } /*! Clear the data structures */ -template +template void Point_location_test::clear() { Base::clear(); @@ -266,7 +266,7 @@ void Point_location_test::clear() } /*! Clear the data structures */ -template +template void Point_location_test:: deallocate_pl_strategies() { @@ -598,7 +598,7 @@ bool Point_location_test::perform() // std::cout << "Time in seconds" << std::endl; std::cout << std::endl; - unsigned int pl_index = 0; + size_t pl_index = 0; query(*m_naive_pl, "Naive", m_query_points.begin(), m_query_points.end(), std::back_inserter(objs[pl_index++])); // Naive @@ -657,7 +657,7 @@ bool Point_location_test::perform() // ===> Add a call to operate the new point location. <=== // Number of point location strategies used. - unsigned int pls_num = pl_index; + size_t pls_num = pl_index; std::cout << "Number of strategies is " << pls_num << std::endl; // End Location @@ -685,7 +685,7 @@ bool Point_location_test::perform() template int Point_location_test:: verify(Objects_vector objs[MAX_NUM_POINT_LOCATION_STRATEGIES], - size_t size, unsigned int pls_num) + size_t size, size_t pls_num) { Vertex_const_handle vh_ref, vh_cur; Halfedge_const_handle hh_ref, hh_cur; @@ -694,32 +694,33 @@ verify(Objects_vector objs[MAX_NUM_POINT_LOCATION_STRATEGIES], int result = 0; // Assign and check results - unsigned int qi; //qi is the query point index + size_t qi; //qi is the query point index for (qi = 0; qi < size; ++qi) { // Assign object to a face if (CGAL::assign(fh_ref, objs[0][qi])) { - for (unsigned int pl = 1; pl < pls_num; ++pl) { + for (size_t pl = 1; pl < pls_num; ++pl) { if (CGAL::assign(fh_cur, objs[pl][qi])) { if (fh_cur != fh_ref) { - std::cout << "Error: point location number " - << pl << " return a different face" << std::endl; + std::cout << "Error: point location number " << pl << std::endl; + std::cout << "Expecte: a face." << std::endl; + std::cout << "Actual: a different face" << std::endl; result += -1; } continue; } - std::cout << "Error in point location number " << pl; + std::cout << "Error: point location number " << pl << std::endl; + std::cout << "Expecte: a face." << std::endl; result += -1; if (CGAL::assign(hh_cur, objs[pl][qi])) { - std::cout << ", an halfedge returned instead of a face" << std::endl; + std::cout << "Actual: a halfedge." << std::endl; continue; } if (CGAL::assign(vh_cur, objs[pl][qi])) { - std::cout << ", a vertex returned instead of a face" << std::endl; + std::cout << "Actual: a vertex." << std::endl; continue; } - std::cout << ", an unknowen object returned instead of a face" - << std::endl; + std::cout << "Actual: an unknowen object." << std::endl; } //if (fh_ref->is_unbounded()) // std::cout << "Unbounded face." << std::endl; @@ -730,66 +731,66 @@ verify(Objects_vector objs[MAX_NUM_POINT_LOCATION_STRATEGIES], // Assign object to a halfedge if (CGAL::assign (hh_ref, objs[0][qi])) { - std::cout << "Halfedge: " << hh_ref->curve() << std::endl; - for (unsigned int pl = 1; pl < pls_num; ++pl) { + for (size_t pl = 1; pl < pls_num; ++pl) { if (CGAL::assign(hh_cur, objs[pl][qi])) { if ((hh_cur != hh_ref) && (hh_cur->twin() != hh_ref)) { - std::cout << "Error: point location number " - << pl << " return a different halfedge" << std::endl; - std::cout << "Halfedge (curr): " << hh_cur->curve() << std::endl; + std::cout << "Error: point location number " << pl << std::endl; + std::cout << "Expected: a halfedge, " << hh_ref->curve() + << std::endl; + std::cout << "Actual: a different halfedge: " << hh_cur->curve() + << std::endl; result += -1; } continue; } - std::cout << "Error in point location number " << pl; + std::cout << "Error: point location number " << pl << std::endl; + std::cout << "Expected: a halfedge, " << hh_ref->curve() << std::endl; result += -1; if (CGAL::assign(fh_cur, objs[pl][qi])) { - std::cout << ", a face returned instead of an halfedge" << std::endl; + std::cout << "Actual: a face." << std::endl; continue; } if (CGAL::assign(vh_cur, objs[pl][qi])) { - std::cout << ", a vertex returned instead of an halfedge" - << std::endl; + std::cout << "Actual: a vertex." << std::endl; continue; } - std::cout << ", an unknowen object returned instead of an halfedge" - << std::endl; + std::cout << "Actual: an unknowen object." << std::endl; } continue; } // Assign object to a vertex if (CGAL::assign(vh_ref, objs[0][qi])) { - for (unsigned int pl = 1; pl < pls_num; ++pl) { + for (size_t pl = 1; pl < pls_num; ++pl) { if (CGAL::assign(vh_cur, objs[pl][qi])) { if (vh_cur != vh_ref) { - std::cout << "Error: point location number " - << pl << " return a different vertex"<< std::endl; + std::cout << "Error: point location number " << pl << std::endl; + std::cout << "Expected: a vertex, "<< vh_ref->point() << std::endl; + std::cout << "Actual: a different vertex, "<< vh_cur->point() + << std::endl; result += -1; } continue; } - std::cout << "Error in point location number " << pl; + std::cout << "Error: point location number " << pl << std::endl; + std::cout << "Expected: a vertex, "<< vh_ref->point() << std::endl; result += -1; if (CGAL::assign(fh_cur, objs[pl][qi])) { - std::cout << ", a face returned instead of a vertex" << std::endl; + std::cout << "Actual: a face." << std::endl; continue; } if (CGAL::assign(hh_cur, objs[pl][qi])) { - std::cout << ", an halfedge returned instead of a vertex" - << std::endl; + std::cout << "Actual: a halfedge." << std::endl; continue; } - std::cout << ", an unknown object returned instead of a vertex" - << std::endl; + std::cout << "Actual: an unknown object." << std::endl; } - std::cout << "Vertex: "<< vh_ref->point() << std::endl; continue; } - std::cout << "Illegal point-location result." << std::endl; + std::cout << "Error: Unknown!" << std::endl; result += -1; } return result; @@ -799,7 +800,7 @@ verify(Objects_vector objs[MAX_NUM_POINT_LOCATION_STRATEGIES], template int Point_location_test:: verify(Variants_vector objs[MAX_NUM_POINT_LOCATION_STRATEGIES], - size_t size, unsigned int pls_num) + size_t size, size_t pls_num) { const Vertex_const_handle* vh_ref; const Halfedge_const_handle* hh_ref; @@ -812,36 +813,37 @@ verify(Variants_vector objs[MAX_NUM_POINT_LOCATION_STRATEGIES], int result = 0; // Assign and check results - unsigned int qi; //qi is the query point index + size_t qi; //qi is the query point index for (qi = 0; qi < size; ++qi) { // Assign object to a face fh_ref = boost::get(&(objs[0][qi])); if (fh_ref) { - for (unsigned int pl = 1; pl < pls_num; ++pl) { + for (size_t pl = 1; pl < pls_num; ++pl) { fh_cur = boost::get(&(objs[pl][qi])); if (fh_cur) { if ((*fh_cur) != (*fh_ref)) { - std::cout << "Error: point location number " - << pl << " return a different face" << std::endl; + std::cout << "Error: point location number " << pl << std::endl; + std::cout << "Expected: a face." << std::endl; + std::cout << "Actual: a different face." << std::endl; result += -1; } continue; } - std::cout << "Error in point location number " << pl; + std::cout << "Error: point location number " << pl << std::endl; + std::cout << "Expected: a face." << std::endl; result += -1; hh_cur = boost::get(&(objs[pl][qi])); if (hh_cur) { - std::cout << ", an halfedge returned instead of a face" << std::endl; + std::cout << "Actual: a halfedge." << std::endl; continue; } vh_cur = boost::get(&(objs[pl][qi])); if (vh_cur) { - std::cout << ", a vertex returned instead of a face" << std::endl; + std::cout << "Actual: a vertex." << std::endl; continue; } - std::cout << ", an unknowen object returned instead of a face" - << std::endl; + std::cout << "Actual: an unknowen object." << std::endl; } //if ((*fh_ref)->is_unbounded()) // std::cout << "Unbounded face." << std::endl; @@ -853,34 +855,34 @@ verify(Variants_vector objs[MAX_NUM_POINT_LOCATION_STRATEGIES], // Assign object to a halfedge hh_ref = boost::get(&(objs[0][qi])); if (hh_ref) { - std::cout << "Halfedge: " << (*hh_ref)->curve() << std::endl; - for (unsigned int pl = 1; pl < pls_num; ++pl) { + for (size_t pl = 1; pl < pls_num; ++pl) { hh_cur = boost::get(&(objs[pl][qi])); if (hh_cur) { if (((*hh_cur) != (*hh_ref)) && ((*hh_cur)->twin() != (*hh_ref))) { - std::cout << "Error: point location number " - << pl << " return a different halfedge" << std::endl; - std::cout << "Halfedge (curr): " << (*hh_cur)->curve() << std::endl; + std::cout << "Error: point location number " << pl << std::endl; + std::cout << "Expected: a halfedge, " << (*hh_ref)->curve() + << std::endl; + std::cout << "Actual: a different halfedge, " << (*hh_cur)->curve() + << std::endl; result += -1; } continue; } - - std::cout << "Error in point location number " << pl; + std::cout << "Error: point location number " << pl << std::endl; + std::cout << "Expected: a halfedge, " << (*hh_ref)->curve() + << std::endl; result += -1; fh_cur = boost::get(&(objs[pl][qi])); if (fh_cur) { - std::cout << ", a face returned instead of an halfedge" << std::endl; + std::cout << "Actual: a face." << std::endl; continue; } vh_cur = boost::get(&(objs[pl][qi])); if (vh_cur) { - std::cout << ", a vertex returned instead of an halfedge" - << std::endl; + std::cout << "Actual: a vertex." << std::endl; continue; } - std::cout << ", an unknowen object returned instead of an halfedge" - << std::endl; + std::cout << "Actual: an unknowen object." << std::endl; } continue; } @@ -888,38 +890,38 @@ verify(Variants_vector objs[MAX_NUM_POINT_LOCATION_STRATEGIES], // Assign object to a vertex vh_ref = boost::get(&(objs[0][qi])); if (vh_ref) { - for (unsigned int pl = 1; pl < pls_num; ++pl) { + for (size_t pl = 1; pl < pls_num; ++pl) { vh_cur = boost::get(&(objs[pl][qi])); if (vh_cur) { if ((*vh_cur) != (*vh_ref)) { - std::cout << "Error: point location number " - << pl << " return a different vertex"<< std::endl; + std::cout << "Error: point location number " << pl << std::endl; + std::cout << "Expected: a vertex: "<< (*vh_ref)->point() + << std::endl; + std::cout << "Actual: a different vertex: "<< (*vh_cur)->point() + << std::endl; result += -1; } continue; } - - std::cout << "Error in point location number " << pl; + std::cout << "Error: point location number " << pl << std::endl; + std::cout << "Expected: a vertex: "<< (*vh_ref)->point() << std::endl; result += -1; fh_cur = boost::get(&(objs[pl][qi])); if (fh_cur) { - std::cout << ", a face returned instead of a vertex" << std::endl; + std::cout << "Actual: a face." << std::endl; continue; } hh_cur = boost::get(&(objs[pl][qi])); if (hh_cur) { - std::cout << ", an halfedge returned instead of a vertex" - << std::endl; + std::cout << "Actual: a halfedge." << std::endl; continue; } - std::cout << ", an unknown object returned instead of a vertex" - << std::endl; + std::cout << "Actual: an unknown object." << std::endl; } - std::cout << "Vertex: "<< (*vh_ref)->point() << std::endl; continue; } - std::cout << "Illegal point-location result." << std::endl; + std::cout << "Error: Unknown!" << std::endl; result += -1; } return result; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base index 0e320586cc4..76504b3c465 100755 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base @@ -902,6 +902,18 @@ test_point_location_linear() compile_and_run_with_flags test_point_location linear "$flags" } +#---------------------------------------------------------------------# +# batchecd point location with segments +#---------------------------------------------------------------------# +test_batched_point_location_segments() +{ + local nt=$CGAL_GMPQ_NT; + local kernel=$CARTESIAN_KERNEL; + local geom_traits=$SEGMENT_GEOM_TRAITS; + local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; + compile_and_run_with_flags test_batched_point_location segments "$flags" +} + #---------------------------------------------------------------------# # segment traits #---------------------------------------------------------------------# @@ -1425,6 +1437,8 @@ test_point_location_linear test_point_location_dynamic_segments +test_batched_point_location_segments + compile_and_run test_dual compile_and_run test_do_intersect compile_and_run test_zone @@ -1440,7 +1454,7 @@ compile_and_run test_removal compile_and_run test_unbounded_removal compile_and_run test_spherical_removal -# if any error occured then append the full error description file to error file +if any error occured then append the full error description file to error file if [ -f $FULL_ERROR_DESCRIPTION_FILE ] ; then echo "******************** appending all error outputs ********************" >> $ERRORFILE diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_segments/curves/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_segments/curves/test01.txt new file mode 100644 index 00000000000..997a6b5f8d1 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_segments/curves/test01.txt @@ -0,0 +1,12 @@ +# A grid +0 0 8 0 +0 2 8 2 +0 4 8 4 +0 6 8 6 +0 8 8 8 +# +0 0 0 8 +2 0 2 8 +4 0 4 8 +6 0 6 8 +8 0 8 8 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_segments/queries/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_segments/queries/test01.txt new file mode 100644 index 00000000000..183aa2868e4 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_segments/queries/test01.txt @@ -0,0 +1,16 @@ +1 1 +1 3 +1 5 +1 7 +3 1 +3 3 +3 5 +3 7 +5 1 +5 3 +5 5 +5 7 +7 1 +7 3 +7 5 +7 7 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.cpp new file mode 100644 index 00000000000..071349e529e --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.cpp @@ -0,0 +1,133 @@ +#include +#include + +#include + +#include "test_configuration.h" + +#if ((TEST_GEOM_TRAITS == CORE_CONIC_GEOM_TRAITS) || \ + (TEST_GEOM_TRAITS == BEZIER_GEOM_TRAITS) || \ + (TEST_GEOM_TRAITS == RATIONAL_ARC_GEOM_TRAITS)) && !defined(CGAL_USE_CORE) + +int main() +{ +// bool UNTESTED_TRAITS_AS_CORE_IS_NOT_INSTALLED; + std::cout << std::endl + << "NOTE: Core is not installed, " + << "skipping the test ..." + << std::endl; + return 0; +} +#elif (TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS) && \ + (TEST_NT == LEDA_INT_NT || TEST_NT == LEDA_RAT_NT) && \ + (! CGAL_USE_LEDA) + +int main() +{ +// bool UNTESTED_TRAITS_AS_LEDA_IS_NOT_INSTALLED; + std::cout << std::endl + << "NOTE: LEDA is not installed, " + << "skipping the test ..." + << std::endl; + return 0; +} + +#elif (TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS) && \ + (TEST_NT == CGAL_GMPZ_NT || TEST_NT == CGAL_GMPQ_NT) && \ + ! (CGAL_USE_GMP && CGAL_USE_MPFI) + +int main() +{ + +// bool UNTESTED_TRAITS_AS_GMP_OR_MPFI_IS_NOT_INSTALLED; + std::cout << std::endl + << "NOTE: GMP and/or MPFI are not installed, " + << "skipping the test ..." + << std::endl; + return 0; +} + +#elif (TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS) && \ + (TEST_NT == CORE_INT_NT) && \ + !CGAL_USE_CORE + +int main() +{ +// bool UNTESTED_TRAITS_AS_CORE_IS_NOT_INSTALLED; + std::cout << std::endl + << "NOTE: CORE is not installed, " + << "skipping the test ..." + << std::endl; + return 0; +} + + +#else + +#include "test_traits.h" +#include "Batched_point_location_test.h" + +bool test(const char* points_filename, const char* xcurves_filename, + const char* curves_filename, const char* queries_filename, + size_t verbose_level) +{ + Geom_traits geom_traits; + Batched_point_location_test pl_test(geom_traits); + pl_test.set_verbose_level(verbose_level); + pl_test.set_filenames(points_filename, xcurves_filename, curves_filename, + queries_filename); + + if (!pl_test.init()) return false; + if (!pl_test.perform()) return false; + pl_test.clear(); + + return true; +} + +int main(int argc, char* argv[]) +{ +#if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS + CGAL::set_pretty_mode(std::cout); + CGAL::set_pretty_mode(std::cerr); +#endif + + size_t verbose_level = 0; + int success = 0; + size_t i = 1; + + // Test 1 + if ((argc > 2) && (std::strncmp(argv[1], "-v", 2) == 0)) { + verbose_level = boost::lexical_cast(argv[2]); + i += 2; + } + + if (argc < (i + 4)) { + std::cout << "Usage: " << argv[0] + << " point-file xcurve-file curve-file query-file" + << std::endl; + std::cout << "point-file - the input point file" << std::endl; + std::cout << "xcurve-file - the input x-monotone curves file" << std::endl; + std::cout << "curve-file - the input curve file" << std::endl; + std::cerr << "query-file - the input query point file" << std::endl; + return -1; + } + + for (; i < argc; i += 4) { + const char* points_filename = argv[i]; + const char* xcurves_filename = argv[i+1]; + const char* curves_filename = argv[i+2]; + const char* queries_filename = argv[i+3]; + + if (!test(points_filename, xcurves_filename, curves_filename, + queries_filename, verbose_level)) + { + std::cout << "ERROR : " << argv[0] << " " + << points_filename << " " << xcurves_filename << " " + << curves_filename << " " << queries_filename << std::endl; + success = -1; + } + } + return success; +} + +#endif diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.segments.cmd b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.segments.cmd new file mode 100644 index 00000000000..6998c08277a --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.segments.cmd @@ -0,0 +1 @@ +./data/empty.zero ./data/empty.zero ./data/batched_point_location_segments/curves/test01.txt ./data/batched_point_location_segments/queries/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location_dynamic.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location_dynamic.cpp index ec9570a6e0c..eb15bcb32cf 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location_dynamic.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location_dynamic.cpp @@ -103,6 +103,7 @@ int main(int argc, char* argv[]) std::cout << "xcurve-file - the input x-monotone curves file" << std::endl; std::cout << "command-file - the command file" << std::endl; std::cout << "curve-file - the input curve file" << std::endl; + std::cerr << "query-file - the input query point file" << std::endl; return -1; } From d24ea2d50b0ae0381eeb9c586cbdd7a5e757ee35 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 1 Dec 2013 12:35:44 +0200 Subject: [PATCH 07/50] enhanced batched point location with linear traits test --- .../curves/test01.txt | 2 ++ .../curves/test02.txt | 8 ++++++++ .../curves/test03.txt | 4 ++++ .../queries/test01.txt | 5 +++++ .../queries/test02.txt | 19 +++++++++++++++++++ .../queries/test03.txt | 9 +++++++++ .../test_batched_point_location.linear.cmd | 3 +++ 7 files changed, 50 insertions(+) create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test01.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test02.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test03.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test01.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test02.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test03.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.linear.cmd diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test01.txt new file mode 100644 index 00000000000..e90924f13af --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test01.txt @@ -0,0 +1,2 @@ +L 1 0 0 +L 0 1 0 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test02.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test02.txt new file mode 100644 index 00000000000..d75ef53f177 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test02.txt @@ -0,0 +1,8 @@ +# A grid +L 0 1 -2 +L 0 1 0 +L 0 1 2 +# +L 1 0 -2 +L 1 0 0 +L 1 0 2 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test03.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test03.txt new file mode 100644 index 00000000000..d9eda5968bb --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test03.txt @@ -0,0 +1,4 @@ +L 1 0 0 +L -1 0 0 +L 0 1 0 +L 0 -1 0 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test01.txt new file mode 100644 index 00000000000..b9760617191 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test01.txt @@ -0,0 +1,5 @@ + 0 0 +-1 -1 +-1 1 + 1 1 + 1 -1 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test02.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test02.txt new file mode 100644 index 00000000000..9508f7a33ef --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test02.txt @@ -0,0 +1,19 @@ +-3 -3 +-3 -1 +-3 1 +-3 3 +# +-1 -3 +-1 -1 +-1 1 +-1 3 +# +1 -3 +1 -1 +1 1 +1 3 +# +3 -3 +3 -1 +3 1 +3 3 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test03.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test03.txt new file mode 100644 index 00000000000..f9de69a6268 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test03.txt @@ -0,0 +1,9 @@ +-1 -1 +-1 0 +-1 1 +0 -1 +0 0 +0 1 +1 -1 +1 0 +1 1 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.linear.cmd b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.linear.cmd new file mode 100644 index 00000000000..276a0732ea2 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.linear.cmd @@ -0,0 +1,3 @@ +./data/empty.zero ./data/empty.zero ./data/batched_point_location_linear/curves/test01.txt ./data/batched_point_location_linear/queries/test01.txt +./data/empty.zero ./data/empty.zero ./data/batched_point_location_linear/curves/test02.txt ./data/batched_point_location_linear/queries/test02.txt +./data/empty.zero ./data/empty.zero ./data/batched_point_location_linear/curves/test03.txt ./data/batched_point_location_linear/queries/test03.txt From f2c391b3231c4f83d3fc43c7fea610bceaef796b Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 1 Dec 2013 12:49:38 +0200 Subject: [PATCH 08/50] reorg --- .../linear}/curves/test01.txt | 0 .../linear}/curves/test02.txt | 0 .../linear}/curves/test03.txt | 0 .../linear}/queries/test01.txt | 0 .../linear}/queries/test02.txt | 0 .../linear}/queries/test03.txt | 0 .../segments}/curves/test01.txt | 0 .../segments}/queries/test01.txt | 0 .../test_batched_point_location.linear.cmd | 6 +++--- .../test_batched_point_location.segments.cmd | 2 +- 10 files changed, 4 insertions(+), 4 deletions(-) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{batched_point_location_linear => batched_point_location/linear}/curves/test01.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{batched_point_location_linear => batched_point_location/linear}/curves/test02.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{batched_point_location_linear => batched_point_location/linear}/curves/test03.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{batched_point_location_linear => batched_point_location/linear}/queries/test01.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{batched_point_location_linear => batched_point_location/linear}/queries/test02.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{batched_point_location_linear => batched_point_location/linear}/queries/test03.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{batched_point_location_segments => batched_point_location/segments}/curves/test01.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{batched_point_location_segments => batched_point_location/segments}/queries/test01.txt (100%) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/linear/curves/test01.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test01.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/linear/curves/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test02.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/linear/curves/test02.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test02.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/linear/curves/test02.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test03.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/linear/curves/test03.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/curves/test03.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/linear/curves/test03.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/linear/queries/test01.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test01.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/linear/queries/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test02.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/linear/queries/test02.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test02.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/linear/queries/test02.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test03.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/linear/queries/test03.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_linear/queries/test03.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/linear/queries/test03.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_segments/curves/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/segments/curves/test01.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_segments/curves/test01.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/segments/curves/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_segments/queries/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/segments/queries/test01.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location_segments/queries/test01.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/segments/queries/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.linear.cmd b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.linear.cmd index 276a0732ea2..d7b497c4d62 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.linear.cmd +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.linear.cmd @@ -1,3 +1,3 @@ -./data/empty.zero ./data/empty.zero ./data/batched_point_location_linear/curves/test01.txt ./data/batched_point_location_linear/queries/test01.txt -./data/empty.zero ./data/empty.zero ./data/batched_point_location_linear/curves/test02.txt ./data/batched_point_location_linear/queries/test02.txt -./data/empty.zero ./data/empty.zero ./data/batched_point_location_linear/curves/test03.txt ./data/batched_point_location_linear/queries/test03.txt +./data/empty.zero ./data/empty.zero ./data/batched_point_location/linear/curves/test01.txt ./data/batched_point_location/linear/queries/test01.txt +./data/empty.zero ./data/empty.zero ./data/batched_point_location/linear/curves/test02.txt ./data/batched_point_location/linear/queries/test02.txt +./data/empty.zero ./data/empty.zero ./data/batched_point_location/linear/curves/test03.txt ./data/batched_point_location/linear/queries/test03.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.segments.cmd b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.segments.cmd index 6998c08277a..62bd6947ca2 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.segments.cmd +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.segments.cmd @@ -1 +1 @@ -./data/empty.zero ./data/empty.zero ./data/batched_point_location_segments/curves/test01.txt ./data/batched_point_location_segments/queries/test01.txt +./data/empty.zero ./data/empty.zero ./data/batched_point_location/segments/curves/test01.txt ./data/batched_point_location/segments/queries/test01.txt From 78d1eaa02011c896a6e5bd0ae4d2e8933acaf6cf Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 1 Dec 2013 13:20:24 +0200 Subject: [PATCH 09/50] Introduced batched point-location with geodesic arcs on the sphere --- .../geodesic_arcs_on_sphere/curves/test01.txt | 3 +++ .../geodesic_arcs_on_sphere/queries/test01.txt | 5 +++++ .../test_batched_point_location.geodesic_arcs_on_sphere.cmd | 1 + 3 files changed, 9 insertions(+) create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test01.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test01.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.geodesic_arcs_on_sphere.cmd diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test01.txt new file mode 100644 index 00000000000..ce2eee89788 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test01.txt @@ -0,0 +1,3 @@ +2 +0 0 -1 0 0 1 1 0 -1 0 +0 0 -1 0 0 1 1 -1 0 0 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test01.txt new file mode 100644 index 00000000000..70debee6328 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test01.txt @@ -0,0 +1,5 @@ +-1 -1 + 0 -1 0 + 1 -1 0 + 1 0 0 + 1 1 0 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.geodesic_arcs_on_sphere.cmd b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.geodesic_arcs_on_sphere.cmd new file mode 100644 index 00000000000..a28082bfe6e --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.geodesic_arcs_on_sphere.cmd @@ -0,0 +1 @@ +./data/empty.zero ./data/empty.zero ./data/batched_point_location/geodesic_arcs_on_sphere/curves/test01.txt ./data/batched_point_location/geodesic_arcs_on_sphere/queries/test01.txt From 9c2618e10b85ee844e058d370125c14d176a370f Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 1 Dec 2013 13:23:15 +0200 Subject: [PATCH 10/50] Introduced batched point-location with geodesic arcs on the sphere --- .../Arrangement_on_surface_2/cgal_test_base | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base index 76504b3c465..ad6dcfa5b0d 100755 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base @@ -914,6 +914,31 @@ test_batched_point_location_segments() compile_and_run_with_flags test_batched_point_location segments "$flags" } +#---------------------------------------------------------------------# +# batchecd point location with linear objects +#---------------------------------------------------------------------# +test_batched_point_location_linear() +{ + local nt=$CGAL_GMPQ_NT; + local kernel=$CARTESIAN_KERNEL; + local geom_traits=$LINEAR_GEOM_TRAITS; + local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; + compile_and_run_with_flags test_batched_point_location linear "$flags" +} + +#---------------------------------------------------------------------# +# batchecd point location with geodesic arcs on the sphere +#---------------------------------------------------------------------# +test_batched_point_location_spherical_arcs() +{ + local nt=$CGAL_GMPQ_NT; + local kernel=$CARTESIAN_KERNEL; + local geom_traits=$LINEAR_GEOM_TRAITS; + local topol_traits=$SPHERICAL_TOPOL_TRAITS; + local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits -DTEST_TOPOL_TRAITS=$topol_traits"; + compile_and_run_with_flags test_batched_point_location geodesic_arcs_on_sphere "$flags" +} + #---------------------------------------------------------------------# # segment traits #---------------------------------------------------------------------# @@ -1438,6 +1463,8 @@ test_point_location_linear test_point_location_dynamic_segments test_batched_point_location_segments +test_batched_point_location_linear +test_batched_point_location_spherical_arcs compile_and_run test_dual compile_and_run test_do_intersect @@ -1454,7 +1481,7 @@ compile_and_run test_removal compile_and_run test_unbounded_removal compile_and_run test_spherical_removal -if any error occured then append the full error description file to error file +# if any error occured then append the full error description file to error file if [ -f $FULL_ERROR_DESCRIPTION_FILE ] ; then echo "******************** appending all error outputs ********************" >> $ERRORFILE From ae12cf66e45f02877c35f4fd06d918aa402d4b8d Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 1 Dec 2013 13:25:54 +0200 Subject: [PATCH 11/50] reorg --- .../circle_segments}/curves/test01.txt | 0 .../circle_segments}/ops/test01.txt | 0 .../circle_segments}/queries/test01.txt | 0 .../linear}/curves/test01.txt | 0 .../linear}/curves/test03.txt | 0 .../linear}/curves/test04.txt | 0 .../linear}/ops/test01.txt | 0 .../linear}/ops/test02.txt | 0 .../linear}/queries/test01.txt | 0 .../linear}/queries/test02.txt | 0 .../linear}/queries/test03.txt | 0 .../linear}/queries/test04.txt | 0 .../linear}/xcurves/test02.txt | 0 .../segments}/curves/test01.txt | 0 .../segments}/curves/test02.txt | 0 .../segments}/curves/test03.txt | 0 .../segments}/curves/test04.txt | 0 .../segments}/curves/test05.txt | 0 .../segments}/curves/test06.txt | 0 .../segments}/curves/test07.txt | 0 .../segments}/curves/test08.txt | 0 .../segments}/curves/test09.txt | 0 .../segments}/ops/test01.txt | 0 .../segments}/ops/test10.txt | 0 .../segments}/queries/test01.txt | 0 .../segments}/queries/test02.txt | 0 .../segments}/queries/test03.txt | 0 .../segments}/queries/test04.txt | 0 .../segments}/queries/test05.txt | 0 .../segments}/queries/test06.txt | 0 .../segments}/queries/test07.txt | 0 .../segments}/queries/test08.txt | 0 .../segments}/queries/test09.txt | 0 .../segments}/queries/test10.txt | 0 .../segments}/xcurves/test10.txt | 0 .../test_point_location.circle_segments.cmd | 2 +- .../test_point_location.linear.cmd | 6 +++--- .../test_point_location.segments.cmd | 18 +++++++++--------- 38 files changed, 13 insertions(+), 13 deletions(-) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_circle_segments => point_location/circle_segments}/curves/test01.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_circle_segments => point_location/circle_segments}/ops/test01.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_circle_segments => point_location/circle_segments}/queries/test01.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_linear => point_location/linear}/curves/test01.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_linear => point_location/linear}/curves/test03.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_linear => point_location/linear}/curves/test04.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_linear => point_location/linear}/ops/test01.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_linear => point_location/linear}/ops/test02.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_linear => point_location/linear}/queries/test01.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_linear => point_location/linear}/queries/test02.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_linear => point_location/linear}/queries/test03.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_linear => point_location/linear}/queries/test04.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_linear => point_location/linear}/xcurves/test02.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/curves/test01.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/curves/test02.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/curves/test03.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/curves/test04.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/curves/test05.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/curves/test06.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/curves/test07.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/curves/test08.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/curves/test09.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/ops/test01.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/ops/test10.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/queries/test01.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/queries/test02.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/queries/test03.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/queries/test04.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/queries/test05.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/queries/test06.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/queries/test07.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/queries/test08.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/queries/test09.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/queries/test10.txt (100%) rename Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/{point_location_segments => point_location/segments}/xcurves/test10.txt (100%) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_circle_segments/curves/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/circle_segments/curves/test01.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_circle_segments/curves/test01.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/circle_segments/curves/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_circle_segments/ops/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/circle_segments/ops/test01.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_circle_segments/ops/test01.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/circle_segments/ops/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_circle_segments/queries/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/circle_segments/queries/test01.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_circle_segments/queries/test01.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/circle_segments/queries/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/curves/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/curves/test01.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/curves/test01.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/curves/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/curves/test03.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/curves/test03.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/curves/test03.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/curves/test03.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/curves/test04.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/curves/test04.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/curves/test04.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/curves/test04.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/ops/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/ops/test01.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/ops/test01.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/ops/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/ops/test02.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/ops/test02.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/ops/test02.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/ops/test02.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/queries/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/queries/test01.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/queries/test01.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/queries/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/queries/test02.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/queries/test02.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/queries/test02.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/queries/test02.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/queries/test03.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/queries/test03.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/queries/test03.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/queries/test03.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/queries/test04.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/queries/test04.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/queries/test04.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/queries/test04.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/xcurves/test02.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/xcurves/test02.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/xcurves/test02.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/linear/xcurves/test02.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test01.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test01.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test02.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test02.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test02.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test02.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test03.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test03.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test03.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test03.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test04.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test04.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test04.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test04.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test05.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test05.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test05.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test05.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test06.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test06.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test06.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test06.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test07.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test07.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test07.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test07.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test08.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test08.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test08.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test08.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test09.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test09.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test09.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/curves/test09.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/ops/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/ops/test01.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/ops/test01.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/ops/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/ops/test10.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/ops/test10.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/ops/test10.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/ops/test10.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test01.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test01.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test02.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test02.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test02.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test02.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test03.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test03.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test03.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test03.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test04.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test04.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test04.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test04.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test05.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test05.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test05.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test05.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test06.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test06.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test06.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test06.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test07.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test07.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test07.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test07.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test08.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test08.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test08.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test08.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test09.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test09.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test09.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test09.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test10.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test10.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test10.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/queries/test10.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/xcurves/test10.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/xcurves/test10.txt similarity index 100% rename from Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/xcurves/test10.txt rename to Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/segments/xcurves/test10.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location.circle_segments.cmd b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location.circle_segments.cmd index 747790e2376..6c7749cade2 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location.circle_segments.cmd +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location.circle_segments.cmd @@ -1 +1 @@ -./data/empty.zero ./data/empty.zero ./data/point_location_circle_segments/curves/test01.txt ./data/point_location_circle_segments/queries/test01.txt +./data/empty.zero ./data/empty.zero ./data/point_location/circle_segments/curves/test01.txt ./data/point_location/circle_segments/queries/test01.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location.linear.cmd b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location.linear.cmd index fdbe9cf954a..46bbf16cecf 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location.linear.cmd +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location.linear.cmd @@ -1,3 +1,3 @@ -./data/empty.zero ./data/empty.zero ./data/point_location_linear/curves/test01.txt ./data/point_location_linear/queries/test01.txt -./data/empty.zero ./data/point_location_linear/xcurves/test02.txt ./data/empty.zero ./data/point_location_linear/queries/test02.txt -./data/empty.zero ./data/empty.zero ./data/point_location_linear/curves/test03.txt ./data/point_location_linear/queries/test03.txt +./data/empty.zero ./data/empty.zero ./data/point_location/linear/curves/test01.txt ./data/point_location/linear/queries/test01.txt +./data/empty.zero ./data/point_location/linear/xcurves/test02.txt ./data/empty.zero ./data/point_location/linear/queries/test02.txt +./data/empty.zero ./data/empty.zero ./data/point_location/linear/curves/test03.txt ./data/point_location/linear/queries/test03.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location.segments.cmd b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location.segments.cmd index 65cfde10e8a..6cd142c96a2 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location.segments.cmd +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location.segments.cmd @@ -1,9 +1,9 @@ -./data/empty.zero ./data/empty.zero ./data/point_location_segments/curves/test01.txt ./data/point_location_segments/queries/test01.txt -./data/empty.zero ./data/empty.zero ./data/point_location_segments/curves/test02.txt ./data/point_location_segments/queries/test02.txt -./data/empty.zero ./data/empty.zero ./data/point_location_segments/curves/test03.txt ./data/point_location_segments/queries/test03.txt -./data/empty.zero ./data/empty.zero ./data/point_location_segments/curves/test04.txt ./data/point_location_segments/queries/test04.txt -./data/empty.zero ./data/empty.zero ./data/point_location_segments/curves/test05.txt ./data/point_location_segments/queries/test05.txt -./data/empty.zero ./data/empty.zero ./data/point_location_segments/curves/test06.txt ./data/point_location_segments/queries/test06.txt -./data/empty.zero ./data/empty.zero ./data/point_location_segments/curves/test07.txt ./data/point_location_segments/queries/test07.txt -./data/empty.zero ./data/empty.zero ./data/point_location_segments/curves/test08.txt ./data/point_location_segments/queries/test08.txt -./data/empty.zero ./data/empty.zero ./data/point_location_segments/curves/test09.txt ./data/point_location_segments/queries/test09.txt +./data/empty.zero ./data/empty.zero ./data/point_location/segments/curves/test01.txt ./data/point_location/segments/queries/test01.txt +./data/empty.zero ./data/empty.zero ./data/point_location/segments/curves/test02.txt ./data/point_location/segments/queries/test02.txt +./data/empty.zero ./data/empty.zero ./data/point_location/segments/curves/test03.txt ./data/point_location/segments/queries/test03.txt +./data/empty.zero ./data/empty.zero ./data/point_location/segments/curves/test04.txt ./data/point_location/segments/queries/test04.txt +./data/empty.zero ./data/empty.zero ./data/point_location/segments/curves/test05.txt ./data/point_location/segments/queries/test05.txt +./data/empty.zero ./data/empty.zero ./data/point_location/segments/curves/test06.txt ./data/point_location/segments/queries/test06.txt +./data/empty.zero ./data/empty.zero ./data/point_location/segments/curves/test07.txt ./data/point_location/segments/queries/test07.txt +./data/empty.zero ./data/empty.zero ./data/point_location/segments/curves/test08.txt ./data/point_location/segments/queries/test08.txt +./data/empty.zero ./data/empty.zero ./data/point_location/segments/curves/test09.txt ./data/point_location/segments/queries/test09.txt From 946fe6242a5d960fa65707c6036d857008ff171e Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 1 Dec 2013 14:08:58 +0200 Subject: [PATCH 12/50] reorg --- .../test_point_location_dynamic.segments.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location_dynamic.segments.cmd b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location_dynamic.segments.cmd index f545bac9303..1c22dfed49c 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location_dynamic.segments.cmd +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_point_location_dynamic.segments.cmd @@ -1 +1 @@ -./data/empty.zero ./data/point_location_segments/xcurves/test10.txt ./data/empty.zero ./data/point_location_segments/ops/test10.txt ./data/point_location_segments/queries/test10.txt +./data/empty.zero ./data/point_location/segments/xcurves/test10.txt ./data/empty.zero ./data/point_location/segments/ops/test10.txt ./data/point_location/segments/queries/test10.txt From e429e6176280989262b46c9adfa78e246f6bba17 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 1 Dec 2013 14:41:32 +0200 Subject: [PATCH 13/50] Fixed basic things --- .../Arr_spherical_batched_pl_helper.h | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h index d30bed1ec27..66d190295c1 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // Author(s) : Baruch Zukerman // Ron Wein // Efi Fogel @@ -56,16 +56,16 @@ protected: // Data members: //! The topology-traits class. - const Topology_traits * m_top_traits; + const Topology_traits* m_top_traits; //! The unbounded arrangement face. - Face_const_handle m_unb_face; + Face_const_handle m_spherical_face; public: /*! Constructor. * \param arr The arrangement. */ - Arr_spherical_batched_pl_helper(const Arrangement_2 *arr) : + Arr_spherical_batched_pl_helper(const Arrangement_2* arr) : m_top_traits(arr->topology_traits()) {} @@ -74,22 +74,16 @@ public: /*! A notification issued before the sweep process starts. */ void before_sweep() - { - // Get the unbounded face. - m_unb_face = Face_const_handle(m_top_traits->unbounded_face()); - } + { m_spherical_face = Face_const_handle(m_top_traits->spherical_face()); } /*! A notification invoked after the sweep-line finishes handling the given * event. */ - void after_handle_event(Event * ) { return; } + void after_handle_event(Event*) { return; } //@} - /*! Get the current top face. */ - Face_const_handle top_face() const - { - return m_unb_face; - } + /*! Obtain the current top face. */ + Face_const_handle top_face() const { return m_spherical_face; } }; } //namespace CGAL From e79706bb79a0d24ba5fca5a084a4e0a6cd989f78 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 1 Dec 2013 14:43:54 +0200 Subject: [PATCH 14/50] batched point location for geodesic arcs --- .../geodesic_arcs_on_sphere/curves/test01.txt | 1 - .../geodesic_arcs_on_sphere/curves/test02.txt | 3 +++ .../geodesic_arcs_on_sphere/queries/test02.txt | 3 +++ .../test_batched_point_location.geodesic_arcs_on_sphere.cmd | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test02.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test02.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test01.txt index ce2eee89788..fdfd47dc55e 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test01.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test01.txt @@ -1,3 +1,2 @@ -2 0 0 -1 0 0 1 1 0 -1 0 0 0 -1 0 0 1 1 -1 0 0 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test02.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test02.txt new file mode 100644 index 00000000000..e4d9803ef03 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test02.txt @@ -0,0 +1,3 @@ +0 0 -1 0 0 1 1 0 -1 0 +0 0 -1 0 0 1 1 -1 0 0 +0 -1 0 1 0 0 0 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test02.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test02.txt new file mode 100644 index 00000000000..95d69a449a2 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test02.txt @@ -0,0 +1,3 @@ +1 -1 -1 +1 -1 0 +1 -1 1 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.geodesic_arcs_on_sphere.cmd b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.geodesic_arcs_on_sphere.cmd index a28082bfe6e..0f5c96e9367 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.geodesic_arcs_on_sphere.cmd +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.geodesic_arcs_on_sphere.cmd @@ -1 +1,2 @@ ./data/empty.zero ./data/empty.zero ./data/batched_point_location/geodesic_arcs_on_sphere/curves/test01.txt ./data/batched_point_location/geodesic_arcs_on_sphere/queries/test01.txt +./data/empty.zero ./data/empty.zero ./data/batched_point_location/geodesic_arcs_on_sphere/curves/test02.txt ./data/batched_point_location/geodesic_arcs_on_sphere/queries/test02.txt From c5e1e41ff7cc4d4c02fac1f88f72bcd809ea07eb Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 1 Dec 2013 18:37:15 +0200 Subject: [PATCH 15/50] Vertical decomposition stuff --- .../bounded_planar_vertical_decomposition.cpp | 37 +- .../Batched_point_location_test.h | 16 +- .../Vertical_decomposition_test.h | 315 ++++++++++++++++++ .../test_vertical_decomposition.cpp | 128 +++++++ 4 files changed, 466 insertions(+), 30 deletions(-) create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/Vertical_decomposition_test.h create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.cpp diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp index 569e805a910..e3f8cf06d05 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp @@ -17,12 +17,11 @@ typedef CGAL::Arrangement_2 Arrangement_2; typedef Arrangement_2::Vertex_const_handle Vertex_const_handle; typedef Arrangement_2::Halfedge_const_handle Halfedge_const_handle; typedef Arrangement_2::Face_const_handle Face_const_handle; - -typedef std::pair > - Vert_decomp_entry; +typedef std::pair Object_pair; +typedef std::pair Vert_decomp_entry; typedef std::list Vert_decomp_list; -int main () +int main() { // Construct the arrangement. Arrangement_2 arr; @@ -38,37 +37,35 @@ int main () // Perform vertical ray-shooting from every vertex and locate the feature // that lie below it and the feature that lies above it. - Vert_decomp_list vd_list; - - CGAL::decompose (arr, std::back_inserter(vd_list)); + Vert_decomp_list vd_list; + CGAL::decompose(arr, std::back_inserter(vd_list)); // Print the results. - Vert_decomp_list::const_iterator vd_iter; - std::pair curr; - Vertex_const_handle vh; - Halfedge_const_handle hh; - Face_const_handle fh; - + Vert_decomp_list::const_iterator vd_iter; for (vd_iter = vd_list.begin(); vd_iter != vd_list.end(); ++vd_iter) { - curr = vd_iter->second; + const Object_pair& curr = vd_iter->second; std::cout << "Vertex (" << vd_iter->first->point() << ") : "; + Vertex_const_handle vh; + Halfedge_const_handle hh; + Face_const_handle fh; + std::cout << " feature below: "; - if (CGAL::assign (hh, curr.first)) + if (CGAL::assign(hh, curr.first)) std::cout << '[' << hh->curve() << ']'; - else if (CGAL::assign (vh, curr.first)) + else if (CGAL::assign(vh, curr.first)) std::cout << '(' << vh->point() << ')'; - else if (CGAL::assign (fh, curr.first)) + else if (CGAL::assign(fh, curr.first)) std::cout << "NONE"; else std::cout << "EMPTY"; std::cout << " feature above: "; - if (CGAL::assign (hh, curr.second)) + if (CGAL::assign(hh, curr.second)) std::cout << '[' << hh->curve() << ']' << std::endl; - else if (CGAL::assign (vh, curr.second)) + else if (CGAL::assign(vh, curr.second)) std::cout << '(' << vh->point() << ')' << std::endl; - else if (CGAL::assign (fh, curr.second)) + else if (CGAL::assign(fh, curr.second)) std::cout << "NONE" << std::endl; else std::cout << "EMPTY" << std::endl; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h index 52e1ec835ee..55e8bf887c9 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h @@ -46,9 +46,6 @@ public: typedef typename Points_vector::iterator Point_iterator; - typedef std::vector Objects_vector; - typedef Objects_vector::iterator Object_iterator; - typedef typename boost::variant Cell_handle; @@ -80,11 +77,11 @@ protected: /*! print the results. */ - void print_results(const std::pair& res); + void print(const std::pair& res); /*! print the results. */ - void print_results(const std::pair& res); + void print(const std::pair& res); /*! Compare the results. */ @@ -210,7 +207,7 @@ verify(InputIterator begin, InputIterator end) typedef TopolTraits_T TopolTraits; if (m_verbose_level > 1) { - for (InputIterator it = begin; it != end; ++it) print_results(*it); + for (InputIterator it = begin; it != end; ++it) print(*it); } typename TopolTraits::Default_point_location_strategy pl(m_arr); @@ -257,8 +254,7 @@ compare(const Cell_handle& expected, const Cell_handle& actual) std::cout << "Actual: a vertex." << std::endl; return false; } - std::cout << "Actual: an unknowen object." - << std::endl; + std::cout << "Actual: an unknowen object." << std::endl; return false; } @@ -437,7 +433,7 @@ compare(const CGAL::Object& expected, const CGAL::Object& actual) //! \brief prints the results. template void Batched_point_location_test:: -print_results(const std::pair& res) +print(const std::pair& res) { // Print the results. std::cout << "The point (" << res.first << ") is located "; @@ -459,7 +455,7 @@ print_results(const std::pair& res) //! \brief prints the results. template void Batched_point_location_test:: -print_results(const std::pair& res) +print(const std::pair& res) { // Print the results. std::cout << "The point (" << res.first << ") is located "; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Vertical_decomposition_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Vertical_decomposition_test.h new file mode 100644 index 00000000000..adcc6533c06 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Vertical_decomposition_test.h @@ -0,0 +1,315 @@ +#ifndef CGAL_BATCHED_POINT_LOCATION_TEST_H +#define CGAL_BATCHED_POINT_LOCATION_TEST_H + +#include +#include +#include + +#include +#include +#include + +#include "IO_test.h" + +/*! Point location test */ +template +class Vertical_decomposition_test : public IO_test { +public: + typedef GeomTraits_T Geom_traits; + typedef TopolTraits_T Topol_traits; + +private: + typedef IO_test Base; + +public: + typedef typename Base::Point_2 Point_2; + typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; + typedef typename Base::Curve_2 Curve_2; + + typedef typename Base::Points_vector Points_vector; + typedef typename Base::Xcurves_vector Xcurves_vector; + typedef typename Base::Curves_vector Curves_vector; + + typedef CGAL::Arrangement_on_surface_2 + Arrangement; + + typedef typename Arrangement::Vertex_handle Vertex_handle; + typedef typename Arrangement::Halfedge_handle Halfedge_handle; + typedef typename Arrangement::Face_handle Face_handle; + + typedef typename Arrangement::Vertex_const_handle Vertex_const_handle; + typedef typename Arrangement::Halfedge_const_handle Halfedge_const_handle; + typedef typename Arrangement::Face_const_handle Face_const_handle; + + typedef typename Arrangement::Edge_const_iterator Edge_const_iterator; + typedef typename Arrangement::Vertex_const_iterator Vertex_const_iterator; + + typedef typename std::pair Object_pair; + typedef typename std::pair + Vert_decomp_entry; + typedef typename std::list Vert_decomp_list; + + typedef CGAL::Arr_point_location_result Point_location_result; + typedef typename Point_location_result::Type Result_type; + +protected: + /*! The geometry traits. */ + const Geom_traits& m_geom_traits; + + /*! The arrangement. */ + Arrangement m_arr; + + /*! Verbosity */ + size_t m_verbose_level; + + /*! Verify the results. + */ + template + bool verify(InputIterator begin, InputIterator end); + + /*! Compare the results. + */ + bool compare(const Result_type& expected, const CGAL::Object& actual); + + /*! print the results. + */ + void print(const Vert_decomp_entry& result); + +public: + /*! Constructor from a geometry traits object. + */ + Vertical_decomposition_test(const Geom_traits& geom_traits); + + /*! Destructor */ + virtual ~Vertical_decomposition_test() { clear(); } + + /*! Perform the test. + * \return true upon success and false otherwise. + */ + virtual bool perform(); + + /*! Clear the data structure. */ + virtual void clear(); + + /*! Initialize the data structure. + * \return true upon success and false otherwise. + */ + virtual bool init(); + + /*! Set the verbosity level. + */ + void set_verbose_level(size_t verbose_level); +}; + +/*! + * Constructor from a geometry traits object. + */ +template +Vertical_decomposition_test:: +Vertical_decomposition_test(const Geom_traits& geom_traits) : + Base(geom_traits), + m_geom_traits(geom_traits), + m_verbose_level(0) +{} + +//! \brief sets the verbosity level. +template +void Vertical_decomposition_test:: +set_verbose_level(size_t verbose_level) +{ m_verbose_level = verbose_level; } + +/*! Clear the data structures */ +template +void Vertical_decomposition_test::clear() +{ + m_arr.clear(); + Base::clear(); +} + +template +bool Vertical_decomposition_test::init() +{ + // Initialize the input. + if (!Base::init()) return false; + + // Insert all into the arrangement + CGAL::insert(m_arr, this->m_xcurves.begin(), this->m_xcurves.end()); + // insert(*m_arr, m_points.begin(), m_points.end()); + CGAL::insert(m_arr, this->m_curves.begin(), this->m_curves.end()); + + // Print the size of the arrangement. + if (m_verbose_level > 1) + std::cout << "V = " << m_arr.number_of_vertices() + << ", E = " << m_arr.number_of_edges() + << ", F = " << m_arr.number_of_faces() << std::endl; + + return true; +} + +//! \brief performs the test. +template +bool Vertical_decomposition_test::perform() +{ + // Apply vertical decomposition. + Vert_decomp_list results; + CGAL::decompose(m_arr, std::back_inserter(results)); + + // Verify the results. + return verify(results.begin(), results.end()); +} + +//! \brief verifies the results. +template +template +bool Vertical_decomposition_test:: +verify(InputIterator begin, InputIterator end) +{ + typedef TopolTraits_T TopolTraits; + + InputIterator it; + if (m_verbose_level > 1) for (it = begin; it != end; ++it) print(*it); + + // Compare the results. + typename TopolTraits::Default_vertical_ray_shooting_strategy vs(m_arr); + for (it = begin; it != end; ++it) { + Vertex_const_handle vh = it->first; + const Object_pair& res = it->second; + const CGAL::Object& obj_below_actual = res.first; + const CGAL::Object& obj_above_actual = res.second; + + Result_type obj_below_expected = vs.ray_shoot_down(vh->point()); + Result_type obj_above_expected = vs.ray_shoot_up(vh->point()); + + if (!compare(obj_below_expected, obj_below_actual)) return false; + if (!compare(obj_above_expected, obj_above_actual)) return false; + } + + return true; +} + +template +bool Vertical_decomposition_test:: +compare(const Result_type& expected, const CGAL::Object& actual) +{ + // Assign object to a fase. + const Face_const_handle* fh_expected = + boost::get(&(expected)); + if (fh_expected) { + Vertex_const_handle vh_actual; + if (CGAL::assign(vh_actual, actual)) { + std::cout << "Error: vertical decomposition!" << std::endl; + std::cout << "Expected: a face." << std::endl; + std::cout << "Actual: a vertex." << std::endl; + return false; + } + Halfedge_const_handle hh_actual; + if (CGAL::assign(hh_actual, actual)) { + std::cout << "Error: vertical decomposition!" << std::endl; + std::cout << "Expected: a face." << std::endl; + std::cout << "Actual: a halfedge." << std::endl; + return false; + } + return true; + } + + // Assign object to a halfedge. + const Halfedge_const_handle* hh_expected = + boost::get(&(expected)); + if (hh_expected) { + Halfedge_const_handle hh_actual; + if (CGAL::assign(hh_actual, actual)) { + if (*hh_expected == hh_actual) return true; + + std::cout << "Error: vertical decomposition!" << std::endl; + std::cout << "Expected: a halfedge, " << (*hh_expected)->curve() + << std::endl; + std::cout << "Actual: a different halfedge." << hh_actual->curve() + << std::endl; + return false; + } + + std::cout << "Error: vertical decomposition!" << std::endl; + std::cout << "Expected: a halfedge, " << (*hh_expected)->curve() + << std::endl; + + Vertex_const_handle vh_actual; + if (CGAL::assign(vh_actual, actual)) { + std::cout << "Actual: a vertex, " << vh_actual->point() << std::endl; + return false; + } + + Face_const_handle fh_actual; + if (CGAL::assign(fh_actual, actual)) { + std::cout << "Actual: a face." << std::endl; + return false; + } + std::cout << "Actual: an unknowen object." << std::endl; + return false; + } + + // Assign object to a vertex. + const Vertex_const_handle* vh_expected = + boost::get(&(expected)); + if (vh_expected) { + Vertex_const_handle vh_actual; + if (CGAL::assign(vh_actual, actual)) { + if (*vh_expected == vh_actual) return true; + + std::cout << "Error: vertical decomposition!" << std::endl; + std::cout << "Expected: a vertex, " << (*vh_expected)->point() + << std::endl; + std::cout << "Actual: a different vertex, " << vh_actual->point() + << std::endl; + return false; + } + + std::cout << "Error: vertical decomposition!" << std::endl; + std::cout << "Expected: a vertex, " << (*vh_expected)->point() << std::endl; + + Halfedge_const_handle hh_actual; + if (CGAL::assign(hh_actual, actual)) { + std::cout << "Actual: a halfedge, " << hh_actual->curve() << std::endl; + return false; + } + + Face_const_handle fh_actual; + if (CGAL::assign(fh_actual, actual)) { + std::cout << "Actual: a face." << std::endl; + return false; + } + std::cout << "Actual: an unknowen object." << std::endl; + return false; + } + std::cout << "Error: Unknown!" << std::endl; + return false; +} + +//! \brief prints the results. +template +void Vertical_decomposition_test:: +print(const Vert_decomp_entry& result) +{ + // Print the result. + Vertex_const_handle vh; + Halfedge_const_handle hh; + Face_const_handle fh; + + const Object_pair& res = result.second; + std::cout << "Vertex (" << result.first->point() << ") : "; + + std::cout << " feature below: "; + if (CGAL::assign(hh, res.first)) std::cout << '[' << hh->curve() << ']'; + else if (CGAL::assign(vh, res.first)) std::cout << '(' << vh->point() << ')'; + else if (CGAL::assign(fh, res.first)) std::cout << "NONE"; + else std::cout << "EMPTY"; + + std::cout << " feature above: "; + if (CGAL::assign(hh, res.second)) std::cout << '[' << hh->curve() << ']'; + else if (CGAL::assign(vh, res.second)) std::cout << '(' << vh->point() << ')'; + else if (CGAL::assign(fh, res.second)) std::cout << "NONE"; + else std::cout << "EMPTY"; + + std::cout << std::endl; +} + +#endif diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.cpp new file mode 100644 index 00000000000..da5f2eb4af1 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.cpp @@ -0,0 +1,128 @@ +#include +#include + +#include + +#include "test_configuration.h" + +#if ((TEST_GEOM_TRAITS == CORE_CONIC_GEOM_TRAITS) || \ + (TEST_GEOM_TRAITS == BEZIER_GEOM_TRAITS) || \ + (TEST_GEOM_TRAITS == RATIONAL_ARC_GEOM_TRAITS)) && !defined(CGAL_USE_CORE) + +int main() +{ +// bool UNTESTED_TRAITS_AS_CORE_IS_NOT_INSTALLED; + std::cout << std::endl + << "NOTE: Core is not installed, " + << "skipping the test ..." + << std::endl; + return 0; +} +#elif (TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS) && \ + (TEST_NT == LEDA_INT_NT || TEST_NT == LEDA_RAT_NT) && \ + (! CGAL_USE_LEDA) + +int main() +{ +// bool UNTESTED_TRAITS_AS_LEDA_IS_NOT_INSTALLED; + std::cout << std::endl + << "NOTE: LEDA is not installed, " + << "skipping the test ..." + << std::endl; + return 0; +} + +#elif (TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS) && \ + (TEST_NT == CGAL_GMPZ_NT || TEST_NT == CGAL_GMPQ_NT) && \ + ! (CGAL_USE_GMP && CGAL_USE_MPFI) + +int main() +{ + +// bool UNTESTED_TRAITS_AS_GMP_OR_MPFI_IS_NOT_INSTALLED; + std::cout << std::endl + << "NOTE: GMP and/or MPFI are not installed, " + << "skipping the test ..." + << std::endl; + return 0; +} + +#elif (TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS) && \ + (TEST_NT == CORE_INT_NT) && \ + !CGAL_USE_CORE + +int main() +{ +// bool UNTESTED_TRAITS_AS_CORE_IS_NOT_INSTALLED; + std::cout << std::endl + << "NOTE: CORE is not installed, " + << "skipping the test ..." + << std::endl; + return 0; +} + + +#else + +#include "test_traits.h" +#include "Vertical_decomposition_test.h" + +bool test(const char* points_filename, const char* xcurves_filename, + const char* curves_filename, size_t verbose_level) +{ + Geom_traits geom_traits; + Vertical_decomposition_test pl_test(geom_traits); + pl_test.set_verbose_level(verbose_level); + pl_test.set_filenames(points_filename, xcurves_filename, curves_filename); + + if (!pl_test.init()) return false; + if (!pl_test.perform()) return false; + pl_test.clear(); + + return true; +} + +int main(int argc, char* argv[]) +{ +#if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS + CGAL::set_pretty_mode(std::cout); + CGAL::set_pretty_mode(std::cerr); +#endif + + size_t verbose_level = 0; + int success = 0; + size_t i = 1; + + // Test 1 + if ((argc > 2) && (std::strncmp(argv[1], "-v", 2) == 0)) { + verbose_level = boost::lexical_cast(argv[2]); + i += 2; + } + + if (argc < (i + 3)) { + std::cout << "Usage: " << argv[0] + << " point-file xcurve-file curve-file" + << std::endl; + std::cout << "point-file - the input point file" << std::endl; + std::cout << "xcurve-file - the input x-monotone curves file" << std::endl; + std::cout << "curve-file - the input curve file" << std::endl; + return -1; + } + + for (; i < argc; i += 3) { + const char* points_filename = argv[i]; + const char* xcurves_filename = argv[i+1]; + const char* curves_filename = argv[i+2]; + + if (!test(points_filename, xcurves_filename, curves_filename, verbose_level)) + { + std::cout << "ERROR : " << argv[0] << " " + << points_filename << " " << xcurves_filename << " " + << curves_filename << std::endl; + success = -1; + } + } + return success; +} + +#endif From c3a869f61ba7a7d0db2fd410d10bbb910aa32f85 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 1 Dec 2013 18:37:51 +0200 Subject: [PATCH 16/50] cleaned up --- .../Arr_bounded_planar_topology_traits_2.h | 221 ++++++++---------- .../CGAL/Arr_spherical_topology_traits_2.h | 3 +- .../CGAL/Arr_unb_planar_topology_traits_2.h | 126 ++++------ 3 files changed, 143 insertions(+), 207 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h index 2890df62f0b..ec195074bbc 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Ron Wein // Efi Fogel @@ -39,7 +39,7 @@ namespace CGAL { // Forward declaration: -template +template class Arrangement_on_surface_2; /*! \class Arr_bounded_planar_topology_traits_2 @@ -81,14 +81,14 @@ public: typedef Arr_bounded_planar_topology_traits_2 Self; typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; //!@} - + ///! \name The side tags //@{ typedef typename Traits_adaptor_2::Left_side_category Left_side_category; typedef typename Traits_adaptor_2::Bottom_side_category Bottom_side_category; typedef typename Traits_adaptor_2::Top_side_category Top_side_category; typedef typename Traits_adaptor_2::Right_side_category Right_side_category; - + BOOST_MPL_ASSERT ((boost::is_same< Left_side_category, Arr_oblivious_side_tag >)); BOOST_MPL_ASSERT @@ -100,23 +100,22 @@ public: //@} /*! \struct - * An auxiliary structure for rebinding the topology traits with a new + * An auxiliary structure for rebinding the topology traits with a new * geometry-traits class and a new DCEL class. */ template - struct rebind - { - typedef Arr_bounded_planar_topology_traits_2 other; + struct rebind { + typedef Arr_bounded_planar_topology_traits_2 other; }; protected: // Data members: - Face *unb_face; // The unbounded face. + Face* unb_face; // The unbounded face. // Copy constructor and assignment operator - not supported. - Arr_bounded_planar_topology_traits_2 (const Self& ); - Self& operator= (const Self& ); + Arr_bounded_planar_topology_traits_2 (const Self&); + Self& operator=(const Self&); public: @@ -126,17 +125,17 @@ public: /*! Default constructor. */ Arr_bounded_planar_topology_traits_2 () : Base(), - unb_face (NULL) + unb_face(NULL) {} /*! Constructor with a geometry-traits class. */ - Arr_bounded_planar_topology_traits_2 (const Geometry_traits_2 *tr) : - Base (tr), - unb_face (NULL) + Arr_bounded_planar_topology_traits_2(const Geometry_traits_2* tr) : + Base(tr), + unb_face(NULL) {} /*! Assign the contents of another topology-traits class. */ - void assign (const Self& other); + void assign(const Self& other); //@} ///! \name Accessing the DCEL and constructing iterators. @@ -151,52 +150,40 @@ public: } /*! Check if the given vertex is concrete (associated with a point). */ - inline bool is_concrete_vertex (const Vertex *) const - { - return (true); - } + inline bool is_concrete_vertex (const Vertex*) const { return true; } /*! Get the number of concrete vertices. */ - Size number_of_concrete_vertices () const + Size number_of_concrete_vertices() const { // All vertices are concrete. return (this->m_dcel.size_of_vertices()); } /*! Check if the given vertex is valid (not a fictitious one). */ - inline bool is_valid_vertex (const Vertex *) const - { - return (true); - } + inline bool is_valid_vertex(const Vertex*) const { return true; } /*! Get the number of valid vertices. */ - Size number_of_valid_vertices () const + Size number_of_valid_vertices() const { // All vertices are valid. return (this->m_dcel.size_of_vertices()); } /*! Check if the given halfedge is valid (not a fictitious one). */ - inline bool is_valid_halfedge (const Halfedge *) const - { - return (true); - } + inline bool is_valid_halfedge(const Halfedge*) const { return true; } /*! Get the number of valid halfedges. */ - Size number_of_valid_halfedges () const + Size number_of_valid_halfedges() const { // All halfedges are valid. return (this->m_dcel.size_of_halfedges()); } /*! Check if the given face is valid (not a fictitious one). */ - inline bool is_valid_face (const Face *) const - { - return (true); - } + inline bool is_valid_face (const Face*) const { return true; } /*! Get the number of valid faces. */ - Size number_of_valid_faces () const + Size number_of_valid_faces() const { // All faces are valid. return (this->m_dcel.size_of_faces()); @@ -207,10 +194,10 @@ private: /// \name Auxiliary type definitions. //@{ - typedef Arrangement_on_surface_2 Arr; + typedef Arrangement_on_surface_2 Arr; // Type definition for the constuction sweep-line visitor. - typedef Arr_construction_subcurve CSubcurve; + typedef Arr_construction_subcurve CSubcurve; typedef Arr_construction_event CEvent; @@ -221,7 +208,7 @@ private: // Type definition for the basic insertion sweep-line visitor. typedef Arr_basic_insertion_traits_2 BInsTraits; - typedef Arr_construction_subcurve BISubcurve; + typedef Arr_construction_subcurve BISubcurve; typedef Arr_construction_event BIEvent; @@ -232,7 +219,7 @@ private: // Type definition for the insertion sweep-line visitor. typedef Arr_insertion_traits_2 InsTraits; - typedef Arr_construction_subcurve ISubcurve; + typedef Arr_construction_subcurve ISubcurve; typedef Arr_construction_event IEvent; @@ -273,9 +260,9 @@ private: typedef typename Base::Subcurve Subcurve; typedef typename Base::Construction_helper Construction_helper; - _Overlay_helper (const ArrangementA_ *arrA, - const ArrangementB_ *arrB) : - Base (arrA, arrB) + _Overlay_helper (const ArrangementA_* arr_a, + const ArrangementB_* arr_b) : + Base(arr_a, arr_b) {} }; //@} @@ -293,7 +280,7 @@ public: typedef Sweep_line_construction_visitor Sweep_line_non_intersecting_construction_visitor; - + typedef Arr_basic_insertion_sl_visitor Sweep_line_non_intersecting_insertion_visitor; @@ -308,9 +295,9 @@ public: typedef typename Base::Event Event; typedef typename Base::Subcurve Subcurve; - Sweep_line_batched_point_location_visitor (const Arr *arr, + Sweep_line_batched_point_location_visitor(const Arr* arr, Output_iterator& oi) : - Base (arr, oi) + Base(arr, oi) {} }; @@ -325,9 +312,9 @@ public: typedef typename Base::Event Event; typedef typename Base::Subcurve Subcurve; - Sweep_line_vertical_decomposition_visitor (const Arr *arr, - Output_iterator *oi) : - Base (arr, oi) + Sweep_line_vertical_decomposition_visitor(const Arr* arr, + Output_iterator* oi) : + Base(arr, oi) {} }; @@ -338,7 +325,7 @@ public: Arr_overlay_traits_2< Arr_traits_basic_adaptor_2, ArrangementA_, ArrangementB_>, - ArrangementA_, + ArrangementA_, ArrangementB_>, OverlayTraits_> { @@ -347,7 +334,7 @@ public: typedef Arr Arrangement_result_2; typedef OverlayTraits_ Overlay_traits; - typedef Arr_overlay_traits_2< + typedef Arr_overlay_traits_2< Arr_traits_basic_adaptor_2, ArrangementA_2, ArrangementB_2> Geom_ovl_traits_2; @@ -362,20 +349,22 @@ public: typedef typename Base::Event Event; typedef typename Base::Subcurve Subcurve; - Sweep_line_overlay_visitor (const ArrangementA_2 *arrA, - const ArrangementB_2 *arrB, - Arrangement_result_2 *arr_res, - Overlay_traits *overlay_tr) : + Sweep_line_overlay_visitor (const ArrangementA_2* arrA, + const ArrangementB_2* arrB, + Arrangement_result_2* arr_res, + Overlay_traits* overlay_tr) : Base (arrA, arrB, arr_res, overlay_tr) {} }; typedef Arr_inc_insertion_zone_visitor - Zone_insertion_visitor; + Zone_insertion_visitor; typedef Arr_walk_along_line_point_location - Default_point_location_strategy; + Default_point_location_strategy; + typedef Arr_walk_along_line_point_location + Default_vertical_ray_shooting_strategy; //@} ///! \name Topology-traits methods. @@ -384,12 +373,12 @@ public: /*! * Initialize an empty DCEL structure. */ - void init_dcel (); + void init_dcel(); /*! * Make the necessary updates after the DCEL structure have been updated. */ - void dcel_updated (); + void dcel_updated(); /*! * Check if the given vertex is associated with the given curve end. @@ -401,21 +390,19 @@ public: * \pre The curve has a boundary condition in either x or y. * \return Whether v represents the given curve end. */ - bool are_equal (const Vertex *v, - const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space ps_x, Arr_parameter_space ps_y) const + bool are_equal(const Vertex* v, + const X_monotone_curve_2& cv, Arr_curve_end ind, + Arr_parameter_space ps_x, Arr_parameter_space ps_y) const { CGAL_assertion ((ps_x == ARR_INTERIOR) && (ps_y == ARR_INTERIOR)); - if (ind == ARR_MIN_END) - { + if (ind == ARR_MIN_END) { // Compare v with the left endpoint of cv. return (this->traits->equal_2_object() (this->traits->construct_min_vertex_2_object() (cv), v->point())); } - else - { + else { // Compare v with the right endpoint of cv. return (this->traits->equal_2_object() (this->traits->construct_max_vertex_2_object() (cv), @@ -435,11 +422,11 @@ public: * \pre The curve has a boundary condition in either x or y. * \return An object that contains the curve end. */ - CGAL::Object place_boundary_vertex (Face *, - const X_monotone_curve_2&, - Arr_curve_end, - Arr_parameter_space /* ps_x */, - Arr_parameter_space /* ps_y */) + CGAL::Object place_boundary_vertex(Face*, + const X_monotone_curve_2&, + Arr_curve_end, + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) { // This function should never be called: CGAL_error(); @@ -459,14 +446,14 @@ public: * \return An object that contains the curve end. */ Halfedge* - locate_around_boundary_vertex (Vertex *, - const X_monotone_curve_2&, - Arr_curve_end, - Arr_parameter_space /* ps_x */, - Arr_parameter_space /* ps_y */) const + locate_around_boundary_vertex(Vertex*, + const X_monotone_curve_2&, + Arr_curve_end, + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) const { CGAL_error(); - return (NULL); + return NULL; } /*! @@ -478,10 +465,10 @@ public: * \pre The curve end is incident to the boundary. * \return An object that contains the curve end. */ - CGAL::Object locate_curve_end (const X_monotone_curve_2&, - Arr_curve_end, - Arr_parameter_space /* ps_x */, - Arr_parameter_space /* ps_y */) + CGAL::Object locate_curve_end(const X_monotone_curve_2&, + Arr_curve_end, + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) { // This function should never be called: CGAL_error(); @@ -496,34 +483,28 @@ public: * \return A halfedge whose direction is the same as e's and whose target is * the split vertex v. */ - Halfedge* split_fictitious_edge (Halfedge *, Vertex *) + Halfedge* split_fictitious_edge (Halfedge*, Vertex*) { // This function should never be called: CGAL_error(); - return (NULL); + return NULL; } /*! * Determine whether the given face is unbounded. * \param f The face. * \return Whether f is unbounded. + * There is only one unbounded face in the arrangement: */ - bool is_unbounded (const Face *f) const - { - // There is only one unbounded face in the arrangement: - return (f == unb_face); - } + bool is_unbounded(const Face* f) const { return (f == unb_face); } /*! * Determine whether the given boundary vertex is redundant. * \param v The vertex. * \return Whether v is redundant, and should be erased. + * There are no redundant vertices. */ - bool is_redundant (const Vertex *) const - { - // There are no redundant vertices. - return (false); - } + bool is_redundant(const Vertex*) const { return false; } /*! * Erase the given redundant vertex by merging a fictitious edge. @@ -532,11 +513,11 @@ public: * \pre v is a redundant vertex. * \return One of the pair of halfedges that form the merged edge. */ - Halfedge* erase_redundant_vertex (Vertex *) + Halfedge* erase_redundant_vertex(Vertex*) { // This function should never be called: CGAL_error(); - return (NULL); + return NULL; } //! reference_face (const version). @@ -545,21 +526,15 @@ public: point. \return A pointer to the reference face. */ - const Face* reference_face() const - { - return unbounded_face(); - } - + const Face* reference_face() const { return unbounded_face(); } + //! reference_face (non-const version). /*! The function returns a reference face of the arrangement. All reference faces of arrangements of the same type have a common point. \return A pointer to the reference face. */ - Face* reference_face() - { - return unbounded_face(); - } + Face* reference_face() { return unbounded_face(); } //@} @@ -567,22 +542,18 @@ public: //@{ /*! This function is used by the "walk" point-location strategy. */ - const Face* initial_face () const + const Face* initial_face() const { return (unb_face); } /*! Get the unbounded face (const version). */ - const Face* unbounded_face () const - { - return (unb_face); - } + const Face* unbounded_face() const + { return (unb_face); } /*! Get the unbounded face (non-const version). */ - Face* unbounded_face () - { - return (unb_face); - } + Face* unbounded_face() + { return (unb_face); } //@} /// \name Additional predicates, specialized for this topology-traits class. @@ -594,11 +565,9 @@ public: * \param v The vertex. * \return The result of the comparison of the x-coordinates of p and v. */ - virtual Comparison_result compare_x (const Point_2& p, - const Vertex* v) const - { - return (this->traits->compare_x_2_object() (p, v->point())); - } + virtual Comparison_result compare_x(const Point_2& p, + const Vertex* v) const + { return (this->traits->compare_x_2_object()(p, v->point())); } /*! * Compare the given vertex and the given point. @@ -606,11 +575,9 @@ public: * \param v The vertex. * \return The result of the xy-lexicographic comparison of p and v. */ - virtual Comparison_result compare_xy (const Point_2& p, - const Vertex* v) const - { - return (this->traits->compare_xy_2_object() (p, v->point())); - } + virtual Comparison_result compare_xy(const Point_2& p, + const Vertex* v) const + { return (this->traits->compare_xy_2_object()(p, v->point())); } /*! * Compare the relative y-position of the given point and the given edge @@ -620,11 +587,9 @@ public: * \pre p should lie in the x-range of the given edge. * \return The relative y-position of the point p and the edge. */ - virtual Comparison_result compare_y_at_x (const Point_2& p, - const Halfedge* he) const - { - return (this->traits->compare_y_at_x_2_object() (p, he->curve())); - } + virtual Comparison_result compare_y_at_x(const Point_2& p, + const Halfedge* he) const + { return (this->traits->compare_y_at_x_2_object()(p, he->curve())); } //@} }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h index 0dc951f41cb..961117fbabf 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h @@ -449,7 +449,8 @@ public: typedef Arr_inc_insertion_zone_visitor Zone_insertion_visitor; - typedef Arr_naive_point_location Default_point_location_strategy; + typedef Arr_naive_point_location Default_point_location_strategy; + typedef Arr_naive_point_location Default_vertical_ray_shooting_strategy; //@} ///! \name Topology-traits methods. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h index dae2b740ad1..dadcb3e5fda 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h @@ -390,10 +390,13 @@ public: }; typedef Arr_inc_insertion_zone_visitor - Zone_insertion_visitor; + Zone_insertion_visitor; typedef Arr_walk_along_line_point_location - Default_point_location_strategy; + Default_point_location_strategy; + + typedef Arr_walk_along_line_point_location + Default_vertical_ray_shooting_strategy; //@} ///! \name Topology-traits methods. @@ -402,12 +405,12 @@ public: /*! * Initialize an empty DCEL structure. */ - void init_dcel (); + void init_dcel(); /*! * Make the necessary updates after the DCEL structure have been updated. */ - void dcel_updated (); + void dcel_updated(); /*! * Check if the given vertex is associated with the given curve end. @@ -419,9 +422,9 @@ public: * \pre The curve has a boundary condition in either x or y. * \return Whether v represents the given curve end. */ - bool are_equal (const Vertex *v, - const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space ps_x, Arr_parameter_space ps_y) const; + bool are_equal(const Vertex* v, + const X_monotone_curve_2& cv, Arr_curve_end ind, + Arr_parameter_space ps_x, Arr_parameter_space ps_y) const; /*! * Given a curve end with boundary conditions and a face that contains the @@ -436,11 +439,11 @@ public: * \return An object that contains the curve end. * In our case this object always wraps a fictitious edge. */ - CGAL::Object place_boundary_vertex (Face *f, - const X_monotone_curve_2& cv, - Arr_curve_end ind, - Arr_parameter_space ps_x, - Arr_parameter_space ps_y); + CGAL::Object place_boundary_vertex(Face* f, + const X_monotone_curve_2& cv, + Arr_curve_end ind, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); /*! * Locate the predecessor halfedge for the given curve around a given @@ -455,11 +458,11 @@ public: * \return An object that contains the curve end. */ Halfedge* - locate_around_boundary_vertex (Vertex* /* v */, - const X_monotone_curve_2& /* cv */, - Arr_curve_end /* ind */, - Arr_parameter_space /* ps_x */, - Arr_parameter_space /* ps_y */) const + locate_around_boundary_vertex(Vertex* /* v */, + const X_monotone_curve_2& /* cv */, + Arr_curve_end /* ind */, + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) const { CGAL_error(); return (NULL); @@ -476,10 +479,10 @@ public: * In our case this object may either wrap an unbounded face, * or an edge with an end-vertex at infinity (in case of an overlap). */ - CGAL::Object locate_curve_end (const X_monotone_curve_2& cv, - Arr_curve_end ind, - Arr_parameter_space ps_x, - Arr_parameter_space ps_y); + CGAL::Object locate_curve_end(const X_monotone_curve_2& cv, + Arr_curve_end ind, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); /*! * Split a fictitious edge using the given vertex. @@ -489,21 +492,21 @@ public: * \return A halfedge whose direction is the same as e's and whose target is * the split vertex v. */ - Halfedge* split_fictitious_edge (Halfedge *e, Vertex *v); + Halfedge* split_fictitious_edge(Halfedge* e, Vertex* v); /*! * Determine whether the given face is unbounded. * \param f The face. * \return Whether f is unbounded. */ - bool is_unbounded (const Face *f) const; + bool is_unbounded(const Face* f) const; /*! * Determine whether the given boundary vertex is redundant. * \param v The vertex. * \return Whether v is redundant, and should be erased. */ - bool is_redundant (const Vertex *v) const; + bool is_redundant(const Vertex* v) const; /*! * Erase the given redundant vertex by merging a fictitious edge. @@ -512,7 +515,7 @@ public: * \pre v is a redundant vertex. * \return One of the pair of halfedges that form the merged edge. */ - Halfedge* erase_redundant_vertex (Vertex *v); + Halfedge* erase_redundant_vertex(Vertex* v); //! reference_face (const version). /*! The function returns a reference face of the arrangement. @@ -544,70 +547,37 @@ public: //@{ /*! This function is used by the "walk" point-location strategy. */ - const Face* initial_face () const - { - return (fict_face); - } + const Face* initial_face() const { return fict_face; } /*! Get the fictitious face (const version). */ - const Face* fictitious_face () const - { - return (fict_face); - } + const Face* fictitious_face() const { return fict_face; } /*! Get the fictitious face (non-const version). */ - Face* fictitious_face () - { - return (fict_face); - } + Face* fictitious_face() { return fict_face; } /*! Get the bottom-left fictitious vertex (const version). */ - const Vertex* bottom_left_vertex () const - { - return (v_bl); - } + const Vertex* bottom_left_vertex() const { return (v_bl); } /*! Get the bottom-left fictitious vertex (non-const version). */ - Vertex* bottom_left_vertex () - { - return (v_bl); - } + Vertex* bottom_left_vertex() { return (v_bl); } /*! Get the top-left fictitious vertex (const version). */ - const Vertex* top_left_vertex () const - { - return (v_tl); - } + const Vertex* top_left_vertex() const { return (v_tl); } /*! Get the top-left fictitious vertex (non-const version). */ - Vertex* top_left_vertex () - { - return (v_tl); - } + Vertex* top_left_vertex() { return (v_tl); } /*! Get the bottom-right fictitious vertex (const version). */ - const Vertex* bottom_right_vertex () const - { - return (v_br); - } + const Vertex* bottom_right_vertex() const { return (v_br); } /*! Get the bottom-right fictitious vertex (non-const version). */ - Vertex* bottom_right_vertex () - { - return (v_br); - } + Vertex* bottom_right_vertex() { return (v_br); } /*! Get the top-right fictitious vertex (const version). */ - const Vertex* top_right_vertex () const - { - return (v_tr); - } + const Vertex* top_right_vertex() const { return (v_tr); } /*! Get the top-right fictitious vertex (non-const version). */ - Vertex* top_right_vertex () - { - return (v_tr); - } + Vertex* top_right_vertex() { return (v_tr); } //@} /// \name Additional predicates, specialized for this topology-traits class. @@ -619,8 +589,8 @@ public: * \param v The vertex. * \return The result of the comparison of the x-coordinates of p and v. */ - virtual Comparison_result compare_x (const Point_2& p, - const Vertex* v) const; + virtual Comparison_result compare_x(const Point_2& p, + const Vertex* v) const; /*! * Compare the given vertex (which may lie at infinity) and the given point. @@ -628,8 +598,8 @@ public: * \param v The vertex. * \return The result of the xy-lexicographic comparison of p and v. */ - virtual Comparison_result compare_xy (const Point_2& p, - const Vertex* v) const; + virtual Comparison_result compare_xy(const Point_2& p, + const Vertex* v) const; /*! * Compare the relative y-position of the given point and the given edge @@ -639,8 +609,8 @@ public: * \pre p should lie in the x-range of the given edge. * \return The relative y-position of the point p and the edge. */ - virtual Comparison_result compare_y_at_x (const Point_2& p, - const Halfedge* he) const; + virtual Comparison_result compare_y_at_x(const Point_2& p, + const Halfedge* he) const; //@} protected: @@ -656,7 +626,7 @@ protected: * \pre v is a valid (not fictitious) boundary. * \return The curve that induces v, or NULL if v has no incident curves yet. */ - const X_monotone_curve_2* _curve (const Vertex *v, Arr_curve_end& ind) const; + const X_monotone_curve_2* _curve(const Vertex* v, Arr_curve_end& ind) const; /*! * Check whether the given infinite curve end lies on the given fictitious @@ -670,10 +640,10 @@ protected: * \param eq_target Output: Whether the curve coincides with he's target. * \return Whether the curve end lies on the fictitious halfedge. */ - bool _is_on_fictitious_edge (const X_monotone_curve_2& cv, Arr_curve_end ind, + bool _is_on_fictitious_edge(const X_monotone_curve_2& cv, Arr_curve_end ind, Arr_parameter_space ps_x, Arr_parameter_space ps_y, - const Halfedge *he, + const Halfedge* he, bool& eq_source, bool& eq_target); //@} }; From e84298fce519befded6284be3a031f4cf932486c Mon Sep 17 00:00:00 2001 From: Eric Berberich Date: Sun, 1 Dec 2013 18:00:52 +0100 Subject: [PATCH 17/50] removed compiler warning about comparison of incompatible type --- .../Arrangement_on_surface_2/test_batched_point_location.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.cpp index 071349e529e..2983da5a445 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.cpp @@ -101,7 +101,7 @@ int main(int argc, char* argv[]) i += 2; } - if (argc < (i + 4)) { + if (argc < (static_cast< int >(i) + 4)) { std::cout << "Usage: " << argv[0] << " point-file xcurve-file curve-file query-file" << std::endl; @@ -112,7 +112,7 @@ int main(int argc, char* argv[]) return -1; } - for (; i < argc; i += 4) { + for (; static_cast< int >(i) < argc; i += 4) { const char* points_filename = argv[i]; const char* xcurves_filename = argv[i+1]; const char* curves_filename = argv[i+2]; From bd77f2417b628465e6c3ffd390c1991f9c9a2a04 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 1 Dec 2013 19:01:46 +0200 Subject: [PATCH 18/50] Introduced test of vertical decomposition --- .../Arrangement_on_surface_2/cgal_test_base | 41 +++++++++++++++++++ .../segments/curves/test01.txt | 6 +++ .../test_vertical_decomposition.segments.cmd | 1 + 3 files changed, 48 insertions(+) create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/vertical_decomposition/segments/curves/test01.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.segments.cmd diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base index ad6dcfa5b0d..6d41d689afa 100755 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base @@ -939,6 +939,43 @@ test_batched_point_location_spherical_arcs() compile_and_run_with_flags test_batched_point_location geodesic_arcs_on_sphere "$flags" } +#---------------------------------------------------------------------# +# vertical decomposition with segments +#---------------------------------------------------------------------# +test_vertical_decomposition_segments() +{ + local nt=$CGAL_GMPQ_NT; + local kernel=$CARTESIAN_KERNEL; + local geom_traits=$SEGMENT_GEOM_TRAITS; + local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; + compile_and_run_with_flags test_vertical_decomposition segments "$flags" +} + +#---------------------------------------------------------------------# +# vertical decomposition with linear objects +#---------------------------------------------------------------------# +test_vertical_decomposition_linear() +{ + local nt=$CGAL_GMPQ_NT; + local kernel=$CARTESIAN_KERNEL; + local geom_traits=$LINEAR_GEOM_TRAITS; + local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits"; + compile_and_run_with_flags test_vertical_decomposition linear "$flags" +} + +#---------------------------------------------------------------------# +# vertical decomposition with geodesic arcs on the sphere +#---------------------------------------------------------------------# +test_vertical_decomposition_spherical_arcs() +{ + local nt=$CGAL_GMPQ_NT; + local kernel=$CARTESIAN_KERNEL; + local geom_traits=$LINEAR_GEOM_TRAITS; + local topol_traits=$SPHERICAL_TOPOL_TRAITS; + local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits -DTEST_TOPOL_TRAITS=$topol_traits"; + compile_and_run_with_flags test_vertical_decomposition geodesic_arcs_on_sphere "$flags" +} + #---------------------------------------------------------------------# # segment traits #---------------------------------------------------------------------# @@ -1466,6 +1503,10 @@ test_batched_point_location_segments test_batched_point_location_linear test_batched_point_location_spherical_arcs +test_vertical_decomposition_segments +# test_vertical_decomposition_linear +# test_vertical_decomposition_spherical_arcs + compile_and_run test_dual compile_and_run test_do_intersect compile_and_run test_zone diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/vertical_decomposition/segments/curves/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/vertical_decomposition/segments/curves/test01.txt new file mode 100644 index 00000000000..fe72d84beed --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/vertical_decomposition/segments/curves/test01.txt @@ -0,0 +1,6 @@ +0 0 2 2 +1 0 2 1 +0 1 1 2 +2 0 0 2 +1 0 0 1 +2 1 1 2 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.segments.cmd b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.segments.cmd new file mode 100644 index 00000000000..2e4cb8ab4e1 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.segments.cmd @@ -0,0 +1 @@ +./data/empty.zero ./data/empty.zero ./data/vertical_decomposition/segments/curves/test01.txt From 5482fd59479ea2cd2f0c1c0237602e46d9e11f00 Mon Sep 17 00:00:00 2001 From: Eric Berberich Date: Sun, 1 Dec 2013 18:01:47 +0100 Subject: [PATCH 19/50] move print results into the execution loop --- .../Batched_point_location_test.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h index 52e1ec835ee..2e6dd289284 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h @@ -209,12 +209,12 @@ verify(InputIterator begin, InputIterator end) { typedef TopolTraits_T TopolTraits; - if (m_verbose_level > 1) { - for (InputIterator it = begin; it != end; ++it) print_results(*it); - } - typename TopolTraits::Default_point_location_strategy pl(m_arr); for (InputIterator it = begin; it != end; ++it) { + + if (m_verbose_level > 1) + print_results(*it); + // Perform (single) point location. Result_type obj = pl.locate(it->first); From 5b20defb9578eaf46777961d503592474012270b Mon Sep 17 00:00:00 2001 From: Eric Berberich Date: Sun, 1 Dec 2013 18:02:21 +0100 Subject: [PATCH 20/50] implemented after_handle_event for spherical batched point location helper --- .../Arr_spherical_batched_pl_helper.h | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h index 66d190295c1..f787a3195cd 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h @@ -49,6 +49,7 @@ public: typedef Sweep_line_empty_visitor Base_visitor; typedef typename Base_visitor::Event Event; typedef typename Base_visitor::Subcurve Subcurve; + typedef typename Event::Subcurve_iterator Subcurve_iterator; protected: @@ -79,7 +80,37 @@ public: /*! A notification invoked after the sweep-line finishes handling the given * event. */ - void after_handle_event(Event*) { return; } + void after_handle_event(Event* event) { + + if (event->parameter_space_in_y() == ARR_TOP_BOUNDARY) { + Arr_curve_end ind = ((event->number_of_left_curves() == 0) && + (event->number_of_right_curves() != 0)) ? + ARR_MIN_END : ARR_MAX_END; + Subcurve_iterator it, nit, it_end; + if (ind == ARR_MIN_END) { + it = nit = event->right_curves_begin(); + it_end = event->right_curves_end(); + } else { + it = nit = event->left_curves_begin(); + it_end = event->left_curves_end(); + } + + ++nit; + if (it != it_end) { + while (nit != it_end) { + ++it; + ++nit; + } + } + const Subcurve* sc = *it; + // pick the one facing the top right corner now + m_spherical_face = sc->last_curve().halfedge_handle()->face(); + } + + // TODO EBEB 2013-12-01 do the same for right boundaryx + + return; + } //@} /*! Obtain the current top face. */ From 28cae3423f8665b64be746ad0b5bbef34171bd2a Mon Sep 17 00:00:00 2001 From: Eric Berberich Date: Sun, 1 Dec 2013 18:02:57 +0100 Subject: [PATCH 21/50] bugfix: vertical curve must only be considered of the respective halfedge is LEFT TO RIGHT --- .../Arr_spherical_topology_traits_2_impl.h | 76 ++++++++++--------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h index d4edb223b17..b904f7d6757 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // Author(s) : Efi Fogel // Ron Wein @@ -66,7 +66,7 @@ assign(const Self& other) // Take care of the traits object. if (m_own_traits && m_traits != NULL) delete m_traits; - + if (other.m_own_traits) { m_traits = new Traits_adaptor_2; @@ -114,7 +114,7 @@ void Arr_spherical_topology_traits_2::dcel_updated() // Go over the DCEL faces and locate the spherical face, which is the only // face with no outer CCB. typename Dcel::Face_iterator fit; - + m_spherical_face = NULL; for (fit = this->m_dcel.faces_begin(); fit != this->m_dcel.faces_end(); ++fit) { @@ -163,7 +163,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const * face that contains everything also contains the north pole. (In the * degenerate case, where a vertex coincides with the north pole, the face * that contains everything is incident to the north pole.) - * If the face has no iuter ccb's, it contains everything: + * If the face has no outer ccb's, it contains everything: */ #if 0 std::cout << "p: " << p @@ -178,9 +178,9 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const /*! \todo a temporary test * if (((v != NULL) && (v->parameter_space_in_y() == ARR_BOTTOM_BOUNDARY)) || * (p.is_min_boundary())) - * return false; + * return false; */ - + typename Traits_adaptor_2::Parameter_space_in_x_2 ps_x_op = m_traits->parameter_space_in_x_2_object(); typename Traits_adaptor_2::Parameter_space_in_y_2 ps_y_op = @@ -191,7 +191,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const m_traits->compare_y_at_x_2_object(); typename Traits_adaptor_2::Compare_x_point_curve_end_2 cmp_x_pt_ce = m_traits->compare_x_point_curve_end_2_object(); - + /* Maintain a counter of the number of x-monotone curves that intersect an * upward vertical ray emanating from p. Handle degenerate cases as * explained below). @@ -226,7 +226,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const * than the x-possition of the next-curve target, or vise verase (that is, * the "smaller" and "larger" interchanged). */ - + /* Indicates that a change between the x-position of p and the x-position * of the current-curve source, and the x-position of p and the x-position * of the current-curve target is pending. Used to handle case (2) above. @@ -247,7 +247,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const Arr_parameter_space ps_x_p = ARR_INTERIOR; if (v != NULL) ps_x_p = v->parameter_space_in_x(); - + do { /* Compare p to the target vertex of the current halfedge. If the * vertex v is on the boundary of the component, p is not in the interior @@ -257,26 +257,28 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const // Ignore vertical curves: bool is_vertical = m_traits->is_vertical_2_object()(curr->curve()); - if (is_vertical) + if (is_vertical) { - /* If this outer ccb chain contains the north pole, and our point + /* If this outer ccb chain contains the north pole, and our point * lies horizontaly between the two vertical curves that meet at * the north pole, increase the intersection counter */ - Arr_parameter_space ps_y_1 = ps_y_op(curr->curve(), ARR_MAX_END); - Arr_parameter_space ps_y_2 = ps_y_op(curr->next()->curve(), ARR_MAX_END); - if ((ps_y_1 == ARR_TOP_BOUNDARY) && (ps_y_2 == ARR_TOP_BOUNDARY)) { - // Compare the x-coordinates: - Comparison_result rc1 = - cmp_x_pt_ce(p, curr->curve(), ARR_MAX_END); - Comparison_result rc2 = - cmp_x_pt_ce(p, curr->next()->curve(), ARR_MAX_END); - if (rc1 == opposite(rc2)) ++num_intersections; + if (curr->direction() == ARR_LEFT_TO_RIGHT) { + Arr_parameter_space ps_y_1 = ps_y_op(curr->curve(), ARR_MAX_END); + Arr_parameter_space ps_y_2 = ps_y_op(curr->next()->curve(), ARR_MAX_END); + if ((ps_y_1 == ARR_TOP_BOUNDARY) && (ps_y_2 == ARR_TOP_BOUNDARY)) { + // Compare the x-coordinates: + Comparison_result rc1 = + cmp_x_pt_ce(p, curr->curve(), ARR_MAX_END); + Comparison_result rc2 = + cmp_x_pt_ce(p, curr->next()->curve(), ARR_MAX_END); + if (rc1 == opposite(rc2)) ++num_intersections; + } } curr = curr->next(); continue; } - + /* If the current halfedge belongs to an "antenna". Namely, its * incident face is the same as its twin's, skip it to avoid counting * it twice. @@ -286,7 +288,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const const Halfedge* opp_he = curr->opposite(); const Face* opp_curr_face = (opp_he->is_on_inner_ccb()) ? opp_he->inner_ccb()->face() : opp_he->outer_ccb()->face(); - + if (curr_face == opp_curr_face) { curr = curr->next(); continue; @@ -306,13 +308,13 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const ps_y_source = ps_y_op(curr->curve(), ind_source); ps_y_target = ps_y_op(curr->curve(), ind_target); - + if (ps_x_p != ARR_INTERIOR) { if (ps_x_source == ps_x_target) { curr = curr->next(); continue; } - + if (ps_x_target != ARR_INTERIOR) { change_pending = true; ps_x_pending = (ps_x_target == ARR_LEFT_BOUNDARY) ? @@ -342,7 +344,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const (ps_y_source == ARR_INTERIOR) ? cmp_x_op(p, curr->opposite()->vertex()->point()) : cmp_x_pt_ce(p, curr->curve(), ind_source); - + res_target = (ps_x_target == ARR_LEFT_BOUNDARY) ? LARGER : (ps_x_target == ARR_RIGHT_BOUNDARY) ? SMALLER : (ps_y_target == ARR_INTERIOR) ? @@ -439,9 +441,9 @@ are_equal(const Vertex* v, if (ps_y != v->parameter_space_in_y()) return false; if (ps_y != ARR_INTERIOR) return (ps_y == v->parameter_space_in_y()); - + if (((ps_x == ARR_INTERIOR) && (v->parameter_space_in_x() != ARR_INTERIOR)) || - ((ps_x != ARR_INTERIOR) && (v->parameter_space_in_x() == ARR_INTERIOR))) + ((ps_x != ARR_INTERIOR) && (v->parameter_space_in_x() == ARR_INTERIOR))) return false; CGAL_assertion(ps_x != ARR_INTERIOR); @@ -488,7 +490,7 @@ Arr_spherical_topology_traits_2:: let_me_decide_the_outer_ccb(std::pair< CGAL::Sign, CGAL::Sign> signs1, std::pair< CGAL::Sign, CGAL::Sign> signs2, bool& swap_predecessors) const { - + CGAL_precondition(signs1.second == CGAL::ZERO); // no perimetric in top-bottom for first loop CGAL_precondition(signs2.second == CGAL::ZERO); // no perimetric in top-bottom for second loop @@ -539,12 +541,12 @@ place_boundary_vertex(Face* /* f */, // The vertex hasn't been created yet, return a null object: return Object(); -} +} /*! \brief locate the predecessor halfedge for the given curve around a given * vertex with boundary conditions. */ template -typename Arr_spherical_topology_traits_2::Halfedge* +typename Arr_spherical_topology_traits_2::Halfedge* Arr_spherical_topology_traits_2:: locate_around_boundary_vertex(Vertex* v, const X_monotone_curve_2& xc, @@ -617,7 +619,7 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind, // we return the face that lies below the vertex v. if (it == m_boundary_vertices.end()) return CGAL::make_object(m_spherical_face); - + v = it->second; return CGAL::make_object(_face_below_vertex_on_discontinuity(v)); } @@ -652,7 +654,7 @@ erase_redundant_vertex(Vertex* v) /*! \brief obtains the curve associated with a boundary vertex */ template const typename -Arr_spherical_topology_traits_2::X_monotone_curve_2& +Arr_spherical_topology_traits_2::X_monotone_curve_2& Arr_spherical_topology_traits_2:: _curve(const Vertex* v, Arr_curve_end& ind) const { @@ -692,8 +694,8 @@ _locate_around_vertex_on_discontinuity(Vertex* v, m_traits->is_between_cw_2_object(); bool eq_curr, eq_next; - while (!is_between_cw(xc, (ind == ARR_MIN_END), curr->curve(), - (curr->direction() == ARR_RIGHT_TO_LEFT), next->curve(), + while (!is_between_cw(xc, (ind == ARR_MIN_END), curr->curve(), + (curr->direction() == ARR_RIGHT_TO_LEFT), next->curve(), (next->direction() == ARR_RIGHT_TO_LEFT), v->point(), eq_curr, eq_next)) { @@ -743,7 +745,7 @@ _locate_around_pole(Vertex* v, // pole, the result LARGER (resp. SMALLER) indicates that the line of // discontinuity is located in between the two curves. const Comparison_result cross_res = (v == m_south_pole) ? LARGER : SMALLER; - + // Traverse all other halfedges, and compare their x-positions next to the // pole with the query curve xc. typename Traits_adaptor_2::Compare_x_curve_ends_2 cmp_x_curve_ends = @@ -751,7 +753,7 @@ _locate_around_pole(Vertex* v, Arr_curve_end curr_end, next_end; Comparison_result curr_res, next_res; Comparison_result curr_next_res; - + curr_end = (curr->direction() == ARR_RIGHT_TO_LEFT) ? ARR_MIN_END : ARR_MAX_END; curr_res = cmp_x_curve_ends(xc, ind, curr->curve(), curr_end); @@ -847,7 +849,7 @@ _face_below_vertex_on_discontinuity(Vertex* v) const } while (curr != first); // The first halfedge we encounter is the lowest to the left, but if there - // is no edge to the left, we first encounter the topmost halfedge to the + // is no edge to the left, we first encounter the topmost halfedge to the // right. Note that as the halfedge we located has v as its target, we now // have to return its twin. first = From debf144985168129a8db168aad3414352e4b4d95 Mon Sep 17 00:00:00 2001 From: Eric Berberich Date: Sun, 1 Dec 2013 18:03:53 +0100 Subject: [PATCH 22/50] fixed typo --- .../Arr_unb_planar_batched_pl_helper.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h index 2cbc0180012..d060ca6c819 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Baruch Zukerman // Ron Wein @@ -91,7 +91,7 @@ public: }; //----------------------------------------------------------------------------- -// Memeber-function definitions: +// Member-function definitions: //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -103,15 +103,15 @@ void Arr_unb_planar_batched_pl_helper::before_sweep () // Initialize the fictitious halfedge lying on the top edge of the // fictitious face. We start from the leftmost halfedge, which is // incident to the top-left vertex and directed from right to left. - Vertex_const_handle v_tl = + Vertex_const_handle v_tl = Vertex_const_handle (m_top_traits->top_left_vertex()); m_top_fict = v_tl->incident_halfedges(); if (m_top_fict->direction() == ARR_LEFT_TO_RIGHT) m_top_fict = m_top_fict->next()->twin(); - + CGAL_assertion_code ( - Vertex_const_handle v_tr = + Vertex_const_handle v_tr = Vertex_const_handle (m_top_traits->top_right_vertex()); ); CGAL_assertion @@ -138,10 +138,10 @@ after_handle_event (Event* event) if (event->parameter_space_in_x() != ARR_INTERIOR) return; - + if (event->parameter_space_in_y() == ARR_TOP_BOUNDARY) m_top_fict = m_top_fict->twin()->next()->twin(); - + return; } From abd0f9c1c13ffa127747b1abbb419f84bd8f1436 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 1 Dec 2013 19:07:53 +0200 Subject: [PATCH 23/50] Added vertical decomposition for linear objects --- .../data/vertical_decomposition/linear/curves/test01.txt | 4 ++++ .../test_vertical_decomposition.linear.cmd | 1 + 2 files changed, 5 insertions(+) create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/vertical_decomposition/linear/curves/test01.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.linear.cmd diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/vertical_decomposition/linear/curves/test01.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/vertical_decomposition/linear/curves/test01.txt new file mode 100644 index 00000000000..b48c2aa93f8 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/vertical_decomposition/linear/curves/test01.txt @@ -0,0 +1,4 @@ +L 1 -1 -1 +L 1 -1 1 +L -1 1 -1 +L -1 1 1 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.linear.cmd b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.linear.cmd new file mode 100644 index 00000000000..9a8ea5a642a --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.linear.cmd @@ -0,0 +1 @@ +./data/empty.zero ./data/empty.zero ./data/vertical_decomposition/linear/curves/test01.txt From 85db6726d0f8721278b479d8b244c8e511457a93 Mon Sep 17 00:00:00 2001 From: Eric Berberich Date: Mon, 2 Dec 2013 15:41:55 +0100 Subject: [PATCH 24/50] use correct function --- .../test/Arrangement_on_surface_2/Batched_point_location_test.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h index 275f8f83335..18d16894804 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Batched_point_location_test.h @@ -210,7 +210,7 @@ verify(InputIterator begin, InputIterator end) for (InputIterator it = begin; it != end; ++it) { if (m_verbose_level > 1) - print_results(*it); + print(*it); // Perform (single) point location. Result_type obj = pl.locate(it->first); From 0404d4a755f31b12fd612bdec00767115e454ff2 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Mon, 2 Dec 2013 18:29:05 +0200 Subject: [PATCH 25/50] Enhanced batched point-location with geodesic arcs --- .../test_batched_point_location.geodesic_arcs_on_sphere.cmd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.geodesic_arcs_on_sphere.cmd b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.geodesic_arcs_on_sphere.cmd index 0f5c96e9367..f06576da490 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.geodesic_arcs_on_sphere.cmd +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_batched_point_location.geodesic_arcs_on_sphere.cmd @@ -1,2 +1,4 @@ ./data/empty.zero ./data/empty.zero ./data/batched_point_location/geodesic_arcs_on_sphere/curves/test01.txt ./data/batched_point_location/geodesic_arcs_on_sphere/queries/test01.txt ./data/empty.zero ./data/empty.zero ./data/batched_point_location/geodesic_arcs_on_sphere/curves/test02.txt ./data/batched_point_location/geodesic_arcs_on_sphere/queries/test02.txt +./data/empty.zero ./data/empty.zero ./data/batched_point_location/geodesic_arcs_on_sphere/curves/test03.txt ./data/batched_point_location/geodesic_arcs_on_sphere/queries/test03.txt +./data/empty.zero ./data/empty.zero ./data/batched_point_location/geodesic_arcs_on_sphere/curves/test04.txt ./data/batched_point_location/geodesic_arcs_on_sphere/queries/test04.txt From 7432bd96538ed90d0dc16fd5e63280779b1212cd Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Mon, 2 Dec 2013 18:34:10 +0200 Subject: [PATCH 26/50] Enhanced batched point-location with geodesic arcs --- .../geodesic_arcs_on_sphere/curves/test03.txt | 8 ++++++++ .../geodesic_arcs_on_sphere/curves/test04.txt | 8 ++++++++ .../geodesic_arcs_on_sphere/queries/test03.txt | 5 +++++ .../geodesic_arcs_on_sphere/queries/test04.txt | 3 +++ 4 files changed, 24 insertions(+) create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test03.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test04.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test03.txt create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test04.txt diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test03.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test03.txt new file mode 100644 index 00000000000..2785ac8532a --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test03.txt @@ -0,0 +1,8 @@ +-1 0 -1 0 -1 -1 0 +0 -1 -1 1 0 -1 0 +1 0 -1 0 1 -1 0 +0 1 -1 -1 0 -1 0 +-1 0 -1 0 -1 1 0 +0 -1 -1 1 0 1 0 +1 0 -1 0 1 1 0 +0 1 -1 -1 0 1 0 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test04.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test04.txt new file mode 100644 index 00000000000..2785ac8532a --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test04.txt @@ -0,0 +1,8 @@ +-1 0 -1 0 -1 -1 0 +0 -1 -1 1 0 -1 0 +1 0 -1 0 1 -1 0 +0 1 -1 -1 0 -1 0 +-1 0 -1 0 -1 1 0 +0 -1 -1 1 0 1 0 +1 0 -1 0 1 1 0 +0 1 -1 -1 0 1 0 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test03.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test03.txt new file mode 100644 index 00000000000..e7a9f31ea27 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test03.txt @@ -0,0 +1,5 @@ +1 0 -2 +1 0 -1 +1 0 -0 +1 0 1 +1 0 2 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test04.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test04.txt new file mode 100644 index 00000000000..ecdeaab1797 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/queries/test04.txt @@ -0,0 +1,3 @@ +0 -1 0 +1 0 0 +0 1 0 From 87f90d310664b1b811d019aa0a7b1bec11eff6e3 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Mon, 2 Dec 2013 18:37:35 +0200 Subject: [PATCH 27/50] pacify compiler --- .../Arrangement_on_surface_2/test_vertical_decomposition.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.cpp index da5f2eb4af1..6980ef3a456 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.cpp @@ -99,7 +99,7 @@ int main(int argc, char* argv[]) i += 2; } - if (argc < (i + 3)) { + if (static_cast(argc) < (i + 3)) { std::cout << "Usage: " << argv[0] << " point-file xcurve-file curve-file" << std::endl; @@ -109,7 +109,7 @@ int main(int argc, char* argv[]) return -1; } - for (; i < argc; i += 3) { + for (; i < static_cast(argc); i += 3) { const char* points_filename = argv[i]; const char* xcurves_filename = argv[i+1]; const char* curves_filename = argv[i+2]; From e87807bb23dd7beb2a7598289d2bacc88c32589f Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Mon, 2 Dec 2013 18:48:19 +0200 Subject: [PATCH 28/50] fixed typos --- .../geodesic_arcs_on_sphere/curves/test03.txt | 8 ++++---- .../geodesic_arcs_on_sphere/curves/test04.txt | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test03.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test03.txt index 2785ac8532a..1552a4e1d7c 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test03.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test03.txt @@ -2,7 +2,7 @@ 0 -1 -1 1 0 -1 0 1 0 -1 0 1 -1 0 0 1 -1 -1 0 -1 0 --1 0 -1 0 -1 1 0 -0 -1 -1 1 0 1 0 -1 0 -1 0 1 1 0 -0 1 -1 -1 0 1 0 +-1 0 1 0 -1 1 0 +0 -1 1 1 0 1 0 +1 0 1 0 1 1 0 +0 1 1 -1 0 1 0 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test04.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test04.txt index 2785ac8532a..e7ee3779932 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test04.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/curves/test04.txt @@ -2,7 +2,8 @@ 0 -1 -1 1 0 -1 0 1 0 -1 0 1 -1 0 0 1 -1 -1 0 -1 0 --1 0 -1 0 -1 1 0 -0 -1 -1 1 0 1 0 -1 0 -1 0 1 1 0 -0 1 -1 -1 0 1 0 +-1 0 1 0 -1 1 0 +0 -1 1 1 0 1 0 +1 0 1 0 1 1 0 +0 1 1 -1 0 1 0 +1 0 -1 1 0 1 0 From e1fbd9dbfd99b016e4017a6eae3a76e268a2f19e Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Mon, 2 Dec 2013 19:06:04 +0200 Subject: [PATCH 29/50] updated test info --- .../geodesic_arcs_on_sphere/test03.jpg | Bin 0 -> 13875 bytes .../geodesic_arcs_on_sphere/test03.wrl | 281 ++++++++++++++++++ .../geodesic_arcs_on_sphere/test04.jpg | Bin 0 -> 15041 bytes .../geodesic_arcs_on_sphere/test04.wrl | 280 +++++++++++++++++ 4 files changed, 561 insertions(+) create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test03.jpg create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test03.wrl create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test04.jpg create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test04.wrl diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test03.jpg b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test03.jpg new file mode 100644 index 0000000000000000000000000000000000000000..77060335edb6a51d0130a80c66a2ab311fe799f6 GIT binary patch literal 13875 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 literal 0 HcmV?d00001 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test04.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test04.wrl new file mode 100644 index 00000000000..c91dc0dbcc7 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test04.wrl @@ -0,0 +1,280 @@ +#VRML V2.0 utf8 +Configuration { + accumulation Accumulation { enabled TRUE } +} +ColorBackground { + color 1 1 1 1 + clearStencil TRUE +} +NavigationInfo { type [ "EXAMINE" "ANY" ] } +Viewpoint { + type "ORTHOGONAL" + fieldOfView 2.96 + # radiusScale 0.7 +} + +DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] } + +DEF DRAW_OPAQUE_KEY SingleKeySensor { key "o" } +DEF DRAW_HALOED_KEY SingleKeySensor { key "l" state TRUE } +DEF DRAW_SURFACE_KEY SingleKeySensor { key "b" state TRUE } +DEF EXPORT_KEY SingleKeySensor { key "O" } +DEF SNAP_KEY SingleKeySensor { key "S" } + +DEF VERTEX_SHAPE_KEY SingleKeySensor { + key "v" + boolean FALSE + numberOfStates 5 + intState 2 # disc +} + +DEF EDGE_SHAPE_KEY SingleKeySensor { + key "e" + boolean FALSE + numberOfStates 4 + intState 2 # strip +} + +DEF HIDE_SINGULARITIES_KEY SingleKeySensor { + boolean FALSE + key "s" +} + +DEF HIDE_DISCONTINUITY_KEY SingleKeySensor { + boolean FALSE + key "d" +} + +DEF SNAP Snapshot { + image Image { } + fileFormat "jpg" + quality 98 + sequence FALSE + dirName "." + fileName "test01" +} + +Transform { + rotation 1 0 0 -1.5708 + bboxCenter 0 0 0 + bboxSize 1.5 1.5 1.5 + children [ + Switch { + whichChoice 0 + children [ + DEF ARRANGMENT Group { + children [ + Shape { + drawDepth FALSE + appearance Appearance { + material Material { + diffuseColor 0.5 0.5 0.5 + ambientIntensity 0.7 + specularColor 0.5 0.5 0.5 + } + } + geometry Sphere { + slices 32 + stacks 32 + } + } + Shape { + appearance Appearance { + material Material { + transparency 0.0001 + } + } + geometry DEF GEOM ArrangementOnSphereMarked { + drawSurface FALSE +# drawOpaque TRUE + drawHaloed TRUE + aosEdgeStyle "strip" + aosEdgeRadius 0.03 + aosEdgeLineWidth 3 + aosVertexStyle "disc" + aosVertexRadius 0.1 + aosVertexPointSize 6 + aosIsolatedVertexStyle "disc" +# insertionStrategy "increment" + aosMarkedEdgeIndex -1 + aosMarkedVertexIndex 7 + coord DEF COORD ExactCoordinate { + ratPoint [ + -1 0 -1 + 0 -1 -1 + 1 0 -1 + 0 1 -1 + -1 0 1 + 0 -1 1 + 1 0 1 + 0 1 1 + 1 0 -1 1 0 0 1 0 1 + # + 0 -1 0 + 0 1 0 + ] + } + pointIndex [11 12] + curveIndex [0 1, 1 2, 2 3, 3 0, 4 5, 5 6, 6 7, 7 4, + 8 9, 9 10] + } + } + ] + } + ] + } + + # The singularity points: + DEF SINGULARITIES_SWITCH Switch { + whichChoice 0 + children [ + Group { + children [ + Shape { + appearance DEF BOUNDARY_APP Appearance { + material Material { + # ambientIntensity 1 + diffuseColor 0.4 0.4 0.4 + # specularColor 0.8 0.8 0.8 + # transparency 0.0001 + } + } + geometry Sphere { + center 0 0 1 + radius 0.05 + } + } + Shape { + appearance USE AXES_APP + geometry Sphere { + center 0 0 -1 + radius 0.05 + } + } + ] + } + ] + } + + # The discontinuity arc: + DEF DISCONTINUITY_SWITCH Switch { + whichChoice 0 + children [ + Shape { + appearance USE BOUNDARY_APP + geometry Extrusion { + creaseAngle 2.0 + beginCap TRUE + endCap TRUE + loop FALSE + crossSectionRadius 0.025 + spine [ + 0 0 1, + -0.0980171 0 0.995185, + -0.19509 0 0.980785, + -0.290285 0 0.95694, + -0.382683 0 0.92388, + -0.471397 0 0.881921, + -0.55557 0 0.83147, + -0.634393 0 0.77301, + -0.707107 0 0.707107, + -0.77301 0 0.634393, + -0.83147 0 0.55557, + -0.881921 0 0.471397, + -0.92388 0 0.382683, + -0.95694 0 0.290285, + -0.980785 0 0.19509, + -0.995185 0 0.0980171, + -1 0 0, + -0.995185 0 -0.0980171, + -0.980785 0 -0.19509, + -0.95694 0 -0.290285, + -0.92388 0 -0.382683, + -0.881921 0 -0.471397, + -0.83147 0 -0.55557, + -0.77301 0 -0.634393, + -0.707107 0 -0.707107, + -0.634393 0 -0.77301, + -0.55557 0 -0.83147, + -0.471397 0 -0.881921, + -0.382683 0 -0.92388, + -0.290285 0 -0.95694, + -0.19509 0 -0.980785, + -0.0980171 0 -0.995185, + 0 0 -1, + ] + } + } + ] + } + + # The axes: + DEF AXES Transform { + scale 0.1 0.1 0.1 + children [ + Shape { + appearance DEF AXES_APP Appearance { + material Material { + # ambientIntensity 1 + diffuseColor 0.4 0.4 0.4 + # specularColor 0.3 0.3 0.3 + # transparency 0.0001 + } + } + geometry Sphere { radius 0.1 } + } + DEF CS_AXIS Transform { + translation 0 1.5 0 + children [ + Shape { + appearance USE AXES_APP + geometry Cylinder { + radius 0.1 + height 3 + set_is_bottom_visible FALSE + set_is_top_visible FALSE + } + } + Transform { + translation 0 1.7 0 + children [ + Shape { + appearance USE AXES_APP + geometry Cone { + bottomRadius 0.2 + height 0.4 + } + } + ] + } + ] + } + Transform { + rotation 0 0 -1 1.57 + children [ USE CS_AXIS ] + } + Transform { + rotation 1 0 0 1.57 + children [ USE CS_AXIS ] + } + ] + } +# Transform { +# translation 2 0 0 +# children [ +# USE ARRANGMENT +# ] +# } + ] +} + +ROUTE DRAW_OPAQUE_KEY.state TO GEOM.drawOpaque +ROUTE DRAW_HALOED_KEY.state TO GEOM.drawHaloed +ROUTE SNAP_KEY.state TO SNAP.trigger +# ROUTE EXPORT_KEY.press TO GEOM.export + +ROUTE HIDE_DISCONTINUITY_KEY.intState TO DISCONTINUITY_SWITCH.whichChoice +ROUTE HIDE_SINGULARITIES_KEY.intState TO SINGULARITIES_SWITCH.whichChoice + +ROUTE VERTEX_SHAPE_KEY.intState TO GEOM.aosVertexStyleId +ROUTE EDGE_SHAPE_KEY.intState TO GEOM.aosEdgeStyleId From 4ce48af62f21d56a86106815ba0a2f3daec57f82 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Mon, 2 Dec 2013 19:06:18 +0200 Subject: [PATCH 30/50] updated test info --- .../batched_point_location/geodesic_arcs_on_sphere/test03.wrl | 2 +- .../batched_point_location/geodesic_arcs_on_sphere/test04.wrl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test03.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test03.wrl index 5057b59439c..6cab93ee73a 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test03.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test03.wrl @@ -51,7 +51,7 @@ DEF SNAP Snapshot { quality 98 sequence FALSE dirName "." - fileName "test01" + fileName "test03" } Transform { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test04.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test04.wrl index c91dc0dbcc7..1cfc96e65ce 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test04.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/batched_point_location/geodesic_arcs_on_sphere/test04.wrl @@ -51,7 +51,7 @@ DEF SNAP Snapshot { quality 98 sequence FALSE dirName "." - fileName "test01" + fileName "test04" } Transform { From b903e012245c02553bb103065e628c1cd44f92ac Mon Sep 17 00:00:00 2001 From: Eric Berberich Date: Tue, 3 Dec 2013 09:55:40 +0100 Subject: [PATCH 31/50] Compare_y_on_boundary should use compare_y and not compare_x :-) --- .../Arr_batched_point_location_traits_2.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h index e1def2056af..0fe00de52b8 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011,2013 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -636,17 +636,17 @@ public: public: Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const { - return m_base->compare_x_on_boundary_2_object()(p1.base(), p2.base()); + return m_base->compare_y_on_boundary_2_object()(p1.base(), p2.base()); } Comparison_result operator() (const Point_2 & pt, const X_monotone_curve_2& xcv, Arr_curve_end ce) const { - return m_base->compare_x_on_boundary_2_object()(pt.base(), xcv.base(), ce); + return m_base->compare_y_on_boundary_2_object()(pt.base(), xcv.base(), ce); } Comparison_result operator() (const X_monotone_curve_2& xcv1, Arr_curve_end ce1, const X_monotone_curve_2& xcv2, Arr_curve_end ce2) const { - return m_base->compare_x_on_boundary_2_object()(xcv1.base(), ce1, xcv2.base(), ce2); + return m_base->compare_y_on_boundary_2_object()(xcv1.base(), ce1, xcv2.base(), ce2); } }; From bf1bcaa5238ee552238d1df493b4140c26788619 Mon Sep 17 00:00:00 2001 From: Eric Berberich Date: Tue, 3 Dec 2013 09:56:16 +0100 Subject: [PATCH 32/50] added missing include --- .../include/CGAL/Arr_point_location_result.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h index dd108d7a6b4..f5b3b77c348 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h @@ -14,7 +14,7 @@ // // $URL: $ // $Id: $ -// +// // // Author(s) : Efi Fogel @@ -33,6 +33,7 @@ #include +#include #include #ifdef CGAL_CFG_BOOST_VARIANT_SWAP_BUG @@ -96,19 +97,19 @@ struct Arr_point_location_result { static inline Type make_result(T t) { return Type(t); } - inline + inline static boost::optional empty_optional_result() { return boost::optional(); } template const T* assign(const Type& obj) const { return boost::get(&obj); } #endif // CGAL_ARR_POINT_LOCATION_VERSION < 2 - - //this one is only to remove warnings in functions + + //this one is only to remove warnings in functions static - inline Type default_result(){ + inline Type default_result(){ CGAL_error_msg("This functions should never have been called!"); - return Type(); + return Type(); } }; From 713d9227b9aff8d16b93fc1831d80b3cc324011a Mon Sep 17 00:00:00 2001 From: Eric Berberich Date: Tue, 3 Dec 2013 09:56:41 +0100 Subject: [PATCH 33/50] need also a special handling for the right boundary mimics the behavior for the top boundary, but here we only have to deal with "ARR_MAX_END" --- .../Arr_spherical_batched_pl_helper.h | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h index f787a3195cd..85d273dc88f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011,2013 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -107,7 +107,25 @@ public: m_spherical_face = sc->last_curve().halfedge_handle()->face(); } - // TODO EBEB 2013-12-01 do the same for right boundaryx + // EBEB 2013-12-012 do similar stuff for right boundary + if (event->parameter_space_in_y() == ARR_RIGHT_BOUNDARY) { + Subcurve_iterator it, nit, it_end; + it = nit = event->left_curves_begin(); + it_end = event->left_curves_end(); + + ++nit; + if (it != it_end) { + while (nit != it_end) { + ++it; + ++nit; + } + } + const Subcurve* sc = *it; + // pick the one facing the top right corner now + CGAL_assertion(sc->last_curve().halfedge_handle()->direction() == ARR_LEFT_TO_RIGHT); + m_spherical_face = sc->last_curve().halfedge_handle()->face(); + } + return; } From e50c32655a5af431c23417ab85e5413370843baa Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Tue, 3 Dec 2013 17:27:33 +0200 Subject: [PATCH 34/50] Fixed typo in is_on_y_identification(), cleaned up --- .../CGAL/Arrangement_2/Arr_traits_adaptor_2.h | 772 ++++++------------ 1 file changed, 263 insertions(+), 509 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h index fcb1fe5e94e..fbbeae76006 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h @@ -46,11 +46,9 @@ namespace CGAL { /*! \class * A traits-class adaptor that extends the basic traits-class interface. */ -template -class Arr_traits_basic_adaptor_2 : public ArrangementBasicTraits_ -{ +template +class Arr_traits_basic_adaptor_2 : public ArrangementBasicTraits_ { public: - // Traits-class geometric types. typedef ArrangementBasicTraits_ Base; typedef Arr_traits_basic_adaptor_2 Self; @@ -73,51 +71,56 @@ public: protected: // left-right dispatch - typedef CGAL::internal::Arr_left_right_implementation_dispatch< Left_side_category, Right_side_category > LR; - typedef typename LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end_tag; - typedef typename LR::Parameter_space_in_x_2_curve_tag Psx_2_curve_tag; - typedef typename LR::Parameter_space_in_x_2_point_tag Psx_2_point_tag; - typedef typename LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve_tag; - typedef typename LR::Is_on_y_identification_2_point_tag Ioyi_2_point_tag; - typedef typename LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points_tag; - typedef typename LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends_tag; - + typedef typename LR::Parameter_space_in_x_2_curve_end_tag + Psx_2_curve_end_tag; + typedef typename LR::Parameter_space_in_x_2_curve_tag Psx_2_curve_tag; + typedef typename LR::Parameter_space_in_x_2_point_tag Psx_2_point_tag; + typedef typename LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve_tag; + typedef typename LR::Is_on_y_identification_2_point_tag Ioyi_2_point_tag; + typedef typename LR::Compare_y_on_boundary_2_points_tag + Cmp_y_ob_2_points_tag; + typedef typename LR::Compare_y_near_boundary_2_curve_ends_tag + Cmp_y_nb_2_curve_ends_tag; // bottom-top dispatch typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< Bottom_side_category, Top_side_category > BT; - typedef typename BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end_tag; - typedef typename BT::Parameter_space_in_y_2_curve_tag Psy_2_curve_tag; - typedef typename BT::Parameter_space_in_y_2_point_tag Psy_2_point_tag; - typedef typename BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve_tag; - typedef typename BT::Is_on_x_identification_2_point_tag Ioxi_2_point_tag; + typedef typename BT::Parameter_space_in_y_2_curve_end_tag + Psy_2_curve_end_tag; + typedef typename BT::Parameter_space_in_y_2_curve_tag Psy_2_curve_tag; + typedef typename BT::Parameter_space_in_y_2_point_tag Psy_2_point_tag; + typedef typename BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve_tag; + typedef typename BT::Is_on_x_identification_2_point_tag Ioxi_2_point_tag; - typedef typename BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end_tag; - typedef typename BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends_tag; - typedef typename BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends_tag; + typedef typename BT::Compare_x_at_limit_2_point_curve_end_tag + Cmp_x_al_2_point_curve_end_tag; + typedef typename BT::Compare_x_at_limit_2_curve_ends_tag + Cmp_x_al_2_curve_ends_tag; + typedef typename BT::Compare_x_near_limit_2_curve_ends_tag + Cmp_x_nl_2_curve_ends_tag; - typedef typename BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points_tag; - typedef typename BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end_tag; - typedef typename BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends_tag; - typedef typename BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends_tag; + typedef typename BT::Compare_x_on_boundary_2_points_tag + Cmp_x_ob_2_points_tag; + typedef typename BT::Compare_x_on_boundary_2_point_curve_end_tag + Cmp_x_ob_2_point_curve_end_tag; + typedef typename BT::Compare_x_on_boundary_2_curve_ends_tag + Cmp_x_ob_2_curve_ends_tag; + typedef typename BT::Compare_x_near_boundary_2_curve_ends_tag + Cmp_x_nb_2_curve_ends_tag; public: /// \name Construction. //@{ /*! Default constructor. */ - Arr_traits_basic_adaptor_2() : - Base() - {} + Arr_traits_basic_adaptor_2() : Base() {} /*! Constructor from a base-traits class. */ - Arr_traits_basic_adaptor_2(const Base& traits) : - Base(traits) - {} + Arr_traits_basic_adaptor_2(const Base& traits) : Base(traits) {} //@} // Inherited functors: @@ -149,8 +152,8 @@ public: * EQUAL in case of an overlap to the left of q. */ Comparison_result operator()(const X_monotone_curve_2& xcv1, - const X_monotone_curve_2& xcv2, - const Point_2& p) const + const X_monotone_curve_2& xcv2, + const Point_2& p) const { // The function is implemented based on the Has_left category. If the // category indicates that the "left" version is available, it calls the @@ -190,10 +193,11 @@ public: /*! * Implementation of the operator() in case the HasLeft tag is false. */ - Comparison_result _compare_y_at_x_left_imp(const X_monotone_curve_2& xcv1, - const X_monotone_curve_2& xcv2, - const Point_2& CGAL_assertion_code(p), - Tag_false) const + Comparison_result + _compare_y_at_x_left_imp(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, + const Point_2& CGAL_assertion_code(p), + Tag_false) const { Parameter_space_in_x_2 ps_x = m_self->parameter_space_in_x_2_object(); Parameter_space_in_y_2 ps_y = m_self->parameter_space_in_y_2_object(); @@ -233,15 +237,13 @@ public: // If one of the curves is vertical, it is below the other one. Is_vertical_2 is_vertical = m_self->is_vertical_2_object(); - if (is_vertical(xcv1)) - return (is_vertical(xcv2)) ? EQUAL : SMALLER; - else if (is_vertical(xcv2)) - return (LARGER); + if (is_vertical(xcv1)) return (is_vertical(xcv2)) ? EQUAL : SMALLER; + else if (is_vertical(xcv2)) return (LARGER); // Perform the comparison based on the existance of bounded left // endpoints. if (has_left1 && has_left2) { - // Get the left endpoints of xcv1 and xcv2. + // Obtain the left endpoints of xcv1 and xcv2. Point_2 left1 = min_vertex(xcv1); Point_2 left2 = min_vertex(xcv2); @@ -260,9 +262,7 @@ public: /*! Obtain a Compare_y_at_x_left_2 function object. */ Compare_y_at_x_left_2 compare_y_at_x_left_2_object() const - { - return Compare_y_at_x_left_2(this); - } + { return Compare_y_at_x_left_2(this); } /*! A functor that determines whether two x-monotone curves intersect. */ @@ -325,16 +325,11 @@ public: }; /*! Obtain a Compare_y_at_x_left_2 function object. */ - Do_intersect_2 do_intersect_2_object() const - { - return Do_intersect_2(this); - } + Do_intersect_2 do_intersect_2_object() const { return Do_intersect_2(this); } //@} - - /// \name Overriden functors for boundaries. //@{ @@ -347,7 +342,7 @@ public: public: /*! - * Get the location of the given curve end in x. + * Obtain the location of the given curve end in x. * \param xcv The curve. * \param ind ARR_MIN_END if we refer to xcv's minimal end, * ARR_MAX_END if we refer to its maximal end. @@ -363,7 +358,7 @@ public: } /*! - * Get the location of the given curve end in x. + * Obtain the location of the given curve end in x. * \param xcv The curve. * \return The location of the curve end in x direction. */ @@ -376,7 +371,7 @@ public: } /*! - * Get the location of the given point end in x. + * Obtain the location of the given point end in x. * \param p The point. * \return The location of the point end in x direction. */ @@ -391,7 +386,7 @@ public: protected: //! The base traits. - const Base * m_base; + const Base* m_base; /*! Constructor. * \param base The base traits class. It must be passed, to handle non @@ -409,57 +404,45 @@ public: * Implementation of the operator() in case the base should be used. */ Arr_parameter_space parameter_space_in_x(const X_monotone_curve_2& xcv, - Arr_curve_end ind, - Arr_use_traits_tag) const - { - return (m_base->parameter_space_in_x_2_object()(xcv, ind)); - } + Arr_curve_end ind, + Arr_use_traits_tag) const + { return (m_base->parameter_space_in_x_2_object()(xcv, ind)); } /*! * Implementation of the operator() in case the dummy should be used. */ Arr_parameter_space parameter_space_in_x(const X_monotone_curve_2&, - Arr_curve_end, - Arr_use_dummy_tag) const - { - return ARR_INTERIOR; - } + Arr_curve_end, + Arr_use_dummy_tag) const + { return ARR_INTERIOR; } /*! * Implementation of the operator() in case the base should be used. */ Arr_parameter_space parameter_space_in_x(const X_monotone_curve_2& xcv, Arr_use_traits_tag) const - { - return (m_base->parameter_space_in_x_2_object()(xcv)); - } + { return (m_base->parameter_space_in_x_2_object()(xcv)); } /*! * Implementation of the operator() in case the dummy should be used. */ Arr_parameter_space parameter_space_in_x(const X_monotone_curve_2&, Arr_use_dummy_tag) const - { - return ARR_INTERIOR; - } + { return ARR_INTERIOR; } /*! * Implementation of the operator() in case the base should be used. */ Arr_parameter_space parameter_space_in_x(const Point_2& p, Arr_use_traits_tag) const - { - return m_base->parameter_space_in_x_2_object()(p); - } + { return m_base->parameter_space_in_x_2_object()(p); } /*! * Implementation of the operator() in case the dummy should be used. */ Arr_parameter_space parameter_space_in_x(const Point_2&, Arr_use_dummy_tag) const - { - return ARR_INTERIOR; - } + { return ARR_INTERIOR; } }; /*! Obtain an Parameter_space_in_x_2 function object. */ @@ -495,9 +478,7 @@ public: * false otherwise. */ bool operator()(const Point_2& p) const - { - return is_on_y_idn(p, Ioyi_2_point_tag()); - } + { return is_on_y_idn(p, Ioyi_2_point_tag()); } /*! Determones whether an x-monotone curve coicide with the vertical * identification curve @@ -506,15 +487,11 @@ public: * and false otherwise. */ bool operator()(const X_monotone_curve_2& xcv) const - { - return is_on_y_idn(xcv, Ioyi_2_curve_tag()); - } + { return is_on_y_idn(xcv, Ioyi_2_curve_tag()); } private: bool is_on_y_idn(const Point_2& p, Arr_use_traits_tag) const - { - return m_base->is_on_identification_2_object()(p); - } + { return m_base->is_on_y_identification_2_object()(p); } bool is_on_y_idn(const Point_2&, Arr_use_dummy_tag) const { @@ -523,9 +500,7 @@ public: } bool is_on_y_idn(const X_monotone_curve_2& xcv, Arr_use_traits_tag) const - { - return m_base->is_on_y_identification_2_object()(xcv); - } + { return m_base->is_on_y_identification_2_object()(xcv); } bool is_on_y_idn(const X_monotone_curve_2&, Arr_use_dummy_tag) const { @@ -567,9 +542,7 @@ public: const X_monotone_curve_2& xcv2, Arr_curve_end ce, Arr_use_traits_tag) const - { - return m_base->compare_y_near_boundary_2_object()(xcv1, xcv2, ce); - } + { return m_base->compare_y_near_boundary_2_object()(xcv1, xcv2, ce); } /*! * Implementation of the operator() in case the dummy should be used. @@ -606,9 +579,7 @@ public: /*! Obtain a Compare_y_near_boundary_2 functor. */ Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const - { - return Compare_y_near_boundary_2(this); - } + { return Compare_y_near_boundary_2(this); } /*! A function object that compares the y-coordinate of two given points * that lie on vertical boundaries. @@ -635,9 +606,7 @@ public: */ Comparison_result comp_y_on_bnd(const Point_2& p1, const Point_2& p2, Arr_use_traits_tag) const - { - return m_base->compare_y_on_boundary_2_object()(p1, p2); - } + { return m_base->compare_y_on_boundary_2_object()(p1, p2); } /*! * Implementation of the operator() in case the dummy should be used. @@ -669,9 +638,7 @@ public: /*! Obtain a Compare_y_on_boundary_2 function object. */ Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const - { - return Compare_y_on_boundary_2(this); - } + { return Compare_y_on_boundary_2(this); } // bottom-top @@ -681,7 +648,7 @@ public: class Parameter_space_in_y_2 { public: /*! - * Get the location of the given curve end in y. + * Obtain the location of the given curve end in y. * \param xcv The curve. * \param ind ARR_MIN_END if we refer to xcv's minimal end, * ARR_MAX_END if we refer to its maximal end. @@ -697,7 +664,7 @@ public: } /*! - * Get the location of the given curve end in y. + * Obtain the location of the given curve end in y. * \param xcv The curve. * \return The location of the curve end in y direction. */ @@ -710,14 +677,12 @@ public: } /*! - * Get the location of the given point end in y. + * Obtain the location of the given point end in y. * \param p The point. * \return The location of the point end in y direction. */ Arr_parameter_space operator()(const Point_2& p) const - { - return parameter_space_in_y(p, Psy_2_point_tag()); - } + { return parameter_space_in_y(p, Psy_2_point_tag()); } protected: //! The base traits. @@ -741,9 +706,7 @@ public: Arr_parameter_space parameter_space_in_y(const X_monotone_curve_2& xcv, Arr_curve_end ind, Arr_use_traits_tag) const - { - return m_base->parameter_space_in_y_2_object()(xcv, ind); - } + { return m_base->parameter_space_in_y_2_object()(xcv, ind); } /*! * Implementation of the operator() in case the dummy should be used. @@ -751,52 +714,40 @@ public: Arr_parameter_space parameter_space_in_y(const X_monotone_curve_2&, Arr_curve_end, Arr_use_dummy_tag) const - { - return ARR_INTERIOR; - } + { return ARR_INTERIOR; } /*! * Implementation of the operator() in case the base should be used. */ Arr_parameter_space parameter_space_in_y(const X_monotone_curve_2& xcv, Arr_use_traits_tag) const - { - return (m_base->parameter_space_in_x_2_object()(xcv)); - } + { return (m_base->parameter_space_in_x_2_object()(xcv)); } /*! * Implementation of the operator() in case the dummy should be used. */ Arr_parameter_space parameter_space_in_y(const X_monotone_curve_2&, Arr_use_dummy_tag) const - { - return ARR_INTERIOR; - } + { return ARR_INTERIOR; } /*! * Implementation of the operator() in case the base should be used. */ Arr_parameter_space parameter_space_in_y(const Point_2& p, Arr_use_traits_tag) const - { - return m_base->parameter_space_in_y_2_object()(p); - } + { return m_base->parameter_space_in_y_2_object()(p); } /*! * Implementation of the operator() in case the dummy should be used. */ Arr_parameter_space parameter_space_in_y(const Point_2&, Arr_use_dummy_tag) const - { - return ARR_INTERIOR; - } + { return ARR_INTERIOR; } }; /*! Obtain an Parameter_space_in_y_2 function object. */ Parameter_space_in_y_2 parameter_space_in_y_2_object() const - { - return Parameter_space_in_y_2(this); - } + { return Parameter_space_in_y_2(this); } /*! A function object that determines whether an x-monotone curve or a * point coincide with the horizontal identification curve. @@ -825,9 +776,7 @@ public: * false otherwise. */ bool operator()(const Point_2& p) const - { - return is_on_idn(p, Ioxi_2_point_tag()); - } + { return is_on_idn(p, Ioxi_2_point_tag()); } /*! Determones whether an x-monotone curve coicide with the horizontal * identification curve @@ -836,15 +785,11 @@ public: * and false otherwise. */ bool operator()(const X_monotone_curve_2& xcv) const - { - return is_on_x_idn(xcv, Ioxi_2_curve_tag()); - } + { return is_on_x_idn(xcv, Ioxi_2_curve_tag()); } private: bool is_on_x_idn(const Point_2& p, Arr_use_traits_tag) const - { - return m_base->is_on_x_identification_2_object()(p); - } + { return m_base->is_on_x_identification_2_object()(p); } bool is_on_x_idn(const Point_2&, Arr_use_dummy_tag) const { @@ -853,9 +798,7 @@ public: } bool is_on_x_idn(const X_monotone_curve_2& xcv, Arr_use_traits_tag) const - { - return m_base->is_on_x_identification_2_object()(xcv); - } + { return m_base->is_on_x_identification_2_object()(xcv); } bool is_on_x_idn(const X_monotone_curve_2&, Arr_use_dummy_tag) const { @@ -866,9 +809,7 @@ public: /*! Obtain a Is_on_x_identification_2 function object. */ Is_on_x_identification_2 is_on_x_identification_2_object() const - { - return Is_on_x_identification_2(this); - } + { return Is_on_x_identification_2(this); } /*! A functor that compares the x-limits of curve ends near the * boundary of the parameter space @@ -897,9 +838,7 @@ public: const X_monotone_curve_2& xcv, Arr_curve_end ce, Arr_use_traits_tag) const - { - return (m_base->compare_x_at_limit_2_object()(p, xcv, ce)); - } + { return (m_base->compare_x_at_limit_2_object()(p, xcv, ce)); } /*! * Implementation of the operator() in case the dummy should be used. @@ -921,9 +860,7 @@ public: const X_monotone_curve_2& xcv2, Arr_curve_end ce2, Arr_use_traits_tag) const - { - return m_base->compare_x_at_limit_2_object()(xcv1, ce1, xcv2, ce2); - } + { return m_base->compare_x_at_limit_2_object()(xcv1, ce1, xcv2, ce2); } /*! * Implementation of the operator() in case the dummy should be used. @@ -980,9 +917,7 @@ public: /*! Obtain a Compare_x_at_limit_2 function object. */ Compare_x_at_limit_2 compare_x_at_limit_2_object() const - { - return Compare_x_at_limit_2(this); - } + { return Compare_x_at_limit_2(this); } /*! A functor that compares the x-coordinates of curve ends near the * boundary of the parameter space @@ -1011,9 +946,7 @@ public: const X_monotone_curve_2& xcv2, Arr_curve_end ce, Arr_use_traits_tag) const - { - return m_base->compare_x_near_limit_2_object()(xcv1, xcv2, ce); - } + { return m_base->compare_x_near_limit_2_object()(xcv1, xcv2, ce); } /*! * Implementation of the operator() in case the dummy should be used. @@ -1028,7 +961,6 @@ public: } public: - /*! Compare the relative x-positions of two curve ends. * \param xcv1 The first curve. * \param xcv2 The second curve. @@ -1042,16 +974,12 @@ public: Comparison_result operator()(const X_monotone_curve_2& xcv1, const X_monotone_curve_2& xcv2, Arr_curve_end ce) const - { - return _compare_curves(xcv1, xcv2, ce, Cmp_x_nl_2_curve_ends_tag()); - } + { return _compare_curves(xcv1, xcv2, ce, Cmp_x_nl_2_curve_ends_tag()); } }; /*! Obtain a Compare_x_near_limit_2 function object. */ Compare_x_near_limit_2 compare_x_near_limit_2_object() const - { - return Compare_x_near_limit_2(this); - } + { return Compare_x_near_limit_2(this); } /*! A function object that compares the x-coordinate of two given points * that lie on horizontal boundaries. @@ -1080,9 +1008,7 @@ public: * \param p2 the second point. */ Comparison_result operator()(const Point_2& p1, const Point_2& p2) const - { - return comp_x_on_bnd(p1, p2, Cmp_x_ob_2_points_tag()); - } + { return comp_x_on_bnd(p1, p2, Cmp_x_ob_2_points_tag()); } /*! Compare the x-coordinate of a point and a curve-end projected onto the * horizontal boundaries @@ -1093,9 +1019,7 @@ public: Comparison_result operator()(const Point_2& pt, const X_monotone_curve_2& xcv, Arr_curve_end ce) const - { - return comp_x_on_bnd(pt, xcv, ce, Cmp_x_ob_2_point_curve_end_tag()); - } + { return comp_x_on_bnd(pt, xcv, ce, Cmp_x_ob_2_point_curve_end_tag()); } /*! Compare the x-coordinates of two curve-ends projected onto the horizontal * boundaries @@ -1108,16 +1032,12 @@ public: Arr_curve_end ce1, const X_monotone_curve_2& xcv2, Arr_curve_end ce2) const - { - return comp_x_on_bnd(xcv1, ce1, xcv2, ce2, Cmp_x_ob_2_curve_ends_tag()); - } + { return comp_x_on_bnd(xcv1, ce1, xcv2, ce2, Cmp_x_ob_2_curve_ends_tag()); } private: Comparison_result comp_x_on_bnd(const Point_2& p1, const Point_2& p2, Arr_use_traits_tag) const - { - return m_base->compare_x_on_boundary_2_object()(p1, p2); - } + { return m_base->compare_x_on_boundary_2_object()(p1, p2); } Comparison_result comp_x_on_bnd(const Point_2&, const Point_2&, Arr_use_dummy_tag) const @@ -1130,9 +1050,7 @@ public: const X_monotone_curve_2& xcv, Arr_curve_end ce, Arr_use_traits_tag) const - { - return m_base->compare_x_on_boundary_2_object()(pt, xcv, ce); - } + { return m_base->compare_x_on_boundary_2_object()(pt, xcv, ce); } Comparison_result comp_x_on_bnd(const Point_2&, const X_monotone_curve_2& /* xcv */, @@ -1149,9 +1067,7 @@ public: const X_monotone_curve_2& xcv2, Arr_curve_end ce2, Arr_use_traits_tag) const - { - return m_base->compare_x_on_boundary_2_object()(xcv1, ce1, xcv2, ce2); - } + { return m_base->compare_x_on_boundary_2_object()(xcv1, ce1, xcv2, ce2); } Comparison_result comp_x_on_bnd(const X_monotone_curve_2& /* xcv1 */, Arr_curve_end /* ce1 */, @@ -1162,14 +1078,11 @@ public: CGAL_error(); return SMALLER; } - }; /*! Obtain a Compare_x_on_boundary_2 function object. */ Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const - { - return Compare_x_on_boundary_2(this); - } + { return Compare_x_on_boundary_2(this); } /*! A functor that compares the x-coordinates of curve ends near the * boundary of the parameter space @@ -1198,9 +1111,7 @@ public: const X_monotone_curve_2& xcv2, Arr_curve_end ce, Arr_use_traits_tag) const - { - return m_base->compare_x_near_boundary_2_object()(xcv1, xcv2, ce); - } + { return m_base->compare_x_near_boundary_2_object()(xcv1, xcv2, ce); } /*! * Implementation of the operator() in case the dummy should be used. @@ -1229,16 +1140,12 @@ public: Comparison_result operator()(const X_monotone_curve_2& xcv1, const X_monotone_curve_2& xcv2, Arr_curve_end ce) const - { - return _compare_curves(xcv1, xcv2, ce, Cmp_x_nb_2_curve_ends_tag()); - } + { return _compare_curves(xcv1, xcv2, ce, Cmp_x_nb_2_curve_ends_tag()); } }; /*! Obtain a Compare_x_near_boundary_2 function object. */ Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const - { - return Compare_x_near_boundary_2(this); - } + { return Compare_x_near_boundary_2(this); } // special non-public comparison functors @@ -1265,7 +1172,6 @@ public: friend class Arr_traits_basic_adaptor_2; protected: - // for open Comparison_result _compare_curve_ends(const X_monotone_curve_2& xcv1, const X_monotone_curve_2& xcv2, @@ -1274,7 +1180,6 @@ public: { Comparison_result res = m_self->compare_y_near_boundary_2_object()(xcv1, xcv2, ce); - return res; } @@ -1289,12 +1194,10 @@ public: m_self->construct_vertex_at_curve_end_2_object()(xcv1, ce), m_self->construct_vertex_at_curve_end_2_object()(xcv2, ce) ); - return res; } public: - /*! Compare the relative y-positions of two curve ends. * \param xcv1 The first curve. * \param ind1 ARR_MIN_END if we refer to xcv1's minimal end; @@ -1324,28 +1227,23 @@ public: CGAL_assertion(ps1 == ps2); switch (ps1) { + case ARR_LEFT_BOUNDARY: + return _compare_curve_ends(xcv1, xcv2, ce, Left_side_category()); - case ARR_LEFT_BOUNDARY: - return _compare_curve_ends(xcv1, xcv2, ce, Left_side_category()); - - case ARR_RIGHT_BOUNDARY: + case ARR_RIGHT_BOUNDARY: return _compare_curve_ends(xcv1, xcv2, ce, Right_side_category()); - case ARR_INTERIOR: - // fall-through - default: + case ARR_INTERIOR: // fall-through + default: CGAL_error(); // never reached return CGAL::EQUAL; } - } }; /*! Obtain a Compare_y_curve_ends_2 function object. */ Compare_y_curve_ends_2 compare_y_curve_ends_2_object() const - { - return Compare_y_curve_ends_2(this); - } + { return Compare_y_curve_ends_2(this); } /*! A functor that compares the x-coordinates of curve ends near the * boundary of the parameter space @@ -1368,7 +1266,6 @@ public: friend class Arr_traits_basic_adaptor_2; protected: - // for open Comparison_result _compare_point_curve_end(const Point_2& pt, const X_monotone_curve_2& xcv, @@ -1377,19 +1274,14 @@ public: { Comparison_result res = m_self->compare_x_at_limit_2_object()(pt, xcv, ce); - - if (res != EQUAL || m_self->is_vertical_2_object()(xcv)) { - return res; - } + if ((res != EQUAL) || m_self->is_vertical_2_object()(xcv)) return res; // look at the side from which the // vertical asymptote is approached - res = (ce == CGAL::ARR_MIN_END ? CGAL::SMALLER : CGAL::LARGER); - + res = ((ce == CGAL::ARR_MIN_END) ? CGAL::SMALLER : CGAL::LARGER); return res; } - // for contraction Comparison_result _compare_point_curve_end(const Point_2& pt, const X_monotone_curve_2& xcv, @@ -1398,15 +1290,11 @@ public: { Comparison_result res = m_self->compare_x_on_boundary_2_object()(pt, xcv, ce); - - if (res != EQUAL || m_self->is_vertical_2_object()(xcv)) { - return res; - } + if ((res != EQUAL) || m_self->is_vertical_2_object()(xcv)) return res; // look at the side from which the // vertical asymptote is approached - res = (ce == CGAL::ARR_MIN_END ? CGAL::SMALLER : CGAL::LARGER); - + res = ((ce == CGAL::ARR_MIN_END) ? CGAL::SMALLER : CGAL::LARGER); return res; } @@ -1419,13 +1307,10 @@ public: Comparison_result res = m_self->compare_x_on_boundary_2_object() (pt, m_self->construct_vertex_at_curve_end_2_object()(xcv, ce)); - return res; } - public: - /*! Compare the relative x-positions of a point and a curve end. * \param pt The point * \param xcv The curve. @@ -1463,9 +1348,7 @@ public: /*! Obtain a Compare_x_point_curve_end_2 function object. */ Compare_x_point_curve_end_2 compare_x_point_curve_end_2_object() const - { - return Compare_x_point_curve_end_2(this); - } + { return Compare_x_point_curve_end_2(this); } /*! A functor that compares the x-coordinates of curve ends near the * boundary of the parameter space @@ -1487,14 +1370,12 @@ public: //! Allow its functor obtaining function calling the private constructor. friend class Arr_traits_basic_adaptor_2; - protected: - Comparison_result _compare_curve_ends_same_x(const X_monotone_curve_2& xcv1, Arr_curve_end ce1, const X_monotone_curve_2& xcv2, - Arr_curve_end ce2) const { - + Arr_curve_end ce2) const + { CGAL::Comparison_result res = CGAL::EQUAL; CGAL::Arr_parameter_space loc1 = @@ -1507,7 +1388,7 @@ public: // now we are in the open case: ARR_MIN_END > vertical > ARR_MAX_END if (vert1) { if (!vert2) { - res = (ce2 == CGAL::ARR_MIN_END ? CGAL::SMALLER : CGAL::LARGER); + res = ((ce2 == CGAL::ARR_MIN_END) ? CGAL::SMALLER : CGAL::LARGER); return res; } // both are vertical @@ -1516,12 +1397,12 @@ public: return res; } res = (loc1 == CGAL::ARR_BOTTOM_BOUNDARY ? - CGAL::SMALLER : CGAL::LARGER); + CGAL::SMALLER : CGAL::LARGER); return res; } if (vert2) { - res = (ce1 == CGAL::ARR_MIN_END ? CGAL::LARGER : CGAL::SMALLER); + res = ((ce1 == CGAL::ARR_MIN_END) ? CGAL::LARGER : CGAL::SMALLER); return res; } @@ -1537,11 +1418,10 @@ public: } // curve ends approach vertical asymptote (or singularity) from // different sides => no comparisons required - res = (ce1 == CGAL::ARR_MIN_END ? CGAL::LARGER : CGAL::SMALLER); + res = ((ce1 == CGAL::ARR_MIN_END) ? CGAL::LARGER : CGAL::SMALLER); return res; } - // for open Comparison_result _compare_curve_ends(const X_monotone_curve_2& xcv1, Arr_curve_end ce1, @@ -1551,11 +1431,7 @@ public: Comparison_result res = m_self->compare_x_at_limit_2_object()(xcv1, ce1, xcv2, ce2); - - if (res == EQUAL) { - res = _compare_curve_ends_same_x(xcv1, ce1, xcv2, ce2); - } - + if (res == EQUAL) res = _compare_curve_ends_same_x(xcv1, ce1, xcv2, ce2); return res; } @@ -1568,11 +1444,7 @@ public: Comparison_result res = m_self->compare_x_on_boundary_2_object()(xcv1, ce1, xcv2, ce2); - - if (res == EQUAL) { - res = _compare_curve_ends_same_x(xcv1, ce1, xcv2, ce2); - } - + if (res == EQUAL) res = _compare_curve_ends_same_x(xcv1, ce1, xcv2, ce2); return res; } @@ -1581,19 +1453,16 @@ public: Arr_curve_end ce1, const X_monotone_curve_2& xcv2, Arr_curve_end ce2, - Arr_oblivious_side_tag) const { - + Arr_oblivious_side_tag) const + { Comparison_result res = - m_self->compare_x_on_boundary_2_object()( - m_self->construct_vertex_at_curve_end_2_object()(xcv1, ce1), - m_self->construct_vertex_at_curve_end_2_object()(xcv2, ce2) - ); - + m_self->compare_x_on_boundary_2_object() + (m_self->construct_vertex_at_curve_end_2_object()(xcv1, ce1), + m_self->construct_vertex_at_curve_end_2_object()(xcv2, ce2)); return res; } public: - /*! Compare the relative x-positions of two curve ends. * \param xcv1 The first curve. * \param ind1 ARR_MIN_END if we refer to xcv1's minimal end; @@ -1615,36 +1484,31 @@ public: bool second_open = !m_self->is_closed_2_object()(xcv2, ce2); if (first_open) { - if (second_open) { + if (second_open) return _compare_curve_ends(xcv1, ce1, xcv2, ce2, // both sides are open, so pick one Bottom_side_category()); - } else { - return CGAL::opposite - (m_self->compare_x_point_curve_end_2_object() - (m_self->construct_vertex_at_curve_end_2_object()(xcv2, ce2), - xcv1, ce1)); - } - } else { - if (second_open) { - return m_self->compare_x_point_curve_end_2_object() - (m_self->construct_vertex_at_curve_end_2_object()(xcv1, ce1), - xcv2, ce2); - } else { - return _compare_curve_ends(xcv1, ce1, xcv2, ce2, - // both sides are non-open, so pick one - Bottom_side_category()); - } + return CGAL::opposite + (m_self->compare_x_point_curve_end_2_object() + (m_self->construct_vertex_at_curve_end_2_object()(xcv2, ce2), + xcv1, ce1)); } + + if (second_open) + return m_self->compare_x_point_curve_end_2_object() + (m_self->construct_vertex_at_curve_end_2_object()(xcv1, ce1), + xcv2, ce2); + + return _compare_curve_ends(xcv1, ce1, xcv2, ce2, + // both sides are non-open, so pick one + Bottom_side_category()); } }; /*! Obtain a Compare_x_curve_ends_2 function object. */ Compare_x_curve_ends_2 compare_x_curve_ends_2_object() const - { - return Compare_x_curve_ends_2(this); - } + { return Compare_x_curve_ends_2(this); } class Construct_vertex_at_curve_end_2 { protected: @@ -1666,20 +1530,15 @@ public: public: Point_2 operator()(const X_monotone_curve_2& xcv, Arr_curve_end ce) const { - if (ce == ARR_MIN_END) { - return m_self->construct_min_vertex_2_object()(xcv); - } - // else - return m_self->construct_max_vertex_2_object()(xcv); - + return (ce == ARR_MIN_END) ? + m_self->construct_min_vertex_2_object()(xcv) : + m_self->construct_max_vertex_2_object()(xcv); } }; /*! Obtain a Construct_vertex_at_curve_end_2 function object. */ Construct_vertex_at_curve_end_2 construct_vertex_at_curve_end_2_object() const - { - return Construct_vertex_at_curve_end_2(this); - } + { return Construct_vertex_at_curve_end_2(this); } /*! A function object that determines whether a curve end is closed. */ class Is_closed_2 { @@ -1699,44 +1558,24 @@ public: //! Allow its functor obtaining function calling the private constructor. friend class Arr_traits_basic_adaptor_2; - inline - bool _is_closed(Arr_oblivious_side_tag) const - { - return true; - } + inline bool _is_closed(Arr_oblivious_side_tag) const { return true; } - inline - bool _is_closed(Arr_open_side_tag) const - { - return false; - } + inline bool _is_closed(Arr_open_side_tag) const { return false; } inline bool _is_closed(const X_monotone_curve_2& xcv, Arr_curve_end ce) const { Arr_parameter_space ps = m_self->parameter_space_in_x_2_object()(xcv, ce); - if (ARR_INTERIOR == ps) { + if (ARR_INTERIOR == ps) ps = m_self->parameter_space_in_y_2_object()(xcv, ce); - } switch (ps) { - - case ARR_LEFT_BOUNDARY: - return _is_closed(Left_side_category()); - - case ARR_BOTTOM_BOUNDARY: - return _is_closed(Bottom_side_category()); - - case ARR_TOP_BOUNDARY: - return _is_closed(Top_side_category()); - - case ARR_RIGHT_BOUNDARY: - return _is_closed(Right_side_category()); - - case ARR_INTERIOR: - // fall-through - default: - return true; + case ARR_LEFT_BOUNDARY: return _is_closed(Left_side_category()); + case ARR_BOTTOM_BOUNDARY: return _is_closed(Bottom_side_category()); + case ARR_TOP_BOUNDARY: return _is_closed(Top_side_category()); + case ARR_RIGHT_BOUNDARY: return _is_closed(Right_side_category()); + case ARR_INTERIOR: // fall-through + default: return true; } } @@ -1747,16 +1586,12 @@ public: * \return true is the curve end is bounded, and false otherwise */ bool operator()(const X_monotone_curve_2& xcv, Arr_curve_end ce) const - { - return _is_closed(xcv, ce); - } + { return _is_closed(xcv, ce); } }; /*! Obtain a Is_closed_2 function object. */ Is_closed_2 is_closed_2_object() const - { - return Is_closed_2(this); - } + { return Is_closed_2(this); } //@} @@ -1782,36 +1617,30 @@ public: // Compare p to the position of the left end of the curve. // Note that if the left end of xcv lies at x boundary, p is obviously to // its right. - Arr_parameter_space bx, by; - Comparison_result res; - - bx = ps_x(xcv, ARR_MIN_END); - + Arr_parameter_space bx = ps_x(xcv, ARR_MIN_END); if (bx == ARR_INTERIOR) { - by = ps_y(xcv, ARR_MIN_END); + Arr_parameter_space by = ps_y(xcv, ARR_MIN_END); - res = (by == ARR_INTERIOR) ? + Comparison_result res = (by == ARR_INTERIOR) ? // The left endpoint of xcv is a normal point. compare_x(p, m_self->construct_min_vertex_2_object()(xcv)) : // The left end of xcv lies at y boundary. compare_x_point_curve_end(p, xcv, ARR_MIN_END); - if (res == SMALLER) - return (false); // p is to the left of the x-range. - else if (res == EQUAL) - return (true); + // If p is to the left of the x-range return false. + // If p is equal, return true. + if (res == SMALLER) return false; + else if (res == EQUAL) return true; } // If necessary, compare p to the right end of the curve. // Note that if this end lies at x boundary, p is obviously to its left. bx = ps_x(xcv, ARR_MAX_END); + if (bx != ARR_INTERIOR) return true; - if (bx != ARR_INTERIOR) - return(true); + Arr_parameter_space by = ps_y(xcv, ARR_MAX_END); - by = ps_y(xcv, ARR_MAX_END); - - res = (by == ARR_INTERIOR) ? + Comparison_result res = (by == ARR_INTERIOR) ? // The right endpoint of xcv is a normal point. compare_x(p, m_self->construct_max_vertex_2_object()(xcv)) : // The right end of xcv lies at y boundary: @@ -1856,8 +1685,7 @@ public: if (ps_x1 != ARR_INTERIOR) { // If both curves are defined at x boundary, they obviously overlap in // their x-ranges. - if (ps_x2 != ARR_INTERIOR) - return (true); + if (ps_x2 != ARR_INTERIOR) return true; // As xcv2 is not defined at x boundary, take its left end as the // rightmost of the two left curve ends. @@ -1882,9 +1710,9 @@ public: compare_x_point_curve_end(min_vertex(xcv1), xcv2, ARR_MIN_END); } else { - res = (ps_y2 == ARR_INTERIOR) ? + res = (ps_y2 == ARR_INTERIOR) ? opposite(compare_x_point_curve_end(min_vertex(xcv2), xcv1, - ARR_MIN_END)): + ARR_MIN_END)): compare_x_curve_ends(xcv1, ARR_MIN_END, xcv2, ARR_MIN_END); } @@ -1909,8 +1737,7 @@ public: if (ps_x1 != ARR_INTERIOR) { // If both curves are defined at x boundary, they obviously overlap in // their x-ranges. - if (ps_x2 != ARR_INTERIOR) - return (true); + if (ps_x2 != ARR_INTERIOR) return true; // As xcv2 is not defined at x boundary, take its right end as the // leftmost of the two right curve ends. @@ -1990,14 +1817,12 @@ public: /*! Obtain an Is_in_x_range_2 function object. */ Is_in_x_range_2 is_in_x_range_2_object() const - { - return Is_in_x_range_2(this); - } + { return Is_in_x_range_2(this); } class Compare_y_position_2 { public: /*! - * Get the relative of two x-monotone curves with overlapping x-ranges + * Obtain the relative of two x-monotone curves with overlapping x-ranges * that are disjoint in their interiors. * \param xcv1 The first x-monotone curve. * \param xcv2 The second x-monotone curve. @@ -2042,64 +1867,59 @@ public: const Arr_parameter_space ps_x2 = ps_x(xcv2, ARR_MIN_END); Comparison_result res; - CGAL_assertion(ps_x1 != ARR_RIGHT_BOUNDARY && - ps_x2 != ARR_RIGHT_BOUNDARY); + CGAL_assertion((ps_x1 != ARR_RIGHT_BOUNDARY) && + (ps_x2 != ARR_RIGHT_BOUNDARY)); - if (ps_x1 != ARR_INTERIOR) - { + if (ps_x1 != ARR_INTERIOR) { if (ps_x2 != ARR_INTERIOR) - { // Compare the relative position of the curves at x boundary. return (compare_y_near_bnd(xcv1, xcv2, ARR_MIN_END)); - } // Check if the left end of xcv2 lies at y boundary. const Arr_parameter_space ps_y2 = ps_y(xcv2, ARR_MIN_END); - if (ps_y2 == ARR_BOTTOM_BOUNDARY) - return (LARGER); // xcv2 is obviously below xcv1. - else if (ps_y2 == ARR_TOP_BOUNDARY) - return (SMALLER); // xcv2 is obviously above xcv1. + // if xcv2 is below xcv1, return LARGER. + // if xcv2 is above xcv1, return SMALLER. + if (ps_y2 == ARR_BOTTOM_BOUNDARY) return (LARGER); + else if (ps_y2 == ARR_TOP_BOUNDARY) return (SMALLER); // Compare the position of the left end of xcv2 (which is a normal // point) to xcv1. res = compare_y_at_x(min_vertex(xcv2), xcv1); // Swap the result. - if (res == EQUAL) - return (EQUAL); - + if (res == EQUAL) return (EQUAL); return ((res == SMALLER) ? LARGER : SMALLER); } - else if (ps_x2 != ARR_INTERIOR) { + + if (ps_x2 != ARR_INTERIOR) { // Check if the left end of xcv1 lies at y boundary. const Arr_parameter_space ps_y1 = ps_y(xcv1, ARR_MIN_END); - if (ps_y1 == ARR_BOTTOM_BOUNDARY) - return (SMALLER); // xcv1 is obviously below xcv2. - else if (ps_y1 == ARR_TOP_BOUNDARY) - return (LARGER); // xcv1 is obviously above xcv2. + // If xcv1 is below xcv2 return SMALLER. + // If xcv1 is above xcv2 return LARGER. + if (ps_y1 == ARR_BOTTOM_BOUNDARY) return (SMALLER); + else if (ps_y1 == ARR_TOP_BOUNDARY) return (LARGER); // Compare the position of the left end of xcv1 (which is a normal // point) to xcv2. res = compare_y_at_x(min_vertex(xcv1), xcv2); - return (res); } // Check if the left curve end lies at y = +/- oo. const Arr_parameter_space ps_y1 = ps_y(xcv1, ARR_MIN_END); const Arr_parameter_space ps_y2 = ps_y(xcv2, ARR_MIN_END); - Comparison_result l_res; + Comparison_result l_res; if (ps_y1 != ARR_INTERIOR) { if (ps_y2 != ARR_INTERIOR) { // The curve ends have special boundary with oposite signs in y, // we readily know their relative position (recall that they do not // instersect). - if (ps_y1 == ARR_BOTTOM_BOUNDARY && ps_y2 == ARR_TOP_BOUNDARY) + if ((ps_y1 == ARR_BOTTOM_BOUNDARY) && (ps_y2 == ARR_TOP_BOUNDARY)) return (SMALLER); - else if (ps_y1 == ARR_TOP_BOUNDARY && ps_y2 == ARR_BOTTOM_BOUNDARY) + else if ((ps_y1 == ARR_TOP_BOUNDARY) && (ps_y2 == ARR_BOTTOM_BOUNDARY)) return (LARGER); // Both curves have vertical asymptotes with the same sign in y. @@ -2108,44 +1928,35 @@ public: l_res = compare_x_curve_ends(xcv1, ARR_MIN_END, xcv2, ARR_MIN_END); CGAL_assertion(l_res != EQUAL); - if (ps_y1 == ARR_TOP_BOUNDARY) - return (l_res); - else - return ((l_res == SMALLER) ? LARGER : SMALLER); + if (ps_y1 == ARR_TOP_BOUNDARY) return (l_res); + else return ((l_res == SMALLER) ? LARGER : SMALLER); } // xcv1 has a vertical asymptote and xcv2 has a normal left endpoint. // Compare the x-positions of this endpoint and the asymptote. - const Point_2& left2 = min_vertex(xcv2); + const Point_2& left2 = min_vertex(xcv2); l_res = compare_x_point_curve_end(left2, xcv1, ARR_MIN_END); - if (l_res == LARGER) { // left2 lies in the x-range of xcv1, so it is safe to compare: res = compare_y_at_x(left2, xcv1); // Swap the result. - if (res == EQUAL) - return (EQUAL); - + if (res == EQUAL) return (EQUAL); return ((res == SMALLER) ? LARGER : SMALLER); } - else { - return ((ps_y1 == ARR_BOTTOM_BOUNDARY) ? SMALLER : LARGER); - } + return ((ps_y1 == ARR_BOTTOM_BOUNDARY) ? SMALLER : LARGER); } - else if (ps_y2 != ARR_INTERIOR) { + + if (ps_y2 != ARR_INTERIOR) { // xcv2 has a vertical asymptote and xcv1 has a normal left endpoint. // Compare the x-positions of this endpoint and the asymptote. - const Point_2& left1 = min_vertex(xcv1); + const Point_2& left1 = min_vertex(xcv1); l_res = compare_x_point_curve_end(left1, xcv2, ARR_MIN_END); - - if (l_res == LARGER) - // left1 lies in the x-range of xcv2, so it is safe to compare: - return (compare_y_at_x(left1, xcv2)); - else - return (ps_y2 == ARR_BOTTOM_BOUNDARY) ? LARGER : SMALLER; + // left1 lies in the x-range of xcv2, so it is safe to compare: + if (l_res == LARGER) return (compare_y_at_x(left1, xcv2)); + else return (ps_y2 == ARR_BOTTOM_BOUNDARY) ? LARGER : SMALLER; } // In this case we compare two normal points. @@ -2153,9 +1964,9 @@ public: Compare_y_at_x_right_2 compare_y_at_x_right = m_self->compare_y_at_x_right_2_object(); - // Get the left endpoints of xcv1 and xcv2. - const Point_2& left1 = min_vertex(xcv1); - const Point_2& left2 = min_vertex(xcv2); + // Obtain the left endpoints of xcv1 and xcv2. + const Point_2& left1 = min_vertex(xcv1); + const Point_2& left2 = min_vertex(xcv2); // Locate the rightmost point of left1 and left2 and compare its position // to the other curve. @@ -2164,30 +1975,23 @@ public: if (l_res != SMALLER) { // left1 is in the x-range of xcv2: res = compare_y_at_x(left1, xcv2); - - if (res == EQUAL) { + if (res == EQUAL) // The two curves intersect at left1. If both curves are defined to // the right of the reference point, we can compare them to its // right. Otherwise, their share a common endpoint (which is the only // overlap in their x-ranges) and are really equal. - if (l_res == EQUAL) - res = compare_y_at_x_right(xcv1, xcv2, left1); - } - + if (l_res == EQUAL) res = compare_y_at_x_right(xcv1, xcv2, left1); return (res); } - else { - // left2 is in the x-range of xcv1: - res = compare_y_at_x(left2, xcv1); + // left2 is in the x-range of xcv1: + res = compare_y_at_x(left2, xcv1); - if (res == EQUAL) - // The two curves share a common endpoint (which is the only overlap - // in their x-ranges) and are really equal. - return (EQUAL); + // The two curves share a common endpoint (which is the only overlap + // in their x-ranges) and are really equal. + if (res == EQUAL) return (EQUAL); - // Swap the result: - return ((res == SMALLER) ? LARGER : SMALLER); - } + // Swap the result: + return ((res == SMALLER) ? LARGER : SMALLER); } protected: @@ -2209,9 +2013,7 @@ public: /*! Obtain a Compare_y_position_2 function object. */ Compare_y_position_2 compare_y_position_2_object() const - { - return Compare_y_position_2(this); - } + { return Compare_y_position_2(this); } class Is_between_cw_2 { public: @@ -2264,44 +2066,36 @@ public: if (!xcv_to_right) { res1 = compare_y_at_x_left(xcv1, xcv, p); res2 = compare_y_at_x_left(xcv2, xcv, p); - - if (res1 == EQUAL) - xcv_equal_xcv1 = true; - if (res2 == EQUAL) - xcv_equal_xcv2 = true; - + if (res1 == EQUAL) xcv_equal_xcv1 = true; + if (res2 == EQUAL) xcv_equal_xcv2 = true; return (res1 == SMALLER || res2 == LARGER); } - return (true); + return true; } - else if (l_res == SMALLER) { + + if (l_res == SMALLER) { // Case 1(b): xcv1 is below xcv2. if (!xcv_to_right) { res1 = compare_y_at_x_left(xcv1, xcv, p); res2 = compare_y_at_x_left(xcv2, xcv, p); - - if (res1 == EQUAL) - xcv_equal_xcv1 = true; - if (res2 == EQUAL) - xcv_equal_xcv2 = true; - + if (res1 == EQUAL) xcv_equal_xcv1 = true; + if (res2 == EQUAL) xcv_equal_xcv2 = true; return (res1 == SMALLER && res2 == LARGER); } - return (false); + return false; } - else { - // Overlapping segments. - if (!xcv_to_right) { - res1 = compare_y_at_x_left(xcv1, xcv, p); - if (res1 == EQUAL) { - xcv_equal_xcv1 = true; - xcv_equal_xcv2 = true; - return (false); - } - return (true); + + // Overlapping segments. + if (!xcv_to_right) { + res1 = compare_y_at_x_left(xcv1, xcv, p); + if (res1 == EQUAL) { + xcv_equal_xcv1 = true; + xcv_equal_xcv2 = true; + return false; } - return (true); + return true; } + return true; } if (xcv1_to_right && xcv2_to_right) { @@ -2313,65 +2107,49 @@ public: if (xcv_to_right) { res1 = compare_y_at_x_right(xcv1, xcv, p); res2 = compare_y_at_x_right(xcv2, xcv, p); - - if (res1 == EQUAL) - xcv_equal_xcv1 = true; - if (res2 == EQUAL) - xcv_equal_xcv2 = true; - + if (res1 == EQUAL) xcv_equal_xcv1 = true; + if (res2 == EQUAL) xcv_equal_xcv2 = true; return (res1 == LARGER && res2 == SMALLER); } - return (false); + return false; } - else if (r_res == SMALLER) { + + if (r_res == SMALLER) { // Case 2(b): xcv1 is below xcv2. if (xcv_to_right) { res1 = compare_y_at_x_right(xcv1, xcv, p); res2 = compare_y_at_x_right(xcv2, xcv, p); - - if (res1 == EQUAL) - xcv_equal_xcv1 = true; - if (res2 == EQUAL) - xcv_equal_xcv2 = true; - - return (res1 == LARGER || res2 == SMALLER); + if (res1 == EQUAL) xcv_equal_xcv1 = true; + if (res2 == EQUAL) xcv_equal_xcv2 = true; + return ((res1 == LARGER) || (res2 == SMALLER)); } - return (true); + return true; } - else { - // Overlapping segments. - if (xcv_to_right) { - res1 = compare_y_at_x_right(xcv1, xcv, p); - if (res1 == EQUAL) { - xcv_equal_xcv1 = true; - xcv_equal_xcv2 = true; - return (false); - } - return (true); + // Overlapping segments. + if (xcv_to_right) { + res1 = compare_y_at_x_right(xcv1, xcv, p); + if (res1 == EQUAL) { + xcv_equal_xcv1 = true; + xcv_equal_xcv2 = true; + return false; } - return (true); + return true; } + return true; } if (!xcv1_to_right && xcv2_to_right) { // Case 3: xcv1 is defined to the left of p, and xcv2 to its right. if (!xcv_to_right) { res1 = compare_y_at_x_left(xcv1, xcv, p); - - if (res1 == EQUAL) - xcv_equal_xcv1 = true; - + if (res1 == EQUAL) xcv_equal_xcv1 = true; return (res1 == SMALLER); } - else { - res2 = compare_y_at_x_right(xcv2, xcv, p); - if (res2 == EQUAL) - xcv_equal_xcv2 = true; - - return (res2 == SMALLER); - } + res2 = compare_y_at_x_right(xcv2, xcv, p); + if (res2 == EQUAL) xcv_equal_xcv2 = true; + return (res2 == SMALLER); } CGAL_assertion(xcv1_to_right && !xcv2_to_right); @@ -2379,20 +2157,13 @@ public: // Case 4: xcv1 is defined to the right of p, and xcv2 to its left. if (xcv_to_right) { res1 = compare_y_at_x_right(xcv1, xcv, p); - - if (res1 == EQUAL) - xcv_equal_xcv1 = true; - + if (res1 == EQUAL) xcv_equal_xcv1 = true; return (res1 == LARGER); } - else { - res2 = compare_y_at_x_left(xcv2, xcv, p); - if (res2 == EQUAL) - xcv_equal_xcv2 = true; - - return (res2 == LARGER); - } + res2 = compare_y_at_x_left(xcv2, xcv, p); + if (res2 == EQUAL) xcv_equal_xcv2 = true; + return (res2 == LARGER); } protected: @@ -2414,9 +2185,7 @@ public: /*! Obtain an Is_between_cw_2 function object. */ Is_between_cw_2 is_between_cw_2_object() const - { - return Is_between_cw_2(this); - } + { return Is_between_cw_2(this); } class Compare_cw_around_point_2 { public: @@ -2485,9 +2254,7 @@ public: /*! Obtain a Compare_cw_around_point_2 function object. */ Compare_cw_around_point_2 compare_cw_around_point_2_object() const - { - return Compare_cw_around_point_2(this); - } + { return Compare_cw_around_point_2(this); } //@} }; @@ -2521,14 +2288,10 @@ public: /// \name Construction. //@{ /*! Default constructor. */ - Arr_traits_adaptor_2() : - Base() - {} + Arr_traits_adaptor_2() : Base() {} /*! Constructor from a base-traits class. */ - Arr_traits_adaptor_2(const Base_traits_2& traits) : - Base(traits) - {} + Arr_traits_adaptor_2(const Base_traits_2& traits) : Base(traits) {} //@} // Inherited functors: @@ -2588,9 +2351,7 @@ public: */ bool _are_mergeable_imp(const X_monotone_curve_2& xcv1, const X_monotone_curve_2& xcv2, Tag_true) const - { - return (m_base->are_mergeable_2_object()(xcv1, xcv2)); - } + { return (m_base->are_mergeable_2_object()(xcv1, xcv2)); } /*! * Implementation of the operator() in case the Has_merge tag is false. @@ -2605,9 +2366,7 @@ public: /*! Obtain an Are_mergeable_2 function object. */ Are_mergeable_2 are_mergeable_2_object() const - { - return Are_mergeable_2(this); - } + { return Are_mergeable_2(this); } /*! A functor that merges two x-monotone curves into one. */ class Merge_2 { @@ -2650,9 +2409,7 @@ public: void _merge_imp(const X_monotone_curve_2& xcv1, const X_monotone_curve_2& xcv2, X_monotone_curve_2& c, Tag_true) const - { - return (m_base->merge_2_object()(xcv1, xcv2, c)); - } + { return (m_base->merge_2_object()(xcv1, xcv2, c)); } /*! * Implementation of the operator() in case the HasMerge tag is false. @@ -2667,10 +2424,7 @@ public: }; /*! Obtain a Merge_2 function object. */ - Merge_2 merge_2_object() const - { - return Merge_2(this); - } + Merge_2 merge_2_object() const { return Merge_2(this); } //@} }; From 640d68e0cce8725708f030443918b8080936bd9a Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Tue, 3 Dec 2013 17:28:20 +0200 Subject: [PATCH 35/50] Fixed typo and added test of vertical decomposition for linear objects --- .../test/Arrangement_on_surface_2/cgal_test_base | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base index 6d41d689afa..6234a912794 100755 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base @@ -933,7 +933,7 @@ test_batched_point_location_spherical_arcs() { local nt=$CGAL_GMPQ_NT; local kernel=$CARTESIAN_KERNEL; - local geom_traits=$LINEAR_GEOM_TRAITS; + local geom_traits=$GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS; local topol_traits=$SPHERICAL_TOPOL_TRAITS; local flags="-DTEST_NT=$nt -DTEST_KERNEL=$kernel -DTEST_GEOM_TRAITS=$geom_traits -DTEST_TOPOL_TRAITS=$topol_traits"; compile_and_run_with_flags test_batched_point_location geodesic_arcs_on_sphere "$flags" @@ -1504,7 +1504,7 @@ test_batched_point_location_linear test_batched_point_location_spherical_arcs test_vertical_decomposition_segments -# test_vertical_decomposition_linear +test_vertical_decomposition_linear # test_vertical_decomposition_spherical_arcs compile_and_run test_dual From 4402598ddcbb85e2d9ab04eb31290f179148c9a6 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Tue, 3 Dec 2013 17:29:24 +0200 Subject: [PATCH 36/50] Fixed is_in_face() for the case that the point is on the identification curve. Cleaned up --- .../Arr_spherical_topology_traits_2_impl.h | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h index b904f7d6757..fd7500faa3f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h @@ -64,24 +64,19 @@ assign(const Self& other) m_dcel.assign(other.m_dcel); // Take care of the traits object. - if (m_own_traits && m_traits != NULL) - delete m_traits; + if (m_own_traits && m_traits != NULL) delete m_traits; - if (other.m_own_traits) - { + if (other.m_own_traits) { m_traits = new Traits_adaptor_2; m_own_traits = true; } - else - { + else { m_traits = other.m_traits; m_own_traits = false; } // Update the rest of the properties. dcel_updated(); - - return; } /*! \brief initializes an empty DCEL structure. */ @@ -118,8 +113,7 @@ void Arr_spherical_topology_traits_2::dcel_updated() m_spherical_face = NULL; for (fit = this->m_dcel.faces_begin(); fit != this->m_dcel.faces_end(); ++fit) { - if (fit->number_of_outer_ccbs() == 0) - { + if (fit->number_of_outer_ccbs() == 0) { CGAL_assertion(m_spherical_face == NULL); m_spherical_face = &(*fit); @@ -155,8 +149,8 @@ bool Arr_spherical_topology_traits_2:: is_in_face(const Face* f, const Point_2& p, const Vertex* v) const { // std::cout << "is_in_face()" << std::endl; - CGAL_precondition(v == NULL || !v->has_null_point()); - CGAL_precondition(v == NULL || m_traits->equal_2_object()(p, v->point())); + CGAL_precondition((v == NULL) || !v->has_null_point()); + CGAL_precondition((v == NULL) || m_traits->equal_2_object()(p, v->point())); /* There is always one face that contains everything else. It has no * outer CCB's. When a new face is constructed, we make sure that the @@ -192,6 +186,9 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const typename Traits_adaptor_2::Compare_x_point_curve_end_2 cmp_x_pt_ce = m_traits->compare_x_point_curve_end_2_object(); + // Process the input point. + bool p_is_interior_x = !(m_traits->is_on_y_identification_2_object()(p)); + /* Maintain a counter of the number of x-monotone curves that intersect an * upward vertical ray emanating from p. Handle degenerate cases as * explained below). @@ -245,9 +242,6 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const ps_x_source, ps_x_target = ARR_INTERIOR, ps_y_source, ps_y_target; - Arr_parameter_space ps_x_p = ARR_INTERIOR; - if (v != NULL) ps_x_p = v->parameter_space_in_x(); - do { /* Compare p to the target vertex of the current halfedge. If the * vertex v is on the boundary of the component, p is not in the interior @@ -257,8 +251,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const // Ignore vertical curves: bool is_vertical = m_traits->is_vertical_2_object()(curr->curve()); - if (is_vertical) - { + if (is_vertical) { /* If this outer ccb chain contains the north pole, and our point * lies horizontaly between the two vertical curves that meet at * the north pole, increase the intersection counter @@ -309,7 +302,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const ps_y_source = ps_y_op(curr->curve(), ind_source); ps_y_target = ps_y_op(curr->curve(), ind_target); - if (ps_x_p != ARR_INTERIOR) { + if (!p_is_interior_x) { if (ps_x_source == ps_x_target) { curr = curr->next(); continue; @@ -342,14 +335,14 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const res_source = (ps_x_source == ARR_LEFT_BOUNDARY) ? LARGER : (ps_x_source == ARR_RIGHT_BOUNDARY) ? SMALLER : (ps_y_source == ARR_INTERIOR) ? - cmp_x_op(p, curr->opposite()->vertex()->point()) : - cmp_x_pt_ce(p, curr->curve(), ind_source); + cmp_x_op(p, curr->opposite()->vertex()->point()) : + cmp_x_pt_ce(p, curr->curve(), ind_source); res_target = (ps_x_target == ARR_LEFT_BOUNDARY) ? LARGER : (ps_x_target == ARR_RIGHT_BOUNDARY) ? SMALLER : (ps_y_target == ARR_INTERIOR) ? - cmp_x_op(p, curr->vertex()->point()) : - cmp_x_pt_ce(p, curr->curve(), ind_target); + cmp_x_op(p, curr->vertex()->point()) : + cmp_x_pt_ce(p, curr->curve(), ind_target); /* If a vertical ray is shot from p upward, the x-monotone curve * associated with curr is hit once. @@ -385,7 +378,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const } while (curr != first); if (last_pending) { - if (ps_x_p != ARR_INTERIOR) { + if (!p_is_interior_x) { if (ps_x_last == ps_x_target) { Comparison_result res_y_at_x = cmp_y_at_x_op(p, curr->curve()); if (res_y_at_x == EQUAL) return false; From 3b1cb84dd7b69f33927fa2dc2022d9d7634f8774 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Thu, 5 Dec 2013 17:50:21 +0200 Subject: [PATCH 37/50] commented out unused var. --- .../examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp index 6619a78bfc5..745291d9177 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp @@ -15,7 +15,7 @@ #include "arr_print.h" -// A property map that reads/writes the information to/from the extended +// A property map that reads/writes the information to/from the extended // face. template class Extended_face_property_map { public: @@ -28,11 +28,12 @@ public: typedef Face_handle key_type; // The get function is required by the property map concept. - friend reference get(const Extended_face_property_map& map, key_type key) + friend reference get(const Extended_face_property_map& /* map */, + key_type key) { return key->data(); } // The put function is required by the property map concept. - friend void put(Extended_face_property_map, + friend void put(Extended_face_property_map /* map */, key_type key, value_type val) { key->set_data(val); } }; From 57b5b4ef24d5e73e3a31681ea50dff096a859871 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Thu, 5 Dec 2013 17:50:55 +0200 Subject: [PATCH 38/50] Included Arr_triangulation_point_location.h --- Arrangement_on_surface_2/dont_submit | 1 - 1 file changed, 1 deletion(-) diff --git a/Arrangement_on_surface_2/dont_submit b/Arrangement_on_surface_2/dont_submit index fe3f975ccd9..21f3d862591 100644 --- a/Arrangement_on_surface_2/dont_submit +++ b/Arrangement_on_surface_2/dont_submit @@ -10,4 +10,3 @@ include/CGAL/Arr_extended_rational_arc_traits_d_1.h include/CGAL/Arr_hyperbolic_arc_traits_2.h include/CGAL/Arr_polycurve_traits_2.h include/CGAL/Arr_rational_arc_traits_2.h -include/CGAL/Arr_triangulation_point_location.h \ No newline at end of file From c3207ea105a7138135d37b24fc485a34af06c635 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Fri, 6 Dec 2013 01:25:15 +0200 Subject: [PATCH 39/50] pacify compiler --- .../Arrangement_on_surface_2/test_vertical_decomposition.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.cpp index 6980ef3a456..da447b2b993 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_vertical_decomposition.cpp @@ -99,7 +99,7 @@ int main(int argc, char* argv[]) i += 2; } - if (static_cast(argc) < (i + 3)) { + if (argc < static_cast(i + 3)) { std::cout << "Usage: " << argv[0] << " point-file xcurve-file curve-file" << std::endl; @@ -109,7 +109,7 @@ int main(int argc, char* argv[]) return -1; } - for (; i < static_cast(argc); i += 3) { + for (; static_cast(i) < argc; i += 3) { const char* points_filename = argv[i]; const char* xcurves_filename = argv[i+1]; const char* curves_filename = argv[i+2]; From bb018b8fbeddb4a1911950c13ad631ab7f384082 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Fri, 6 Dec 2013 01:25:55 +0200 Subject: [PATCH 40/50] Added is_on_y_identification functor --- .../include/CGAL/Arr_polyline_traits_2.h | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h index c690f63cfbd..1a04d7df16f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h @@ -2683,6 +2683,50 @@ namespace CGAL { Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const { return Compare_y_near_boundary_2(*this); } + /*! A functor that indicates whether a geometric object lies on the + * vertical identification arc. + */ + class Is_on_y_identification_2 { + protected: + typedef Arr_polyline_traits_2 Polyline_traits_2; + /*! The polyline traits (in case it has state) */ + const Polyline_traits_2& m_poly_traits; + + public: + /*! Constructor. */ + Is_on_y_identification_2(const Polyline_traits_2& traits) : + m_poly_traits(traits) + {} + + /*! Determine whether a point lies in the vertical boundary. + * \param p the point. + * \return a Boolean indicating whether p lies in the vertical boundary. + */ + bool operator()(const Point_2& p) const + { + const Segment_traits_2* seg_traits = m_poly_traits.segment_traits_2(); + return seg_traits->is_on_y_identification_2_object()(p); + } + + /*! Determine whether an x-monotone curve lies in the vertical boundary. + * \param xcv the x-monotone curve. + * \return a Boolean indicating whether xcv lies in the vertical boundary. + */ + bool operator()(const X_monotone_curve_2& xcv) const + { + const Segment_traits_2* seg_traits = m_poly_traits.segment_traits_2(); + typename X_monotone_curve_2::Segment_const_iterator it; + for (it = xcv.begin_segments(); it != xcv.end_segments(); ++it) + if (! seg_traits->is_on_y_identification_2_object()(*it)) + return false; + return true; + } + }; + + /*! Obtain a Is_on_y_identification_2 function object */ + Is_on_y_identification_2 is_on_y_identification_2_object() const + { return Is_on_y_identification_2(*this); } + private: /* * Roadmap: locate() should return an iterator to the located segment From c745b67e4b415b48e6c758487c8c6d0055fe8ec4 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Fri, 6 Dec 2013 01:26:54 +0200 Subject: [PATCH 41/50] cleaned up --- .../Arr_bounded_planar_topology_traits_2.h | 62 ++-- .../CGAL/Arr_spherical_topology_traits_2.h | 173 ++++++------ ...rr_bounded_planar_topology_traits_2_impl.h | 41 ++- .../Arr_planar_topology_traits_base_2.h | 178 ++++++------ .../Arr_spherical_topology_traits_2_impl.h | 184 ++++++------ .../Arr_unb_planar_topology_traits_2_impl.h | 265 ++++++++---------- .../CGAL/Arr_unb_planar_topology_traits_2.h | 120 ++++---- 7 files changed, 479 insertions(+), 544 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h index ec195074bbc..74293d56df2 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h @@ -39,24 +39,22 @@ namespace CGAL { // Forward declaration: -template +template class Arrangement_on_surface_2; /*! \class Arr_bounded_planar_topology_traits_2 * A topology-traits class that encapsulates the embedding of 2D arrangements * of bounded curves on the plane. */ -template > +template > class Arr_bounded_planar_topology_traits_2 : public Arr_planar_topology_traits_base_2 { private: - typedef Arr_planar_topology_traits_base_2 Base; public: - ///! \name The geometry-traits types. //@{ typedef GeomTraits_ Geometry_traits_2; @@ -114,7 +112,7 @@ protected: Face* unb_face; // The unbounded face. // Copy constructor and assignment operator - not supported. - Arr_bounded_planar_topology_traits_2 (const Self&); + Arr_bounded_planar_topology_traits_2(const Self&); Self& operator=(const Self&); public: @@ -123,7 +121,7 @@ public: //@{ /*! Default constructor. */ - Arr_bounded_planar_topology_traits_2 () : + Arr_bounded_planar_topology_traits_2() : Base(), unb_face(NULL) {} @@ -142,7 +140,7 @@ public: //@{ /*! Determine whether the DCEL reprsenets an empty structure. */ - bool is_empty_dcel () const + bool is_empty_dcel() const { // An empty bounded arrangement has no edges or vertices. return (this->m_dcel.size_of_vertices() == 0 && @@ -198,9 +196,8 @@ private: // Type definition for the constuction sweep-line visitor. typedef Arr_construction_subcurve CSubcurve; - typedef Arr_construction_event CEvent; + typedef Arr_construction_event + CEvent; typedef Arr_bounded_planar_construction_helper BInsTraits; typedef Arr_construction_subcurve BISubcurve; - typedef Arr_construction_event BIEvent; - typedef Arr_bounded_planar_insertion_helper + BIEvent; + typedef Arr_bounded_planar_insertion_helper BIHelper; // Type definition for the insertion sweep-line visitor. typedef Arr_insertion_traits_2 InsTraits; typedef Arr_construction_subcurve ISubcurve; - typedef Arr_construction_event IEvent; - typedef Arr_bounded_planar_insertion_helper + IEvent; + typedef Arr_bounded_planar_insertion_helper IHelper; // Type definition for the batched point-location sweep-line visitor. @@ -260,8 +251,7 @@ private: typedef typename Base::Subcurve Subcurve; typedef typename Base::Construction_helper Construction_helper; - _Overlay_helper (const ArrangementA_* arr_a, - const ArrangementB_* arr_b) : + _Overlay_helper(const ArrangementA_* arr_a, const ArrangementB_* arr_b) : Base(arr_a, arr_b) {} }; @@ -394,18 +384,18 @@ public: const X_monotone_curve_2& cv, Arr_curve_end ind, Arr_parameter_space ps_x, Arr_parameter_space ps_y) const { - CGAL_assertion ((ps_x == ARR_INTERIOR) && (ps_y == ARR_INTERIOR)); + CGAL_assertion((ps_x == ARR_INTERIOR) && (ps_y == ARR_INTERIOR)); if (ind == ARR_MIN_END) { // Compare v with the left endpoint of cv. - return (this->traits->equal_2_object() - (this->traits->construct_min_vertex_2_object() (cv), + return (this->m_geom_traits->equal_2_object() + (this->m_geom_traits->construct_min_vertex_2_object()(cv), v->point())); } else { // Compare v with the right endpoint of cv. - return (this->traits->equal_2_object() - (this->traits->construct_max_vertex_2_object() (cv), + return (this->m_geom_traits->equal_2_object() + (this->m_geom_traits->construct_max_vertex_2_object()(cv), v->point())); } } @@ -565,9 +555,8 @@ public: * \param v The vertex. * \return The result of the comparison of the x-coordinates of p and v. */ - virtual Comparison_result compare_x(const Point_2& p, - const Vertex* v) const - { return (this->traits->compare_x_2_object()(p, v->point())); } + virtual Comparison_result compare_x(const Point_2& p, const Vertex* v) const + { return (this->m_geom_traits->compare_x_2_object()(p, v->point())); } /*! * Compare the given vertex and the given point. @@ -575,9 +564,8 @@ public: * \param v The vertex. * \return The result of the xy-lexicographic comparison of p and v. */ - virtual Comparison_result compare_xy(const Point_2& p, - const Vertex* v) const - { return (this->traits->compare_xy_2_object()(p, v->point())); } + virtual Comparison_result compare_xy(const Point_2& p, const Vertex* v) const + { return (this->m_geom_traits->compare_xy_2_object()(p, v->point())); } /*! * Compare the relative y-position of the given point and the given edge @@ -589,7 +577,7 @@ public: */ virtual Comparison_result compare_y_at_x(const Point_2& p, const Halfedge* he) const - { return (this->traits->compare_y_at_x_2_object()(p, he->curve())); } + { return (this->m_geom_traits->compare_y_at_x_2_object()(p, he->curve())); } //@} }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h index 961117fbabf..29a7debc37a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h @@ -57,26 +57,26 @@ namespace CGAL { // Forward declaration: -template +template class Arrangement_on_surface_2; /*! This class handles the topology for arrangements of great spherical * arcs on the sphere embedded on 2D parametric surdace. */ -template > +template > class Arr_spherical_topology_traits_2 { public: ///! \name The geometry-traits types. //@{ - typedef GeomTraits Geometry_traits_2; + typedef GeomTraits_ Geometry_traits_2; typedef typename Geometry_traits_2::Point_2 Point_2; typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2; //@} ///! \name The DCEL types. //@{ - typedef T_Dcel Dcel; + typedef Dcel_ Dcel; typedef typename Dcel::Size Size; typedef typename Dcel::Vertex Vertex; typedef typename Dcel::Halfedge Halfedge; @@ -129,32 +129,34 @@ public: * An auxiliary structure for rebinding the topology traits with a new * geometry-traits class and a new DCEL class. */ - template - struct rebind - { - typedef Arr_spherical_topology_traits_2 other; + template + struct rebind { + typedef Arr_spherical_topology_traits_2 other; }; private: - //! A container of boundary vertices. struct Vertex_key_comparer { /*! Construct default */ - Vertex_key_comparer() : m_traits(NULL) {} + Vertex_key_comparer() : m_geom_traits(NULL) {} /*! Construct */ - Vertex_key_comparer(const Traits_adaptor_2* traits) : m_traits(traits) {} - const Traits_adaptor_2* m_traits; + Vertex_key_comparer(const Traits_adaptor_2* geom_traits) : + m_geom_traits(geom_traits) + {} + + const Traits_adaptor_2* m_geom_traits; + bool operator()(const Point_2& p1, const Point_2& p2) const { - return (m_traits->compare_y_on_boundary_2_object()(p1, p2) == + return (m_geom_traits->compare_y_on_boundary_2_object()(p1, p2) == SMALLER); } }; //! \todo define the key to be 'const Point_2*'. - typedef std::map Vertex_map; - typedef std::pair Vertex_value; + typedef std::map Vertex_map; + typedef std::pair Vertex_value; protected: // Data members: @@ -174,14 +176,14 @@ protected: Vertex_map m_boundary_vertices; //! The geometry-traits adaptor. - const Traits_adaptor_2* m_traits; + const Traits_adaptor_2* m_geom_traits; - // Inidicates whether the traits object should evetually be freed. - bool m_own_traits; + //! Inidicates whether the traits object should evetually be freed. + bool m_own_geom_traits; // Copy constructor and assignment operator - not supported. - Arr_spherical_topology_traits_2(const Self &); - Self& operator=(const Self &); + Arr_spherical_topology_traits_2(const Self&); + Self& operator=(const Self&); public: ///! \name Construction methods. @@ -288,18 +290,16 @@ public: const Vertex* north_pole() const { return m_north_pole; } /*! Obtain the north pole (non-const version). */ - Vertex* north_pole() - { return m_north_pole; } + Vertex* north_pole() { return m_north_pole; } /*! Obtain a vertex on the line of discontinuity that corresponds to * the given curve-end (or return NULL if no such vertex exists). */ Vertex* discontinuity_vertex(const X_monotone_curve_2 xc, Arr_curve_end ind) { - Point_2 key; - key = (ind == ARR_MIN_END) ? - m_traits->construct_min_vertex_2_object()(xc) : - m_traits->construct_max_vertex_2_object()(xc); + Point_2 key = (ind == ARR_MIN_END) ? + m_geom_traits->construct_min_vertex_2_object()(xc) : + m_geom_traits->construct_max_vertex_2_object()(xc); typename Vertex_map::iterator it = m_boundary_vertices.find(key); return (it != m_boundary_vertices.end()) ? it->second : NULL; } @@ -308,27 +308,27 @@ public: private: /// \name Auxiliary type definitions. //@{ - typedef Arrangement_on_surface_2 Arr; + typedef Arrangement_on_surface_2 Arr; // Type definition for the constuction sweep-line visitor. typedef Arr_construction_subcurve CSubcurve; - typedef Arr_construction_event + typedef Arr_construction_event CEvent; - typedef Arr_spherical_construction_helper CHelper; // Type definition for the basic insertion sweep-line visitor. typedef Arr_basic_insertion_traits_2 BInsTraits; typedef Arr_construction_subcurve BISubcurve; - typedef Arr_construction_event BIEvent; - typedef Arr_spherical_insertion_helper + typedef Arr_construction_event BIEvent; + typedef Arr_spherical_insertion_helper BIHelper; // Type definition for the insertion sweep-line visitor. typedef Arr_insertion_traits_2 InsTraits; typedef Arr_construction_subcurve ISubcurve; typedef Arr_construction_event IEvent; - typedef Arr_spherical_insertion_helper + typedef Arr_spherical_insertion_helper IHelper; // Type definition for the batched point-location sweep-line visitor. @@ -340,17 +340,27 @@ private: typedef Arr_spherical_vert_decomp_helper VdHelper; // Type definition for the overlay sweep-line visitor. - template + template struct _Overlay_helper : - public Arr_spherical_overlay_helper, Arr>, - Arr_overlay_subcurve > + public Arr_spherical_overlay_helper + , Arr>, + Arr_overlay_subcurve > { - typedef Arr_spherical_overlay_helper, Arr>, - Arr_overlay_subcurve > Base; + typedef ExGeomTraits_ Ex_geomt_raits; + typedef ArrangementA_ Arrangement_a; + typedef ArrangementB_ Arrangement_b; + + typedef Arr_overlay_subcurve Overlay_subcurve; + typedef Arr_construction_event + Construction_event; + + typedef Arr_spherical_overlay_helper + Base; typedef typename Base::Traits_2 Traits_2; typedef typename Base::Arrangement_red_2 Arrangement_red_2; @@ -360,8 +370,9 @@ private: typedef typename Base::Subcurve Subcurve; typedef typename Base::Construction_helper Construction_helper; - _Overlay_helper(const ArrangementA_* arrA, const ArrangementB_* arrB) : - Base(arrA, arrB) {} + _Overlay_helper(const Arrangement_a* arr_a, const Arrangement_b* arr_b) : + Base(arr_a, arr_b) + {} }; //@} @@ -381,16 +392,16 @@ public: typedef Arr_basic_insertion_sl_visitor Sweep_line_non_intersecting_insertion_visitor; - template + template struct Sweep_line_batched_point_location_visitor : public Arr_batched_pl_sl_visitor { - typedef OutputIterator_ Output_iterator; + typedef OutputIterator_ Output_iterator; - typedef Arr_batched_pl_sl_visitor Base; - typedef typename Base::Traits_2 Traits_2; - typedef typename Base::Event Event; - typedef typename Base::Subcurve Subcurve; + typedef Arr_batched_pl_sl_visitor Base; + typedef typename Base::Traits_2 Traits_2; + typedef typename Base::Event Event; + typedef typename Base::Subcurve Subcurve; Sweep_line_batched_point_location_visitor(const Arr* arr, Output_iterator& oi) : @@ -398,16 +409,16 @@ public: {} }; - template + template struct Sweep_line_vertical_decomposition_visitor : public Arr_vert_decomp_sl_visitor { - typedef OutputIterator_ Output_iterator; + typedef OutputIterator_ Output_iterator; typedef Arr_vert_decomp_sl_visitor Base; - typedef typename Base::Traits_2 Traits_2; - typedef typename Base::Event Event; - typedef typename Base::Subcurve Subcurve; + typedef typename Base::Traits_2 Traits_2; + typedef typename Base::Event Event; + typedef typename Base::Subcurve Subcurve; Sweep_line_vertical_decomposition_visitor(const Arr* arr, Output_iterator* oi) : @@ -415,35 +426,37 @@ public: {} }; - template + template struct Sweep_line_overlay_visitor : public Arr_overlay_sl_visitor - <_Overlay_helper, - ArrangementA_, ArrangementB_>, OverlayTraits_> + <_Overlay_helper, + ArrangementA_, ArrangementB_>, OverlayTraits_> { - typedef ArrangementA_ ArrangementA_2; - typedef ArrangementB_ ArrangementB_2; + typedef ArrangementA_ Arrangement_a; + typedef ArrangementB_ Arrangement_b; typedef Arr Arrangement_result_2; typedef OverlayTraits_ Overlay_traits; - typedef Arr_overlay_traits_2 Geom_ovl_traits_2; + typedef Arr_overlay_traits_2 Geom_ovl_traits_2; - typedef _Overlay_helper - Ovl_helper; + typedef _Overlay_helper + Ovl_helper; - typedef Arr_overlay_sl_visitor Base; + typedef Arr_overlay_sl_visitor Base; - typedef typename Base::Traits_2 Traits_2; - typedef typename Base::Event Event; - typedef typename Base::Subcurve Subcurve; + typedef typename Base::Traits_2 Traits_2; + typedef typename Base::Event Event; + typedef typename Base::Subcurve Subcurve; - Sweep_line_overlay_visitor(const ArrangementA_2* arrA, - const ArrangementB_2* arrB, + Sweep_line_overlay_visitor(const Arrangement_a* arr_a, + const Arrangement_b* arr_b, Arrangement_result_2* arr_res, Overlay_traits* overlay_tr) : - Base(arrA, arrB, arr_res, overlay_tr) + Base(arr_a, arr_b, arr_res, overlay_tr) {} }; @@ -495,8 +508,11 @@ public: * will form a hole in the original face. */ std::pair - face_split_after_edge_insertion(std::pair< CGAL::Sign, CGAL::Sign > /* signs1 */, - std::pair< CGAL::Sign, CGAL::Sign > /* signs2 */) const { + face_split_after_edge_insertion(std::pair< CGAL::Sign, + CGAL::Sign > /* signs1 */, + std::pair< CGAL::Sign, + CGAL::Sign > /* signs2 */) const + { // In case of a spherical topology, connecting two vertices on the same // inner CCB closes a new face that becomes a hole in the original face: return (std::make_pair(true, true)); @@ -633,7 +649,6 @@ public: //@} protected: - /// \name Auxiliary functions. //@{ @@ -644,17 +659,15 @@ protected: * \pre v is a valid boundary. * \return The curve that induces v. */ - const X_monotone_curve_2& _curve(const Vertex* v, - Arr_curve_end& ind) const; + const X_monotone_curve_2& _curve(const Vertex* v, Arr_curve_end& ind) const; /*! Return the halfedge, the target vertex of which is given, that is * the predecessor of a halfedge, the curve of which is given, that is about * to be inserted into the dcel. */ - Halfedge * - _locate_around_vertex_on_discontinuity(Vertex* v, - const X_monotone_curve_2& xc, - Arr_curve_end ind) const; + Halfedge* _locate_around_vertex_on_discontinuity(Vertex* v, + const X_monotone_curve_2& xc, + Arr_curve_end ind) const; /*! Return the halfedge, the target vertex of which is a given pole, * that is the predecessor of a halfedge, the curve of which is given, that diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h index 8adac1b9af1..b4a484d8f90 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h @@ -14,9 +14,10 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Ron Wein +// Efi Fogel #ifndef CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_IMPL_H #define CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_IMPL_H @@ -31,24 +32,22 @@ namespace CGAL { //----------------------------------------------------------------------------- // Assign the contents of another topology-traits class. // -template -void Arr_bounded_planar_topology_traits_2::assign - (const Self& other) +template +void Arr_bounded_planar_topology_traits_2:: +assign(const Self& other) { // Assign the base class. - Base::assign (other); + Base::assign(other); // Update the topology-traits properties after the DCEL have been updated. dcel_updated(); - - return; } //----------------------------------------------------------------------------- // Initialize an empty DCEL structure. // -template -void Arr_bounded_planar_topology_traits_2::init_dcel () +template +void Arr_bounded_planar_topology_traits_2::init_dcel() { // Clear the current DCEL. this->m_dcel.delete_all(); @@ -56,34 +55,26 @@ void Arr_bounded_planar_topology_traits_2::init_dcel () // Create the unbounded face. unb_face = this->m_dcel.new_face(); - unb_face->set_unbounded (true); - unb_face->set_fictitious (false); - - return; + unb_face->set_unbounded(true); + unb_face->set_fictitious(false); } //----------------------------------------------------------------------------- // Make the necessary updates after the DCEL structure have been updated. // -template -void Arr_bounded_planar_topology_traits_2::dcel_updated () +template +void Arr_bounded_planar_topology_traits_2::dcel_updated() { // Go over the DCEL faces and locate the unbounded face. - typename Dcel::Face_iterator fit; - unb_face = NULL; - for (fit = this->m_dcel.faces_begin(); - fit != this->m_dcel.faces_end(); ++fit) - { - if (fit->is_unbounded()) - { + typename Dcel::Face_iterator fit = this->m_dcel.faces_begin(); + for (; fit != this->m_dcel.faces_end(); ++fit) { + if (fit->is_unbounded()) { unb_face = &(*fit); break; } } - CGAL_assertion (unb_face != NULL); - - return; + CGAL_assertion(unb_face != NULL); } } //namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h index dde38441972..059ccaf8808 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h @@ -50,12 +50,11 @@ namespace CGAL { * A base topology-traits class that encapsulates the embedding of 2D * arrangements of bounded or unbounded curves on the plane. */ -template > +template > class Arr_planar_topology_traits_base_2 { public: - ///! \name The geometry-traits types. //@{ typedef GeomTraits_ Geometry_traits_2; @@ -75,54 +74,50 @@ public: typedef typename Dcel::Isolated_vertex Isolated_vertex; //@} - typedef Arr_planar_topology_traits_base_2 Self; + typedef Arr_planar_topology_traits_base_2 + Self; protected: - - typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; + typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; // Data members: - Dcel m_dcel; // The DCEL. + Dcel m_dcel; // The DCEL. - const Traits_adaptor_2* traits; // The geometry-traits adaptor. - bool own_traits; // Inidicate whether we should evetually - // free the traits object. + const Traits_adaptor_2* m_geom_traits; // The geometry-traits adaptor. + bool m_own_geom_traits; // Inidicate whether we should + // evetually free the traits object. // Copy constructor and assignment operator - not supported. - Arr_planar_topology_traits_base_2 (const Self& ); - Self& operator= (const Self& ); + Arr_planar_topology_traits_base_2(const Self&); + Self& operator=(const Self&); public: - ///! \name Construction methods. //@{ /*! Default constructor. */ - Arr_planar_topology_traits_base_2 () : - own_traits (true) - { - traits = new Traits_adaptor_2; - } + Arr_planar_topology_traits_base_2() : + m_own_geom_traits(true) + { m_geom_traits = new Traits_adaptor_2; } /*! Constructor with a geometry-traits class. */ - Arr_planar_topology_traits_base_2 (const Geometry_traits_2 * geom_traits) : - own_traits (false) - { - traits = static_cast(geom_traits); - } + Arr_planar_topology_traits_base_2 (const Geometry_traits_2* geom_traits) : + m_own_geom_traits(false) + { m_geom_traits = static_cast(geom_traits); } /*! Assign the contents of another topology-traits class. */ - void assign (const Self& other); + void assign(const Self& other); /*! Destructor. */ - virtual ~Arr_planar_topology_traits_base_2 () + virtual ~Arr_planar_topology_traits_base_2() { // Clear the DCEL. m_dcel.delete_all(); - if (own_traits) - delete traits; + if (m_own_geom_traits && (m_geom_traits != NULL)) { + delete m_geom_traits; + m_geom_traits = NULL; + } } //@} @@ -130,16 +125,10 @@ public: //@{ /*! Get the DCEL (const version). */ - const Dcel& dcel () const - { - return (m_dcel); - } + const Dcel& dcel() const { return m_dcel; } /*! Get the DCEL (non-const version). */ - Dcel& dcel () - { - return (m_dcel); - } + Dcel& dcel() { return (m_dcel); } /*! * Receive a notification on the creation of a new boundary vertex that @@ -150,11 +139,11 @@ public: * \param ps_x The boundary condition of the curve end in x. * \param ps_y The boundary condition of the curve end in y. */ - void notify_on_boundary_vertex_creation (Vertex *, - const X_monotone_curve_2& , - Arr_curve_end, - Arr_parameter_space /* ps_x */, - Arr_parameter_space /* ps_y */) + void notify_on_boundary_vertex_creation(Vertex*, + const X_monotone_curve_2& , + Arr_curve_end, + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) { // In the planar-topology traits this function should never be invoked: return; @@ -170,9 +159,11 @@ public: * \param swap_predecessors Output swap predeccesors or not; * set correctly only if true is returned */ - bool let_me_decide_the_outer_ccb(std::pair< CGAL::Sign, CGAL::Sign> /* signs1 */, - std::pair< CGAL::Sign, CGAL::Sign> /* signs2 */, - bool& swap_predecessors) const { + bool + let_me_decide_the_outer_ccb(std::pair /* signs1 */, + std::pair /* signs2 */, + bool& swap_predecessors) const + { swap_predecessors = false; return false; } @@ -188,11 +179,14 @@ public: * will form a hole in the original face. */ std::pair - face_split_after_edge_insertion(std::pair< CGAL::Sign, CGAL::Sign > /* signs1 */, - std::pair< CGAL::Sign, CGAL::Sign > /* signs2 */) const { + face_split_after_edge_insertion(std::pair /* signs1 */, + std::pair /* signs2 */) const + { // In case of a planar topology, connecting two vertices on the same // inner CCB closes a new face that becomes a hole in the original face: - return (std::make_pair (true, true)); + return (std::make_pair(true, true)); } /*! @@ -203,7 +197,7 @@ public: * \param f must not be fictitious, and v must not lie at infinity. * \return Whether p is contained in f's interior. */ - bool is_in_face (const Face *f, const Point_2& p, const Vertex *v) const; + bool is_in_face(const Face* f, const Point_2& p, const Vertex* v) const; //@} /// \name Additional accessors, specialized for this topology-traits class. @@ -222,8 +216,8 @@ public: * \param v The vertex. * \return The result of the comparison of the x-coordinates of p and v. */ - virtual Comparison_result compare_x (const Point_2& p, - const Vertex* v) const = 0; + virtual Comparison_result compare_x(const Point_2& p, + const Vertex* v) const = 0; /*! * Compare the given vertex (which may lie at infinity) and the given point. @@ -242,8 +236,8 @@ public: * \pre p should lie in the x-range of the given edge. * \return The relative y-position of the point p and the edge. */ - virtual Comparison_result compare_y_at_x (const Point_2& p, - const Halfedge* he) const = 0; + virtual Comparison_result compare_y_at_x(const Point_2& p, + const Halfedge* he) const = 0; //@} }; @@ -254,43 +248,41 @@ public: //----------------------------------------------------------------------------- // Assign the contents of another topology-traits class. // -template -void Arr_planar_topology_traits_base_2::assign - (const Self& other) +template +void +Arr_planar_topology_traits_base_2::assign(const Self& other) { // Clear the current DCEL and duplicate the other DCEL. m_dcel.delete_all(); - m_dcel.assign (other.m_dcel); + m_dcel.assign(other.m_dcel); // Take care of the traits object. - if (own_traits && traits != NULL) - delete traits; + if (m_own_geom_traits && (m_geom_traits != NULL)) { + delete m_geom_traits; + m_geom_traits = NULL; + } - if (other.own_traits) - traits = new Traits_adaptor_2; - else - traits = other.traits; - own_traits = other.own_traits; + if (other.m_own_geom_traits) m_geom_traits = new Traits_adaptor_2; + else m_geom_traits = other.m_geom_traits; - return; + m_own_geom_traits = other.m_own_geom_traits; } //----------------------------------------------------------------------------- // Determine whether the given vertex lies in the interior of the given face. // -template +template bool Arr_planar_topology_traits_base_2:: -is_in_face(const Face *f, const Point_2& p, const Vertex *v) const +is_in_face(const Face* f, const Point_2& p, const Vertex* v) const { - CGAL_precondition (v == NULL || ! v->has_null_point()); - CGAL_precondition (v == NULL || - traits->equal_2_object()(p, v->point())); + CGAL_precondition((v == NULL) || ! v->has_null_point()); + CGAL_precondition((v == NULL) || + m_geom_traits->equal_2_object()(p, v->point())); // In case the face is unbounded and has no outer ccbs, this is the single // unbounded face of an arrangement of bounded curves. This face obviously // contains any point in its interior. - if (f->is_unbounded() && f->number_of_outer_ccbs() == 0) - return (true); + if (f->is_unbounded() && (f->number_of_outer_ccbs() == 0)) return true; // Keep a counter of the number of x-monotone curves that intersect an upward // vertical emanating from p (except for some degenerate cases that are @@ -302,7 +294,7 @@ is_in_face(const Face *f, const Point_2& p, const Vertex *v) const // We begin by comparing p to the source vertex of the first halfedge. // Note that if p coincides with this vertex, p is obviously not in the // interior of the component. - const Halfedge *first = *(f->outer_ccbs_begin()); + const Halfedge* first = *(f->outer_ccbs_begin()); // Some left ends of curves may not yet have the curve assigned, @@ -317,34 +309,31 @@ is_in_face(const Face *f, const Point_2& p, const Vertex *v) const } - const Halfedge *curr = first; - Comparison_result res_source; - Comparison_result res_target; - Comparison_result res_y_at_x; + const Halfedge* curr = first; + Comparison_result res_source; + Comparison_result res_target; + Comparison_result res_y_at_x; - if (curr->opposite()->vertex() == v) - return (false); + if (curr->opposite()->vertex() == v) return false; - res_source = compare_xy (p, curr->opposite()->vertex()); + res_source = compare_xy(p, curr->opposite()->vertex()); - do - { + do { // Compare p to the target vertex of the current halfedge. // If the vertex v associated with p (if v is given and is not NULL) // on the boundary of the component, p is obviously not in the interior // the component. - if (curr->vertex() == v) - return (false); + if (curr->vertex() == v) return false; // We jump over vertices at TOP/BOTTOM that do not yet have a curve - if( curr->vertex()->parameter_space_in_x()==ARR_INTERIOR - && curr->has_null_curve() - && curr->next()->has_null_curve()){ + if ((curr->vertex()->parameter_space_in_x() == ARR_INTERIOR) && + curr->has_null_curve() && curr->next()->has_null_curve()) + { curr = curr->next(); continue; } - res_target = compare_xy (p, curr->vertex()); + res_target = compare_xy(p, curr->vertex()); // In case the current halfedge belongs to an "antenna", namely its // incident face is the same as its twin's, we can simply skip it @@ -361,19 +350,16 @@ is_in_face(const Face *f, const Point_2& p, const Vertex *v) const // (by "tilted" we mean the angle it forms with the x-axis is // PI/2 + epsilon, where epsilon is arbitrarily small), then we hit // the x-monotone curve associated with curr once. - if (res_source != res_target) - { - res_y_at_x = compare_y_at_x (p, curr); + if (res_source != res_target) { + res_y_at_x = compare_y_at_x(p, curr); - if (res_y_at_x == SMALLER) - { - n_ray_intersections++; + if (res_y_at_x == SMALLER) { + ++n_ray_intersections; } - else if (res_y_at_x == EQUAL) - { + else if (res_y_at_x == EQUAL) { // In this case p lies on the current edge, so it is obviously not // contained in the interior of the component. - return (false); + return false; } } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h index fd7500faa3f..f59e956985e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h @@ -29,33 +29,33 @@ namespace CGAL { /*! \brief constructs default */ -template +template Arr_spherical_topology_traits_2:: Arr_spherical_topology_traits_2() : m_spherical_face(NULL), m_north_pole(NULL), m_south_pole(NULL), - m_own_traits(true) + m_own_geom_traits(true) { - m_traits = new Traits_adaptor_2; - m_boundary_vertices = Vertex_map(Vertex_key_comparer(m_traits)); + m_geom_traits = new Traits_adaptor_2; + m_boundary_vertices = Vertex_map(Vertex_key_comparer(m_geom_traits)); } /*! \brief constructs with a geometry-traits class */ -template +template Arr_spherical_topology_traits_2:: Arr_spherical_topology_traits_2(const Geometry_traits_2* traits) : m_spherical_face(NULL), m_north_pole(NULL), m_south_pole(NULL), - m_own_traits(false) + m_own_geom_traits(false) { - m_traits = static_cast(traits); - m_boundary_vertices = Vertex_map(Vertex_key_comparer(m_traits)); + m_geom_traits = static_cast(traits); + m_boundary_vertices = Vertex_map(Vertex_key_comparer(m_geom_traits)); } /*! \brief assigns the contents of another topology-traits class */ -template +template void Arr_spherical_topology_traits_2:: assign(const Self& other) { @@ -64,15 +64,18 @@ assign(const Self& other) m_dcel.assign(other.m_dcel); // Take care of the traits object. - if (m_own_traits && m_traits != NULL) delete m_traits; + if (m_own_geom_traits && m_geom_traits != NULL) { + delete m_geom_traits; + m_geom_traits == NULL; + } - if (other.m_own_traits) { - m_traits = new Traits_adaptor_2; - m_own_traits = true; + if (other.m_own_geom_traits) { + m_geom_traits = new Traits_adaptor_2; + m_own_geom_traits = true; } else { - m_traits = other.m_traits; - m_own_traits = false; + m_geom_traits = other.m_geom_traits; + m_own_geom_traits = false; } // Update the rest of the properties. @@ -80,23 +83,23 @@ assign(const Self& other) } /*! \brief initializes an empty DCEL structure. */ -template -void Arr_spherical_topology_traits_2::dcel_updated() +template +void Arr_spherical_topology_traits_2::dcel_updated() { + typedef GeomTraits_ GeomTraits; + typedef Dcel_ Dcel; + // Go over the DCEL vertices and locate the south and north pole (if any) // and any other vertex on the line of discontinuity. - typename Dcel::Vertex_iterator vit; - Arr_parameter_space bx, by; m_north_pole = NULL; m_south_pole = NULL; m_boundary_vertices.clear(); - for (vit = this->m_dcel.vertices_begin(); - vit != this->m_dcel.vertices_end(); ++vit) - { - bx = vit->parameter_space_in_x(); - by = vit->parameter_space_in_y(); + typename Dcel::Vertex_iterator vit = this->m_dcel.vertices_begin(); + for (; vit != this->m_dcel.vertices_end(); ++vit) { + Arr_parameter_space bx = vit->parameter_space_in_x(); + Arr_parameter_space by = vit->parameter_space_in_y(); if (by == ARR_BOTTOM_BOUNDARY) m_south_pole = &(*vit); else if (by == ARR_TOP_BOUNDARY) m_north_pole = &(*vit); @@ -108,11 +111,10 @@ void Arr_spherical_topology_traits_2::dcel_updated() // Go over the DCEL faces and locate the spherical face, which is the only // face with no outer CCB. - typename Dcel::Face_iterator fit; m_spherical_face = NULL; - for (fit = this->m_dcel.faces_begin(); fit != this->m_dcel.faces_end(); ++fit) - { + typename Dcel::Face_iterator fit = this->m_dcel.faces_begin(); + for (; fit != this->m_dcel.faces_end(); ++fit) { if (fit->number_of_outer_ccbs() == 0) { CGAL_assertion(m_spherical_face == NULL); @@ -121,12 +123,10 @@ void Arr_spherical_topology_traits_2::dcel_updated() } } CGAL_assertion(m_spherical_face != NULL); - - return; } /*! \brief initializes an empty DCEL structure. */ -template +template void Arr_spherical_topology_traits_2::init_dcel() { // std::cout << "init_dcel()" << std::endl; @@ -144,13 +144,14 @@ void Arr_spherical_topology_traits_2::init_dcel() } /*! \brief determines whether a point lies in the interior of a given face. */ -template +template bool Arr_spherical_topology_traits_2:: is_in_face(const Face* f, const Point_2& p, const Vertex* v) const { // std::cout << "is_in_face()" << std::endl; CGAL_precondition((v == NULL) || !v->has_null_point()); - CGAL_precondition((v == NULL) || m_traits->equal_2_object()(p, v->point())); + CGAL_precondition((v == NULL) || + m_geom_traits->equal_2_object()(p, v->point())); /* There is always one face that contains everything else. It has no * outer CCB's. When a new face is constructed, we make sure that the @@ -166,7 +167,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const #endif if (f->number_of_outer_ccbs() == 0) return true; if (((v != NULL) && (v->parameter_space_in_y() == ARR_TOP_BOUNDARY)) || - (m_traits->parameter_space_in_y_2_object()(p) == ARR_TOP_BOUNDARY)) + (m_geom_traits->parameter_space_in_y_2_object()(p) == ARR_TOP_BOUNDARY)) return false; /*! \todo a temporary test @@ -176,18 +177,18 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const */ typename Traits_adaptor_2::Parameter_space_in_x_2 ps_x_op = - m_traits->parameter_space_in_x_2_object(); + m_geom_traits->parameter_space_in_x_2_object(); typename Traits_adaptor_2::Parameter_space_in_y_2 ps_y_op = - m_traits->parameter_space_in_y_2_object(); + m_geom_traits->parameter_space_in_y_2_object(); typename Traits_adaptor_2::Compare_x_2 cmp_x_op = - m_traits->compare_x_2_object(); + m_geom_traits->compare_x_2_object(); typename Traits_adaptor_2::Compare_y_at_x_2 cmp_y_at_x_op = - m_traits->compare_y_at_x_2_object(); + m_geom_traits->compare_y_at_x_2_object(); typename Traits_adaptor_2::Compare_x_point_curve_end_2 cmp_x_pt_ce = - m_traits->compare_x_point_curve_end_2_object(); + m_geom_traits->compare_x_point_curve_end_2_object(); // Process the input point. - bool p_is_interior_x = !(m_traits->is_on_y_identification_2_object()(p)); + bool p_is_interior_x = !(m_geom_traits->is_on_y_identification_2_object()(p)); /* Maintain a counter of the number of x-monotone curves that intersect an * upward vertical ray emanating from p. Handle degenerate cases as @@ -208,7 +209,6 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const */ if (curr->opposite()->vertex() == v) return false; - /*! We identify 2 main cases: * 1. The vertical ray intersects the boundary at a halfedge. In this * case the x-possition of p is strictly larger than the x-possition of @@ -250,7 +250,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const if (curr->vertex() == v) return false; // Ignore vertical curves: - bool is_vertical = m_traits->is_vertical_2_object()(curr->curve()); + bool is_vertical = m_geom_traits->is_vertical_2_object()(curr->curve()); if (is_vertical) { /* If this outer ccb chain contains the north pole, and our point * lies horizontaly between the two vertical curves that meet at @@ -258,7 +258,8 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const */ if (curr->direction() == ARR_LEFT_TO_RIGHT) { Arr_parameter_space ps_y_1 = ps_y_op(curr->curve(), ARR_MAX_END); - Arr_parameter_space ps_y_2 = ps_y_op(curr->next()->curve(), ARR_MAX_END); + Arr_parameter_space ps_y_2 = ps_y_op(curr->next()->curve(), + ARR_MAX_END); if ((ps_y_1 == ARR_TOP_BOUNDARY) && (ps_y_2 == ARR_TOP_BOUNDARY)) { // Compare the x-coordinates: Comparison_result rc1 = @@ -291,7 +292,8 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const if (curr->direction() == ARR_LEFT_TO_RIGHT) { ind_source = ARR_MIN_END; ind_target = ARR_MAX_END; - } else { + } + else { ind_source = ARR_MAX_END; ind_target = ARR_MIN_END; } @@ -404,17 +406,17 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const } /*! \brief compares the relative y-position of a point and a halfedge */ -template +template Comparison_result Arr_spherical_topology_traits_2:: compare_y_at_x(const Point_2& p, const Halfedge* he) const { // std::cout << "compare_y_at_x(Point_2&,Halfedge*)" << std::endl; - return m_traits->compare_y_at_x_2_object()(p, he->curve()); + return m_geom_traits->compare_y_at_x_2_object()(p, he->curve()); } /*! \brief determine whether a vertex is associated with a curve end */ -template +template bool Arr_spherical_topology_traits_2:: are_equal(const Vertex* v, const X_monotone_curve_2& xc, Arr_curve_end ind, @@ -445,13 +447,13 @@ are_equal(const Vertex* v, */ const Point_2& p1 = v->point(); const Point_2& p2 = (ind == ARR_MIN_END) ? - m_traits->construct_min_vertex_2_object()(xc) : - m_traits->construct_max_vertex_2_object()(xc); - return (m_traits->compare_y_on_boundary_2_object()(p1, p2) == EQUAL); + m_geom_traits->construct_min_vertex_2_object()(xc) : + m_geom_traits->construct_max_vertex_2_object()(xc); + return (m_geom_traits->compare_y_on_boundary_2_object()(p1, p2) == EQUAL); } /*! \brief receives a notification on the creation of a new boundary vertex */ -template +template void Arr_spherical_topology_traits_2:: notify_on_boundary_vertex_creation(Vertex* v, @@ -472,37 +474,38 @@ notify_on_boundary_vertex_creation(Vertex* v, } CGAL_assertion(ps_x != ARR_INTERIOR); const Point_2& key = (ind == ARR_MIN_END) ? - m_traits->construct_min_vertex_2_object()(xc) : - m_traits->construct_max_vertex_2_object()(xc); + m_geom_traits->construct_min_vertex_2_object()(xc) : + m_geom_traits->construct_max_vertex_2_object()(xc); m_boundary_vertices.insert(Vertex_value(key, v)); } -template -bool -Arr_spherical_topology_traits_2:: +template +bool Arr_spherical_topology_traits_2:: let_me_decide_the_outer_ccb(std::pair< CGAL::Sign, CGAL::Sign> signs1, std::pair< CGAL::Sign, CGAL::Sign> signs2, - bool& swap_predecessors) const { + bool& swap_predecessors) const +{ + // no perimetric in top-bottom for first loop + CGAL_precondition(signs1.second == CGAL::ZERO); - CGAL_precondition(signs1.second == CGAL::ZERO); // no perimetric in top-bottom for first loop - CGAL_precondition(signs2.second == CGAL::ZERO); // no perimetric in top-bottom for second loop + // no perimetric in top-bottom for second loop + CGAL_precondition(signs2.second == CGAL::ZERO); - // choose prev1 to define outer ccb of new face if it is a non-perimetric loop, - // otherwise choose prev2 - // TODO what if both are non-zero? does it occur? - // TODO EBEB check this!!!! - swap_predecessors = (signs2.first != CGAL::POSITIVE); - - // but only if the at least one of the loops is perimetric, otherwise return false - // to let leftmost-vertex decide which becomes part of the new outer ccb - return signs1.first != CGAL::ZERO || signs2.first != CGAL::ZERO; - } + // choose prev1 to define outer ccb of new face if it is a non-perimetric loop, + // otherwise choose prev2 + // TODO what if both are non-zero? does it occur? + // TODO EBEB check this!!!! + swap_predecessors = (signs2.first != CGAL::POSITIVE); + // but only if the at least one of the loops is perimetric, otherwise return + // false to let leftmost-vertex decide which becomes part of the new outer ccb + return (signs1.first != CGAL::ZERO) || (signs2.first != CGAL::ZERO); +} /*! \brief given a curve end with boundary conditions and a face that contains * the interior of the curve, find a place for a boundary vertex that will * represent the curve end along the face boundary */ -template +template CGAL::Object Arr_spherical_topology_traits_2:: place_boundary_vertex(Face* /* f */, @@ -523,8 +526,8 @@ place_boundary_vertex(Face* /* f */, CGAL_assertion((ps_x == ARR_LEFT_BOUNDARY) || (ps_x == ARR_RIGHT_BOUNDARY)); const Point_2& key = (ind == ARR_MIN_END) ? - m_traits->construct_min_vertex_2_object()(xc) : - m_traits->construct_max_vertex_2_object()(xc); + m_geom_traits->construct_min_vertex_2_object()(xc) : + m_geom_traits->construct_max_vertex_2_object()(xc); typename Vertex_map::iterator it = m_boundary_vertices.find(key); if (it != m_boundary_vertices.end()) { @@ -538,7 +541,7 @@ place_boundary_vertex(Face* /* f */, /*! \brief locate the predecessor halfedge for the given curve around a given * vertex with boundary conditions. */ -template +template typename Arr_spherical_topology_traits_2::Halfedge* Arr_spherical_topology_traits_2:: locate_around_boundary_vertex(Vertex* v, @@ -564,7 +567,7 @@ locate_around_boundary_vertex(Vertex* v, } /*! \brief locates a DCEL feature that contains a given curve end. */ -template +template CGAL::Object Arr_spherical_topology_traits_2:: locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind, Arr_parameter_space ps_x, Arr_parameter_space ps_y) @@ -579,7 +582,7 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind, } typename Vertex_map::iterator it; - Vertex* v = NULL; + Vertex* v = NULL; if (ps_y == ARR_BOTTOM_BOUNDARY) { // In case the curve end coincides with the south pole, return the vertex @@ -595,8 +598,8 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind, // discontinuity. If so, return this vertex. Otherwise, locate the first // vertex above it. const Point_2& key = (ind == ARR_MIN_END) ? - m_traits->construct_min_vertex_2_object()(xc) : - m_traits->construct_max_vertex_2_object()(xc); + m_geom_traits->construct_min_vertex_2_object()(xc) : + m_geom_traits->construct_max_vertex_2_object()(xc); it = m_boundary_vertices.find(key); if (it != m_boundary_vertices.end()) { v = it->second; @@ -618,13 +621,13 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind, } /*! \brief determines whether a given boundary vertex is redundant */ -template +template bool Arr_spherical_topology_traits_2:: is_redundant(const Vertex* v) const { return (v->halfedge() == NULL); } /* \brief erases a given redundant vertex */ -template +template typename Arr_spherical_topology_traits_2::Halfedge* Arr_spherical_topology_traits_2:: erase_redundant_vertex(Vertex* v) @@ -645,7 +648,7 @@ erase_redundant_vertex(Vertex* v) } /*! \brief obtains the curve associated with a boundary vertex */ -template +template const typename Arr_spherical_topology_traits_2::X_monotone_curve_2& Arr_spherical_topology_traits_2:: @@ -661,7 +664,7 @@ _curve(const Vertex* v, Arr_curve_end& ind) const * the predecessor of a halfedge, the curve of which is given, that is about * to be inserted into the dcel. */ -template +template typename Arr_spherical_topology_traits_2::Halfedge* Arr_spherical_topology_traits_2:: _locate_around_vertex_on_discontinuity(Vertex* v, @@ -684,7 +687,7 @@ _locate_around_vertex_on_discontinuity(Vertex* v, // Otherwise, we traverse the halfedges around v until we find the pair // of adjacent halfedges between which we should insert xc. typename Traits_adaptor_2::Is_between_cw_2 is_between_cw = - m_traits->is_between_cw_2_object(); + m_geom_traits->is_between_cw_2_object(); bool eq_curr, eq_next; while (!is_between_cw(xc, (ind == ARR_MIN_END), curr->curve(), @@ -712,18 +715,17 @@ _locate_around_vertex_on_discontinuity(Vertex* v, * that is the predecessor of a halfedge, the curve of which is given, that * is about to be inserted into the dcel. */ -template +template typename Arr_spherical_topology_traits_2::Halfedge* Arr_spherical_topology_traits_2:: _locate_around_pole(Vertex* v, const X_monotone_curve_2& xc, Arr_curve_end ind) const { - CGAL_assertion(v == m_south_pole || v == m_north_pole); + CGAL_assertion((v == m_south_pole) || (v == m_north_pole)); // std::cout << "locate_around_pole() " << ind << std::endl; // If the vertex is isolated, return a null halfedge: - if (v->is_isolated()) - return NULL; + if (v->is_isolated()) return NULL; // Get the first incident halfedge around v and the next halfedge: Halfedge* first = v->halfedge(); @@ -742,7 +744,7 @@ _locate_around_pole(Vertex* v, // Traverse all other halfedges, and compare their x-positions next to the // pole with the query curve xc. typename Traits_adaptor_2::Compare_x_curve_ends_2 cmp_x_curve_ends = - m_traits->compare_x_curve_ends_2_object(); + m_geom_traits->compare_x_curve_ends_2_object(); Arr_curve_end curr_end, next_end; Comparison_result curr_res, next_res; Comparison_result curr_next_res; @@ -782,14 +784,13 @@ _locate_around_pole(Vertex* v, /*! \brief Return the face that lies below the given vertex, which lies * on the line of discontinuity. */ -template +template typename Arr_spherical_topology_traits_2::Face* Arr_spherical_topology_traits_2:: _face_below_vertex_on_discontinuity(Vertex* v) const { // If the vertex is isolated, just return the face that contains it. - if (v->is_isolated()) - return (v->isolated_vertex()->face()); + if (v->is_isolated()) return (v->isolated_vertex()->face()); // Get the first incident halfedge around v and the next halfedge. Halfedge* first = v->halfedge(); @@ -806,9 +807,9 @@ _face_below_vertex_on_discontinuity(Vertex* v) const // halfedge we encounter if we go from "6 o'clock" clockwise. // First locate the lower left and the top right halfedges around v. typename Traits_adaptor_2::Compare_y_at_x_right_2 cmp_y_at_x_op_right = - m_traits->compare_y_at_x_right_2_object(); + m_geom_traits->compare_y_at_x_right_2_object(); typename Traits_adaptor_2::Compare_y_at_x_left_2 cmp_y_at_x_op_left = - m_traits->compare_y_at_x_left_2_object(); + m_geom_traits->compare_y_at_x_left_2_object(); Halfedge* lowest_left = NULL; Halfedge* top_right = NULL; @@ -859,7 +860,6 @@ _face_below_vertex_on_discontinuity(Vertex* v) const first->inner_ccb()->face() : first->outer_ccb()->face()); } - } //namespace CGAL #endif diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h index 1f9728668fe..684a60f5013 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Ron Wein // Efi Fogel @@ -123,7 +123,7 @@ void Arr_unb_planar_topology_traits_2::dcel_updated () // Go over the DCEL faces and locate the fictitious face. typename Dcel::Face_iterator fit; - + fict_face = NULL; for (fit = this->m_dcel.faces_begin(); fit != this->m_dcel.faces_end(); ++fit) @@ -175,12 +175,12 @@ void Arr_unb_planar_topology_traits_2::init_dcel () // // he2 // v_tl (.) ----------------> (.) v_tr - // ^ <------------------ + // ^ <------------------ // || ^| // fict_face he1 || in_f || // || || he3 // |V || - // ------------------> V + // ------------------> V // v_bl (.) <---------------- (.) v_br // he4 // @@ -257,13 +257,12 @@ are_equal(const Vertex *v, // In case the given boundary conditions do not match those of the given // vertex, v cannot represent the curve end. if (ps_x != v->parameter_space_in_x() || ps_y != v->parameter_space_in_y()) - return (false); + return false; // Compare the curve end with the vertex. Comparison_result res; - if (ps_x != ARR_INTERIOR) - { + if (ps_x != ARR_INTERIOR) { // The curve end lies at x = +/- oo and so does v. Check if the curve // overlaps with the curve that currently induces v. Arr_curve_end v_ind; @@ -272,11 +271,11 @@ are_equal(const Vertex *v, if (v_cv == NULL) return (v->parameter_space_in_x() == ps_x && v->parameter_space_in_y() == ps_y); - - res = this->traits->compare_y_curve_ends_2_object() (cv, *v_cv, v_ind); + + res = this->m_geom_traits->compare_y_curve_ends_2_object()(cv, + *v_cv, v_ind); } - else - { + else { CGAL_assertion (ps_y != ARR_INTERIOR); // The curve end lies at y = +/- oo and so does v. Check if the curve @@ -289,7 +288,8 @@ are_equal(const Vertex *v, v->parameter_space_in_y() == ps_y); res = - this->traits->compare_x_curve_ends_2_object() (cv, ind, *v_cv, v_ind); + this->m_geom_traits->compare_x_curve_ends_2_object() (cv, ind, + *v_cv, v_ind); } return (res == EQUAL); @@ -416,10 +416,10 @@ split_fictitious_edge (Halfedge *e, Vertex *v) // face. Halfedge *he1 = e; Halfedge *he2 = he1->opposite(); - + CGAL_assertion (! he1->is_on_inner_ccb()); Outer_ccb *oc1 = he1->outer_ccb(); - + CGAL_assertion (oc1->face()->is_unbounded()); CGAL_assertion (he2->is_on_inner_ccb()); @@ -489,9 +489,9 @@ is_unbounded(const Face *f) const if (curr->has_null_curve()) // Found a fictitious halfedge along the boundary: f is unbounded. return (true); - + curr = curr->next(); - + } while (curr != first); // If we reached here, all halfedges along the face boundary are valid, @@ -512,7 +512,7 @@ is_redundant(const Vertex *v) const // is no valid edge incident to it). const Halfedge *first_he = v->halfedge(); const Halfedge *next_he = first_he->next()->opposite(); - + if (next_he->next()->opposite() == first_he) { CGAL_assertion (first_he->has_null_curve() && next_he->has_null_curve()); @@ -604,7 +604,7 @@ compare_x (const Point_2& p, const Vertex* v) const { // First check if the vertex v lies at x = -oo (then it is obviously smaller // than p), or at x = +oo (then it is obviously larger). - const Arr_parameter_space ps_x = v->parameter_space_in_x(); + const Arr_parameter_space ps_x = v->parameter_space_in_x(); if (ps_x == ARR_LEFT_BOUNDARY) return (LARGER); @@ -612,21 +612,23 @@ compare_x (const Point_2& p, const Vertex* v) const return (SMALLER); // Check if the vertex lies at y = +/- oo. - const Arr_parameter_space ps_y = v->parameter_space_in_y(); + const Arr_parameter_space ps_y = v->parameter_space_in_y(); if (ps_y != ARR_INTERIOR) { // Compare the x-position of the vertical asymptote of the curve incident // to v with the x-coodinate of p. - Arr_curve_end v_ind = ARR_MIN_END; - const X_monotone_curve_2 *v_cv = _curve (v, v_ind); - - CGAL_assertion (v_cv != NULL); - return (this->traits->compare_x_point_curve_end_2_object() (p, *v_cv, v_ind)); + Arr_curve_end v_ind = ARR_MIN_END; + const X_monotone_curve_2* v_cv = _curve (v, v_ind); + + CGAL_assertion(v_cv != NULL); + return + (this->m_geom_traits->compare_x_point_curve_end_2_object()(p, *v_cv, + v_ind)); } // In this case v represents a normal point, and we compare it with p. - return (this->traits->compare_x_2_object() (p, v->point())); + return (this->m_geom_traits->compare_x_2_object() (p, v->point())); } //----------------------------------------------------------------------------- @@ -639,37 +641,34 @@ compare_xy (const Point_2& p, const Vertex* v) const { // First check if the vertex v lies at x = -oo (then it is obviously smaller // than p), or at x = +oo (then it is obviously larger). - const Arr_parameter_space ps_x = v->parameter_space_in_x(); + const Arr_parameter_space ps_x = v->parameter_space_in_x(); - if (ps_x == ARR_LEFT_BOUNDARY) - return (LARGER); - else if (ps_x == ARR_RIGHT_BOUNDARY) - return (SMALLER); + if (ps_x == ARR_LEFT_BOUNDARY) return (LARGER); + else if (ps_x == ARR_RIGHT_BOUNDARY) return (SMALLER); // Check if the vertex lies at y = +/- oo. - const Arr_parameter_space ps_y = v->parameter_space_in_y(); + const Arr_parameter_space ps_y = v->parameter_space_in_y(); - if (ps_y != ARR_INTERIOR) - { + if (ps_y != ARR_INTERIOR) { // Compare the x-position of the vertical asymptote of the curve incident // to v with the x-coodinate of p. - Arr_curve_end v_ind = ARR_MIN_END; - const X_monotone_curve_2 *v_cv = _curve (v, v_ind); + Arr_curve_end v_ind = ARR_MIN_END; + const X_monotone_curve_2* v_cv = _curve (v, v_ind); CGAL_assertion (v_cv != NULL); - Comparison_result res = - this->traits->compare_x_point_curve_end_2_object() (p, *v_cv, v_ind); + Comparison_result res = + this->m_geom_traits->compare_x_point_curve_end_2_object() (p, *v_cv, + v_ind); - if (res != EQUAL) - return (res); + if (res != EQUAL) return (res); // In case of equality, consider whether v lies at y = -oo or at y = +oo. return (ps_y == ARR_BOTTOM_BOUNDARY) ? LARGER : SMALLER; } // In this case v represents a normal point, and we compare it with p. - return (this->traits->compare_xy_2_object() (p, v->point())); + return (this->m_geom_traits->compare_xy_2_object()(p, v->point())); } //----------------------------------------------------------------------------- @@ -683,54 +682,52 @@ compare_y_at_x (const Point_2& p, const Halfedge* he) const { // In case of a valid edge, just compare p to its associated curve. if (! he->has_null_curve()) - return (this->traits->compare_y_at_x_2_object() (p, he->curve())); + return (this->m_geom_traits->compare_y_at_x_2_object()(p, he->curve())); // Otherwise, determine on which edge of the bounding rectangle does he lie. // Note this can be either the top edge or the bottom edge (and not the // left or the right edge), as p must lie in its x-range. - CGAL_assertion ((he->vertex()->parameter_space_in_x() == ARR_INTERIOR) || - (he->vertex()->parameter_space_in_x() != - he->opposite()->vertex()->parameter_space_in_x())); - CGAL_assertion ((he->vertex()->parameter_space_in_y() != ARR_INTERIOR) && - (he->vertex()->parameter_space_in_y() == - he->opposite()->vertex()->parameter_space_in_y())); + CGAL_assertion((he->vertex()->parameter_space_in_x() == ARR_INTERIOR) || + (he->vertex()->parameter_space_in_x() != + he->opposite()->vertex()->parameter_space_in_x())); + CGAL_assertion((he->vertex()->parameter_space_in_y() != ARR_INTERIOR) && + (he->vertex()->parameter_space_in_y() == + he->opposite()->vertex()->parameter_space_in_y())); + // he lies on the bottom edge, so p is obviously above it. if (he->vertex()->parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) - // he lies on the bottom edge, so p is obviously above it. - return (LARGER); + return LARGER; + // he lies on the top edge, so p is obviously below it. else - // he lies on the top edge, so p is obviously below it. - return (SMALLER); + return SMALLER; } //----------------------------------------------------------------------------- // Get the curve associated with a boundary vertex. // -template +template const typename -Arr_unb_planar_topology_traits_2::X_monotone_curve_2* +Arr_unb_planar_topology_traits_2::X_monotone_curve_2* Arr_unb_planar_topology_traits_2:: -_curve (const Vertex *v, Arr_curve_end& ind) const +_curve (const Vertex* v, Arr_curve_end& ind) const { // Go over the incident halfedges of v until encountering the halfedge // associated with a valid curve (v should have three incident halfedges, // two of the are fictitious and one associated with a curve). - const Halfedge *he = v->halfedge(); + const Halfedge* he = v->halfedge(); - while (he->has_null_curve()) - { + while (he->has_null_curve()) { he = he->next()->opposite(); - if (he == v->halfedge()) - // No incident curve were found: - return (NULL); + // No incident curve were found: + if (he == v->halfedge()) return (NULL); } // The halfedge he is directed toward v, so if it is directed from left to // right, v represents the maximal end of cv, otherwise it represents its // minimal end. ind = (he->direction() == ARR_LEFT_TO_RIGHT) ? ARR_MAX_END : ARR_MIN_END; - + // Return the x-monotone curve. return &(he->curve()); } @@ -739,116 +736,101 @@ _curve (const Vertex *v, Arr_curve_end& ind) const // Check whether the given infinite curve end lies on the given fictitious // halfedge. // -template -bool +template +bool Arr_unb_planar_topology_traits_2:: -_is_on_fictitious_edge (const X_monotone_curve_2& cv, Arr_curve_end ind, - Arr_parameter_space ps_x, Arr_parameter_space ps_y, - const Halfedge *he, - bool& eq_source, bool& eq_target) +_is_on_fictitious_edge(const X_monotone_curve_2& cv, Arr_curve_end ind, + Arr_parameter_space ps_x, Arr_parameter_space ps_y, + const Halfedge* he, + bool& eq_source, bool& eq_target) { eq_source = false; eq_target = false; // Get the end-vertices of the edge. - const Vertex *v1 = he->opposite()->vertex(); - const Vertex *v2 = he->vertex(); - Comparison_result res1, res2; - Arr_curve_end v_ind = ARR_MIN_END; + const Vertex* v1 = he->opposite()->vertex(); + const Vertex* v2 = he->vertex(); + Comparison_result res1, res2; + Arr_curve_end v_ind = ARR_MIN_END; // Check if this is a "vertical" ficitious edge. Arr_parameter_space he_ps_x = v1->parameter_space_in_x(); - if (he_ps_x != ARR_INTERIOR && he_ps_x == v2->parameter_space_in_x()) - { + if ((he_ps_x != ARR_INTERIOR) && (he_ps_x == v2->parameter_space_in_x())) { // If the edge lies on x = +/- oo, the curve endpoint must also lie there. - CGAL_assertion ((he_ps_x == ARR_LEFT_BOUNDARY) || - (he_ps_x == ARR_RIGHT_BOUNDARY)); + CGAL_assertion((he_ps_x == ARR_LEFT_BOUNDARY) || + (he_ps_x == ARR_RIGHT_BOUNDARY)); - if (he_ps_x != ps_x) - return (false); + if (he_ps_x != ps_x) return false; // Compare the y-position of the curve end to the source vertex. - if (v1 == v_bl || v1 == v_br) - { + if ((v1 == v_bl) || (v1 == v_br)) { // These vertices are below any curve. res1 = LARGER; } - else if (v1 == v_tl || v1 == v_tr) - { + else if ((v1 == v_tl) || (v1 == v_tr)) { // These vertices are above any curve. res1 = SMALLER; } - else - { - const Arr_curve_end ind = + else { + const Arr_curve_end ind = (ps_x == ARR_LEFT_BOUNDARY) ? ARR_MIN_END : ARR_MAX_END; res1 = - this->traits->compare_y_curve_ends_2_object() (cv, - *_curve (v1, v_ind), - ind); - if (res1 == EQUAL) - { + this->m_geom_traits->compare_y_curve_ends_2_object()(cv, + *_curve (v1, v_ind), + ind); + if (res1 == EQUAL) { eq_source = true; - return (true); + return true; } } // Compare the y-position of the curve end to the target vertex. - if (v2 == v_bl || v2 == v_br) - { + if ((v2 == v_bl) || (v2 == v_br)) { // These vertices are below any curve. res2 = LARGER; } - else if (v2 == v_tl || v2 == v_tr) - { + else if ((v2 == v_tl) || (v2 == v_tr)) { // These vertices are above any curve. res2 = SMALLER; } - else - { + else { const Arr_curve_end ind = (ps_x == ARR_LEFT_BOUNDARY) ? ARR_MIN_END : ARR_MAX_END; res2 = - this->traits->compare_y_curve_ends_2_object() (cv, - *_curve (v2, v_ind), - ind); - - if (res2 == EQUAL) - { + this->m_geom_traits->compare_y_curve_ends_2_object()(cv, + *_curve (v2, v_ind), + ind); + + if (res2 == EQUAL) { eq_target = true; - return (true); + return true; } } } - else - { + else { // If we reched here, we have a "horizontal" fictitious halfedge. Arr_parameter_space he_ps_y = v1->parameter_space_in_y(); - CGAL_assertion ((he_ps_y == ARR_BOTTOM_BOUNDARY || - he_ps_y == ARR_TOP_BOUNDARY) && - he_ps_y == v2->parameter_space_in_y()); + CGAL_assertion((he_ps_y == ARR_BOTTOM_BOUNDARY || + he_ps_y == ARR_TOP_BOUNDARY) && + he_ps_y == v2->parameter_space_in_y()); // If the edge lies on y = +/- oo, the curve endpoint must also lie there // (and must not lies at x = +/- oo. - if (ps_x != ARR_INTERIOR || he_ps_y != ps_y) - return (false); + if ((ps_x != ARR_INTERIOR) || (he_ps_y != ps_y)) return false; // Compare the x-position of the curve end to the source vertex. - if (v1 == v_bl || v1 == v_tl) - { + if ((v1 == v_bl) || (v1 == v_tl)) { // These vertices are to the left of any curve. res1 = LARGER; } - else if (v1 == v_br || v1 == v_tr) - { + else if ((v1 == v_br) || (v1 == v_tr)) { // These vertices are to the right of any curve. res1 = SMALLER; } - else - { + else { const X_monotone_curve_2 *v_cv1 = _curve (v1, v_ind); // Note that v1 is a non-fictitious vertex, therefore we expect it to @@ -858,37 +840,32 @@ _is_on_fictitious_edge (const X_monotone_curve_2& cv, Arr_curve_end ind, // arrangement, but it hasn't been associated with a valid halfedge // yet, as the insertion process is still ongoing. // The comparison result in this case is trivial. - if (v_cv1 != NULL) - { - res1 = this->traits->compare_x_curve_ends_2_object() (cv, ind, - *v_cv1, v_ind); - - if (res1 == EQUAL) - { + if (v_cv1 != NULL) { + res1 = + this->m_geom_traits->compare_x_curve_ends_2_object()(cv, ind, + *v_cv1, v_ind); + + if (res1 == EQUAL) { eq_source = true; - return (true); + return true; } } - else - { + else { res1 = (ind == ARR_MIN_END) ? SMALLER : LARGER; } } // Compare the x-position of the curve end to the target vertex. - if (v2 == v_bl || v2 == v_tl) - { + if ((v2 == v_bl) || (v2 == v_tl)) { // These vertices are to the left of any curve. res2 = LARGER; } - else if (v2 == v_br || v2 == v_tr) - { + else if ((v2 == v_br) || (v2 == v_tr)) { // These vertices are to the right of any curve. res2 = SMALLER; } - else - { - const X_monotone_curve_2 *v_cv2 = _curve (v2, v_ind); + else { + const X_monotone_curve_2* v_cv2 = _curve(v2, v_ind); // Note that v2 is a non-fictitious vertex, therefore we expect it to // be associated with a valid curve end. If this is not the case, we @@ -897,21 +874,19 @@ _is_on_fictitious_edge (const X_monotone_curve_2& cv, Arr_curve_end ind, // arrangement, but it hasn't been associated with a valid halfedge // yet, as the insertion process is still ongoing. // The comparison result in this case is trivial. - if (v_cv2 != NULL) - { - res2 = this->traits->compare_x_curve_ends_2_object() (cv, ind, - *v_cv2, v_ind); - - if (res2 == EQUAL) - { + if (v_cv2 != NULL) { + res2 = + this->m_geom_traits->compare_x_curve_ends_2_object()(cv, ind, + *v_cv2, v_ind); + + if (res2 == EQUAL) { eq_target = true; - return (true); - } + return true; + } } - else - { + else { res2 = (ind == ARR_MIN_END) ? SMALLER : LARGER; - } + } } } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h index dadcb3e5fda..7432611cb9d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h @@ -38,25 +38,23 @@ namespace CGAL { // Forward declaration: -template +template class Arrangement_on_surface_2; /*! \class Arr_unb_planar_topology_traits_2 * A topology-traits class that encapsulates the embedding of 2D arrangements * of unbounded curves on the plane. */ -template > +template > class Arr_unb_planar_topology_traits_2 : public Arr_planar_topology_traits_base_2 { private: - - typedef Arr_planar_topology_traits_base_2 Base; + typedef Arr_planar_topology_traits_base_2 + Base; public: - ///! \name The geometry-traits types. //@{ typedef GeomTraits_ Geometry_traits_2; @@ -76,7 +74,6 @@ public: typedef typename Base::Isolated_vertex Isolated_vertex; //@} - //! \name Arrangement types //!@{ typedef Arr_unb_planar_topology_traits_2 Self; @@ -120,46 +117,43 @@ public: * An auxiliary structure for rebinding the topology traits with a new * geometry-traits class and a new DCEL class. */ - template - struct rebind - { - typedef Arr_unb_planar_topology_traits_2 other; + template + struct rebind { + typedef Arr_unb_planar_topology_traits_2 other; }; protected: - // Data members: - Vertex *v_bl; // A fictitious vertex at (-oo,-oo). - Vertex *v_tl; // A fictitious vertex at (-oo,+oo). - Vertex *v_br; // A fictitious vertex at (-oo,+oo). - Vertex *v_tr; // A fictitious vertex at (+oo,+oo). - Size n_inf_verts; // Number of vertices at infinity. - Face *fict_face; // The fictitious DCEL face. + Vertex* v_bl; // A fictitious vertex at (-oo,-oo). + Vertex* v_tl; // A fictitious vertex at (-oo,+oo). + Vertex* v_br; // A fictitious vertex at (-oo,+oo). + Vertex* v_tr; // A fictitious vertex at (+oo,+oo). + Size n_inf_verts; // Number of vertices at infinity. + Face* fict_face; // The fictitious DCEL face. // Copy constructor and assignment operator - not supported. - Arr_unb_planar_topology_traits_2 (const Self& ); - Self& operator= (const Self& ); + Arr_unb_planar_topology_traits_2(const Self&); + Self& operator=(const Self&); public: - ///! \name Construction methods. //@{ /*! Default constructor. */ - Arr_unb_planar_topology_traits_2 (); + Arr_unb_planar_topology_traits_2(); /*! Constructor with a geometry-traits class. */ - Arr_unb_planar_topology_traits_2 (const Geometry_traits_2 *tr); + Arr_unb_planar_topology_traits_2(const Geometry_traits_2* tr); /*! Assign the contents of another topology-traits class. */ - void assign (const Self& other); + void assign(const Self& other); //@} ///! \name Accessing the DCEL and constructing iterators. //@{ /*! Determine whether the DCEL reprsenets an empty structure. */ - bool is_empty_dcel () const + bool is_empty_dcel() const { // An empty arrangement contains just two four vertices at infinity // and eight fictitious halfedges connecting them. @@ -168,40 +162,40 @@ public: } /*! Check if the given vertex is concrete (associated with a point). */ - bool is_concrete_vertex (const Vertex *v) const + bool is_concrete_vertex(const Vertex* v) const { return (! v->has_null_point()); } /*! Get the number of concrete vertices. */ - Size number_of_concrete_vertices () const + Size number_of_concrete_vertices() const { // All vertices not lying at infinity are concrete. return (this->m_dcel.size_of_vertices() - n_inf_verts); } /*! Check if the given vertex is valid (not a fictitious one). */ - bool is_valid_vertex (const Vertex *v) const + bool is_valid_vertex(const Vertex* v) const { return (! v->has_null_point() || (v != v_bl && v != v_tl && v != v_br && v != v_tr)); } /*! Get the number of valid vertices. */ - Size number_of_valid_vertices () const + Size number_of_valid_vertices() const { // All vertices, except the four fictitious one, are valid. return (this->m_dcel.size_of_vertices() - 4); } /*! Check if the given halfedge is valid (not a fictitious one). */ - bool is_valid_halfedge (const Halfedge *he) const + bool is_valid_halfedge(const Halfedge* he) const { return (! he->has_null_curve()); } /*! Get the number of valid halfedges. */ - Size number_of_valid_halfedges () const + Size number_of_valid_halfedges() const { // Note that we do not count fictitious halfedges (each vertex at infinity // induces two fictitious halfedges). @@ -209,13 +203,13 @@ public: } /*! Check if the given face is valid (not a fictitious one). */ - bool is_valid_face (const Face *f) const + bool is_valid_face (const Face* f) const { return (! f->is_fictitious()); } /*! Get the number of valid faces. */ - Size number_of_valid_faces () const + Size number_of_valid_faces() const { // We do not count the ficitious DCEL face. return (this->m_dcel.size_of_faces() - 1); @@ -223,16 +217,14 @@ public: //@} private: - /// \name Auxiliary type definitions. //@{ - typedef Arrangement_on_surface_2 Arr; + typedef Arrangement_on_surface_2 Arr; // Type definition for the constuction sweep-line visitor. typedef Arr_construction_subcurve CSubcurve; - typedef Arr_construction_event CEvent; + typedef Arr_construction_event + CEvent; typedef Arr_unb_planar_construction_helper BInsTraits; typedef Arr_construction_subcurve BISubcurve; - typedef Arr_construction_event BIEvent; - typedef Arr_unb_planar_insertion_helper BIHelper; + typedef Arr_construction_event + BIEvent; + typedef Arr_unb_planar_insertion_helper + BIHelper; // Type definition for the insertion sweep-line visitor. typedef Arr_insertion_traits_2 InsTraits; typedef Arr_construction_subcurve ISubcurve; - typedef Arr_construction_event IEvent; - typedef Arr_unb_planar_insertion_helper IHelper; + typedef Arr_construction_event + IEvent; + typedef Arr_unb_planar_insertion_helper + IHelper; // Type definition for the batched point-location sweep-line visitor. typedef Arr_batched_point_location_traits_2 BplTraits; @@ -292,15 +278,12 @@ private: typedef typename Base::Subcurve Subcurve; typedef typename Base::Construction_helper Construction_helper; - _Overlay_helper (const ArrangementA_ *arrA, - const ArrangementB_ *arrB) : - Base (arrA, arrB) - {} + _Overlay_helper(const ArrangementA_* arrA, const ArrangementB_* arrB) : + Base(arrA, arrB) {} }; //@} public: - ///! \name Visitor types. //@{ @@ -338,17 +321,16 @@ public: public Arr_vert_decomp_sl_visitor { typedef OutputIterator_ Output_iterator; - typedef Arr_vert_decomp_sl_visitor Base; + typedef Arr_vert_decomp_sl_visitor + Base; typedef typename Base::Traits_2 Traits_2; typedef typename Base::Event Event; typedef typename Base::Subcurve Subcurve; - Sweep_line_vertical_decomposition_visitor (const Arr *arr, - Output_iterator *oi) : - Base (arr, oi) - {} + Sweep_line_vertical_decomposition_visitor(const Arr* arr, + Output_iterator* oi) : + Base(arr, oi) {} }; template @@ -381,11 +363,11 @@ public: typedef typename Base::Event Event; typedef typename Base::Subcurve Subcurve; - Sweep_line_overlay_visitor (const ArrangementA_2 *arrA, - const ArrangementB_2 *arrB, - Arrangement_result_2 *arr_res, - Overlay_traits *overlay_tr) : - Base (arrA, arrB, arr_res, overlay_tr) + Sweep_line_overlay_visitor(const ArrangementA_2* arrA, + const ArrangementB_2* arrB, + Arrangement_result_2* arr_res, + Overlay_traits* overlay_tr) : + Base(arrA, arrB, arr_res, overlay_tr) {} }; From e6839a652c20645b096435445543a3c82074076e Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Fri, 6 Dec 2013 01:57:27 +0200 Subject: [PATCH 42/50] cleaned up destructors --- .../Arr_bounded_planar_topology_traits_2.h | 10 ++++------ .../CGAL/Arr_spherical_topology_traits_2.h | 5 ++++- .../Arr_spherical_topology_traits_2_impl.h | 16 +++++++++++++++- .../Arrangement_on_surface_2_impl.h | 18 ++++++++---------- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h index 74293d56df2..77fc366bc1b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h @@ -107,7 +107,6 @@ public: }; protected: - // Data members: Face* unb_face; // The unbounded face. @@ -116,7 +115,6 @@ protected: Self& operator=(const Self&); public: - ///! \name Construction methods. //@{ @@ -126,9 +124,9 @@ public: unb_face(NULL) {} - /*! Constructor with a geometry-traits class. */ - Arr_bounded_planar_topology_traits_2(const Geometry_traits_2* tr) : - Base(tr), + /*! Constructor from a geometry-traits object. */ + Arr_bounded_planar_topology_traits_2(const Geometry_traits_2* traits) : + Base(traits), unb_face(NULL) {} @@ -148,7 +146,7 @@ public: } /*! Check if the given vertex is concrete (associated with a point). */ - inline bool is_concrete_vertex (const Vertex*) const { return true; } + inline bool is_concrete_vertex(const Vertex*) const { return true; } /*! Get the number of concrete vertices. */ Size number_of_concrete_vertices() const diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h index 29a7debc37a..3433064bcec 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h @@ -192,11 +192,14 @@ public: /*! Default constructor. */ Arr_spherical_topology_traits_2(); - /*! Constructor with a geometry-traits class. + /*! Constructor from a geometry-traits object. * \param traits the traits. */ Arr_spherical_topology_traits_2(const Geometry_traits_2* traits); + /*! Destructor */ + ~Arr_spherical_topology_traits_2(); + /*! Assign the contents of another topology-traits class. * \param other the other spherical topology-traits. */ diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h index f59e956985e..0630b9d36a3 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h @@ -41,7 +41,7 @@ Arr_spherical_topology_traits_2() : m_boundary_vertices = Vertex_map(Vertex_key_comparer(m_geom_traits)); } -/*! \brief constructs with a geometry-traits class */ +/*! \brief constructs from a geometry-traits object. */ template Arr_spherical_topology_traits_2:: Arr_spherical_topology_traits_2(const Geometry_traits_2* traits) : @@ -54,6 +54,20 @@ Arr_spherical_topology_traits_2(const Geometry_traits_2* traits) : m_boundary_vertices = Vertex_map(Vertex_key_comparer(m_geom_traits)); } +/*! \brief destructs */ +template +Arr_spherical_topology_traits_2:: +~Arr_spherical_topology_traits_2() +{ + // Clear the DCEL. + m_dcel.delete_all(); + + if (m_own_geom_traits && (m_geom_traits != NULL)) { + delete m_geom_traits; + m_geom_traits = NULL; + } +} + /*! \brief assigns the contents of another topology-traits class */ template void Arr_spherical_topology_traits_2:: diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h index 67020f172bd..a74063e67ba 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h @@ -189,16 +189,13 @@ void Arrangement_on_surface_2::assign(const Self& arr) } // Go over the edge and create duplicates of the stored curves. - X_monotone_curve_2* dup_cv; - DHalfedge* p_e; - typename Dcel::Edge_iterator eit; for (eit = _dcel().edges_begin(); eit != _dcel().edges_end(); ++eit) { - p_e = &(*eit); + DHalfedge* p_e = &(*eit); if (! p_e->has_null_curve()) { // Create the duplicate curve and store it in the curves container. - dup_cv = _new_curve(p_e->curve()); + X_monotone_curve_2* dup_cv = _new_curve(p_e->curve()); // Associate the halfedge (and its twin) with the duplicated curve. p_e->set_curve(dup_cv); @@ -206,8 +203,10 @@ void Arrangement_on_surface_2::assign(const Self& arr) } // Take care of the traits object. - if (m_own_traits && m_geom_traits != NULL) + if (m_own_traits && (m_geom_traits != NULL)) { delete m_geom_traits; + m_geom_traits = NULL; + } m_geom_traits = (arr.m_own_traits) ? new Traits_adaptor_2 : arr.m_geom_traits; m_own_traits = arr.m_own_traits; @@ -234,12 +233,11 @@ Arrangement_on_surface_2::~Arrangement_on_surface_2() if (! eit->has_null_curve()) _delete_curve(eit->curve()); - // Clear the DCEL. - _dcel().delete_all(); - // Free the traits object, if necessary. - if (m_own_traits) + if (m_own_traits && (m_geom_traits != NULL)) { delete m_geom_traits; + m_geom_traits = NULL; + } // Detach all observers still attached to the arrangement. Observers_iterator iter = m_observers.begin(); From d92ba7cb5b492387c42f481d7813aacddcfb738b Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Fri, 6 Dec 2013 12:42:36 +0200 Subject: [PATCH 43/50] removed unnecessary new (resolved leak). --- .../Gps_on_surface_base_2_impl.h | 134 +++++++++--------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2_impl.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2_impl.h index bdcf32a3221..f663060e758 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2_impl.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2_impl.h @@ -13,20 +13,20 @@ // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL$ -// $Id$ -// +// $Id$ +// // // Author(s) : Baruch Zukerman // Efi Fogel // Ophir Setter -// Guy Zucker +// Guy Zucker #ifndef CGAL_GPS_ON_SURFACE_BASE_2_IMPL_H #define CGAL_GPS_ON_SURFACE_BASE_2_IMPL_H #include #include -#include +#include #include #include @@ -38,7 +38,7 @@ void Gps_on_surface_base_2:: construct_polygon(Ccb_halfedge_const_circulator ccb, Polygon_2 & pgn, Traits_ * tr) { - typedef CGAL::Ccb_curve_iterator + typedef CGAL::Ccb_curve_iterator Ccb_curve_iterator; Ccb_curve_iterator begin(ccb, false); Ccb_curve_iterator end(ccb, true); @@ -52,7 +52,7 @@ construct_polygon(Ccb_halfedge_const_circulator ccb, Polygon_2 & pgn, // arrangement. // This scanner is not the same as the Gps_bfs_scanner. In this file, the // Gps_bfs_scanner is used with Init_faces_visitor to init the faces of the -// representing arrangement. +// representing arrangement. // It seems that Gps_bfs_scanner is used for a regular bfs scan on the faces // of the arrangements, with comparison to Arr_bfs_scanner that cares about // inner ccbs and outer ccbs (it treats them differently). @@ -66,13 +66,13 @@ public: typedef typename Arrangement::Topology_traits Gps_top_traits; typedef typename Gps_traits::Polygon_2 Polygon_2; typedef typename Gps_traits::Polygon_with_holes_2 Polygon_with_holes_2; - typedef typename Arrangement::Ccb_halfedge_const_circulator + typedef typename Arrangement::Ccb_halfedge_const_circulator Ccb_halfedge_const_circulator; typedef typename Arrangement::Face_const_iterator Face_const_iterator; typedef typename Arrangement::Halfedge_const_iterator Halfedge_const_iterator; - typedef typename Arrangement::Outer_ccb_const_iterator + typedef typename Arrangement::Outer_ccb_const_iterator Outer_ccb_const_iterator; - typedef typename Arrangement::Inner_ccb_const_iterator + typedef typename Arrangement::Inner_ccb_const_iterator Inner_ccb_const_iterator; @@ -88,7 +88,7 @@ public: /*! Constructor */ Arr_bfs_scanner(Gps_traits* tr, OutputIterator oi) : m_traits(tr), m_oi(oi) {} - + void scan(Arrangement& arr) { @@ -99,7 +99,7 @@ public: continue; if (ubf->visited()) continue; - + Inner_ccb_const_iterator holes_it; if (!ubf->contained()) { @@ -114,9 +114,9 @@ public: { // ubf is contained -> unbounded polygon !! scan_contained_ubf(ubf); - + } - + while(!m_holes_q.empty()) { Face_const_iterator top_f = m_holes_q.front(); @@ -127,7 +127,7 @@ public: { scan_ccb(*holes_it); } - + //scan_uncontained_face(top_f->outer_ccb()); } } @@ -146,7 +146,7 @@ public: void scan_ccb(Ccb_halfedge_const_circulator ccb) { - + Polygon_2 pgn_boundary; Gps_on_surface_base_2:: construct_polygon(ccb, pgn_boundary, m_traits); @@ -160,7 +160,7 @@ public: ++ccb; } while(ccb != ccb_end); - Polygon_with_holes_2 pgn = + Polygon_with_holes_2 pgn = m_traits->construct_polygon_with_holes_2_object()(pgn_boundary, m_pgn_holes.begin(), m_pgn_holes.end()); @@ -178,7 +178,7 @@ public: // ubf is contained -> unbounded polygon !! all_incident_faces(ubf); Polygon_2 boundary; - Polygon_with_holes_2 pgn = + Polygon_with_holes_2 pgn = m_traits->construct_polygon_with_holes_2_object()(boundary, m_pgn_holes.begin(), m_pgn_holes.end()); @@ -206,18 +206,18 @@ public: Gps_on_surface_base_2:: construct_polygon(*oci, m_pgn_holes.back(), m_traits); } - + m_holes_q.push(f); } - + for (Outer_ccb_const_iterator oci = f->outer_ccbs_begin(); oci != f->outer_ccbs_end(); ++oci) { Ccb_halfedge_const_circulator ccb_end = *oci; Ccb_halfedge_const_circulator ccb_circ = ccb_end; do - { + { //get the current halfedge on the face boundary Halfedge_const_iterator he = ccb_circ; Face_const_iterator new_f = he->twin()->face(); @@ -241,7 +241,7 @@ public: if (is_single_face(ccb_of_hole)) { CGAL_assertion(!he->twin()->face()->contained()); - + m_pgn_holes.push_back(Polygon_2()); Gps_on_surface_base_2:: construct_polygon(he->twin()->face()->outer_ccb(), @@ -271,7 +271,7 @@ public: Halfedge_const_iterator he = ccb; Face_const_iterator curr_f = he->twin()->face(); do - { + { //get the current halfedge on the face boundary Halfedge_const_iterator he = ccb_circ; if (he->twin()->face() != curr_f) @@ -291,19 +291,19 @@ class Init_faces_visitor { typedef typename Arrangement::Face_iterator Face_iterator; typedef typename Arrangement::Halfedge_iterator Halfedge_iterator; - + public: //! discovered_face -/*! discovered_face is called by Gps_bfs_scanner when it reveals a new face +/*! discovered_face is called by Gps_bfs_scanner when it reveals a new face during a BFS scan. It is important to say that I have a strong suspition - that this place is the reason why discovered_face was once called + that this place is the reason why discovered_face was once called "flip_face" (WTF?) \param old_f The face that was already revealed \param new_f The face that we have just now revealed */ - void discovered_face(Face_iterator old_f, - Face_iterator new_f, + void discovered_face(Face_iterator old_f, + Face_iterator new_f, Halfedge_iterator /*he*/) { new_f->set_contained(!old_f->contained()); @@ -311,9 +311,9 @@ public: }; //! _insert -/*! The function inserts a polygon into an arrangement, assuming that the +/*! The function inserts a polygon into an arrangement, assuming that the polygon is contained in one face of the arrangement. - \param pgn The polygon to be inserted to the arrangement. pgn must be + \param pgn The polygon to be inserted to the arrangement. pgn must be completely disjoint from the arrangement \param arr The arrangement to insert the polygon to. */ @@ -339,7 +339,7 @@ _insert(const Polygon_2& pgn, Arrangement_on_surface_2 & arr) m_traits_adaptor.parameter_space_in_x_2_object()(*curr, ARR_MIN_END); const Arr_parameter_space ps_y = m_traits_adaptor.parameter_space_in_y_2_object()(*curr, ARR_MIN_END); - + Object obj_f; if ((ps_x == ARR_INTERIOR) && (ps_y == ARR_INTERIOR)) { @@ -357,11 +357,11 @@ _insert(const Polygon_2& pgn, Arrangement_on_surface_2 & arr) CGAL_assertion(CGAL::assign(const_f, obj_f) && !const_f->contained()); CGAL::assign(const_f, obj_f); Face_iterator f = arr.non_const_handle(const_f); - - Halfedge_handle first_he = + + Halfedge_handle first_he = arr.insert_in_face_interior(*curr, f); //first_he is directed from left to right (see insert_in_face_interior) - + Halfedge_handle curr_he; if (cmp_ends(*curr) == CGAL::SMALLER) { @@ -381,7 +381,7 @@ _insert(const Polygon_2& pgn, Arrangement_on_surface_2 & arr) if (temp == end) // a polygon with circular arcs may have only // two edges (full circle for example) { - /*Halfedge_handle he = + /*Halfedge_handle he = arr.insert_at_vertices(*temp, curr_he, first_he);*/ bool new_face_created = false; bool dummy_swapped_predecessors = false; @@ -392,10 +392,10 @@ _insert(const Polygon_2& pgn, Arrangement_on_surface_2 & arr) dummy_swapped_predecessors); // TODO EBEB 2012-08-06 do we have to care if order has been swapped, // or do we have to disallow swapping? - - CGAL_assertion(new_face_created); + + CGAL_assertion(new_face_created); CGAL_assertion((he->face() != he->twin()->face())); - + he->face()->set_contained(true); return; } @@ -420,7 +420,7 @@ _insert(const Polygon_2& pgn, Arrangement_on_surface_2 & arr) arr.insert_at_vertices(last_cv, curr_he, first_he); */ bool new_face_created = false; bool dummy_swapped_predecessors = false; - Halfedge_handle last_he = + Halfedge_handle last_he = accessor.insert_at_vertices_ex (curr_he, last_cv, ( cmp_ends(last_cv) == CGAL::SMALLER ? ARR_LEFT_TO_RIGHT : ARR_RIGHT_TO_LEFT), first_he->next(), @@ -429,9 +429,9 @@ _insert(const Polygon_2& pgn, Arrangement_on_surface_2 & arr) // TODO EBEB 2012-08-06 do we have to care if order has been swapped, // or do we have to disallow swapping? - CGAL_assertion(new_face_created); + CGAL_assertion(new_face_created); CGAL_assertion((last_he->face() != last_he->twin()->face())); - + last_he->face()->set_contained(true); } @@ -442,7 +442,7 @@ template insert(PolygonIter p_begin, PolygonIter p_end) { typename std::iterator_traits::value_type pgn; - //check validity of all polygons + //check validity of all polygons for( ; p_begin != p_end; ++p_begin) { ValidationPolicy::is_valid(*p_begin, *m_traits); @@ -462,7 +462,7 @@ template typedef Gps_bfs_scanner Arr_bfs_scanner; XCurveList xcurve_list; - + for( ; p_begin != p_end; ++p_begin) { ValidationPolicy::is_valid(*p_begin, *m_traits); @@ -500,7 +500,7 @@ template template void Gps_on_surface_base_2:: _insert(PolygonIter p_begin, PolygonIter p_end, Polygon_2 & /*pgn*/) -{ +{ for(PolygonIter pitr = p_begin; pitr != p_end; ++pitr) { this->_insert(*pitr, *m_arr); @@ -511,7 +511,7 @@ template template void Gps_on_surface_base_2:: _insert(PolygonIter p_begin, PolygonIter p_end, Polygon_with_holes_2 & /*pgn*/) -{ +{ typedef std::list XCurveList; typedef Init_faces_visitor My_visitor; typedef Gps_bfs_scanner Arr_bfs_scanner; @@ -521,7 +521,7 @@ template for( ; p_begin != p_end; ++p_begin) { // is_unbounded = (is_unbounded || p_begin->is_unbounded()); - is_unbounded = (is_unbounded || m_traits->construct_is_unbounded_object()(*p_begin)); + is_unbounded = (is_unbounded || m_traits->construct_is_unbounded_object()(*p_begin)); _construct_curves(*p_begin, std::back_inserter(xcurve_list)); } @@ -549,7 +549,7 @@ template void Gps_on_surface_base_2:: _insert(const Polygon_with_holes_2 & pgn, Arrangement_on_surface_2 & arr) { - // inner function not exposed to user - no validation + // inner function not exposed to user - no validation // ValidationPolicy::is_valid(pgn, *m_traits); typedef std::list XCurveList; @@ -561,9 +561,9 @@ template insert_non_intersecting_curves(arr, xcurve_list.begin(), xcurve_list.end()); //if (pgn.is_unbounded()) - if (m_traits->construct_is_unbounded_object()(pgn)) + if (m_traits->construct_is_unbounded_object()(pgn)) { - for (Face_iterator fit = arr.faces_begin(); + for (Face_iterator fit = arr.faces_begin(); fit != arr.faces_end(); ++fit) { if (fit->number_of_outer_ccbs() == 0) @@ -579,7 +579,7 @@ template template template - void + void Gps_on_surface_base_2:: _construct_curves(const Polygon_2 & pgn, OutputIterator oi) { @@ -599,11 +599,11 @@ template { const Polygon_2& pgn_boundary = m_traits->construct_outer_boundary_object ()(pgn); std::pair itr_pair = + Curve_const_iterator> itr_pair = m_traits->construct_curves_2_object()(pgn_boundary); std::copy (itr_pair.first, itr_pair.second, oi); } - std::pair hpair = + std::pair hpair = m_traits->construct_holes_object()(pgn); GP_Holes_const_iterator hit; for (hit = hpair.first; hit != hpair.second; ++hit) @@ -630,16 +630,16 @@ template template - typename Gps_on_surface_base_2::Size + typename Gps_on_surface_base_2::Size Gps_on_surface_base_2:: number_of_polygons_with_holes() const { - + typedef Arr_bfs_scanner Arr_bfs_scanner; - //counting_output_operator CTOR reqires a parameter - std::size_t *cc = new size_t(); - Arr_bfs_scanner scanner(this->m_traits, Counting_output_iterator(cc)); + //counting_output_operator CTOR reqires a parameter + std::size_t cc = 0; + Arr_bfs_scanner scanner(this->m_traits, Counting_output_iterator(&cc)); scanner.scan(*(this->m_arr)); return (scanner.output_iterator().current_counter()); } @@ -693,15 +693,15 @@ template OutputItr oi (pgn); Arr_bfs_scanner scanner(this->m_traits, oi); - - + + Ccb_halfedge_const_circulator ccb_of_pgn = get_boundary_of_polygon(f); this->_reset_faces(); - if (ccb_of_pgn == Ccb_halfedge_const_circulator()) + if (ccb_of_pgn == Ccb_halfedge_const_circulator()) { // the polygon has no boundary - // f is unbounded + // f is unbounded for (Face_iterator fit = m_arr->faces_begin(); fit != m_arr->faces_end(); ++fit) { @@ -728,7 +728,7 @@ template { CGAL_assertion(!f->visited()); f->set_visited(true); - + if (f->number_of_outer_ccbs() == 0) // (f->is_unbounded()) { return Ccb_halfedge_const_circulator(); @@ -736,18 +736,18 @@ template // We assume that a polygon has only one outer_ccb. This code does not handle // the case where there are more than 1 outer ccbs. If this is the case, we - // need to devise a method to convert the outer ccbs to inner ccbs so we + // need to devise a method to convert the outer ccbs to inner ccbs so we // will have only one outer ccb. if (f->number_of_outer_ccbs() > 1) CGAL_error_msg("Not implemented yet."); - // Some compilers (VC 9) do not like that we directly access the ccb_circ. So we have - // to pass through the iterator. + // Some compilers (VC 9) do not like that we directly access the ccb_circ. So we have + // to pass through the iterator. Outer_ccb_const_iterator oci_temp = f->outer_ccbs_begin(); Ccb_halfedge_const_circulator ccb_end = *oci_temp; Ccb_halfedge_const_circulator ccb_circ = ccb_end; do - { + { //get the current halfedge on the face boundary Halfedge_const_iterator he = ccb_circ; Face_const_iterator new_f = he->twin()->face(); @@ -762,7 +762,7 @@ template while(ccb_circ != ccb_end); CGAL_error(); return Ccb_halfedge_const_circulator(); - + } template @@ -770,7 +770,7 @@ template is_hole_of_face(Face_const_handle f, Halfedge_const_handle he) const { Inner_ccb_const_iterator holes_it; - for (holes_it = f->inner_ccbs_begin(); + for (holes_it = f->inner_ccbs_begin(); holes_it != f->inner_ccbs_end(); ++holes_it) { Ccb_halfedge_const_circulator ccb = *holes_it; From 6af55c497806532be6a51cfa6028e858fd06ebb2 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Fri, 6 Dec 2013 13:15:13 +0200 Subject: [PATCH 44/50] Resolved min/max issue with msvc --- .../PointsGraphicsItem.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp index 1b7c8435dbf..86eadd35361 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp @@ -53,19 +53,19 @@ QRectF PointsGraphicsItem::boundingRect( ) const { return QRectF( ); } - double xmin = std::numeric_limits< double >::max( ); - double xmax = -std::numeric_limits< double >::max( ); - double ymin = std::numeric_limits< double >::max( ); - double ymax = -std::numeric_limits< double >::max( ); - for ( unsigned int i = 0; i < this->points.size( ); ++i ) + double xmin = (std::numeric_limits< double >::max)( ); + double xmax = -(std::numeric_limits< double >::max)( ); + double ymin = (std::numeric_limits< double >::max)( ); + double ymax = -(std::numeric_limits< double >::max)( ); + for ( unsigned int i = 0; i < this->points.size(); ++i ) { QPointF pt = this->points[ i ]; double x = pt.x( ); double y = pt.y( ); - xmin = std::min( xmin, x ); - xmax = std::max( xmax, x ); - ymin = std::min( ymin, y ); - ymax = std::max( ymax, y ); + xmin = (std::min)( xmin, x ); + xmax = (std::max)( xmax, x ); + ymin = (std::min)( ymin, y ); + ymax = (std::max)( ymax, y ); } QRectF res( QPointF( xmin, ymin ), QPointF( xmax, ymax ) ); res.adjust( -5, -5, 5, 5 ); // pad the borders a bit From 7af4a1e05a7082ff58b331200af8640fe4f380b2 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Fri, 6 Dec 2013 16:09:38 +0200 Subject: [PATCH 45/50] Added destructor --- .../Gps_polygon_simplifier.h | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h index 49a1c1a6cee..7fcc4639f65 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_polygon_simplifier.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Baruch Zukerman @@ -30,9 +30,9 @@ #include #include -#include +#include #include -#include +#include namespace CGAL { @@ -55,11 +55,11 @@ class Gps_polygon_simplifier typedef typename Arrangement_2::Face_iterator Face_iterator; typedef typename Arrangement_2::Edge_iterator Edge_iterator; typedef typename Arrangement_2::Vertex_handle Vertex_handle; - typedef typename Arrangement_2::Ccb_halfedge_const_circulator + typedef typename Arrangement_2::Ccb_halfedge_const_circulator Ccb_halfedge_const_circulator; - typedef typename Arrangement_2::Ccb_halfedge_circulator + typedef typename Arrangement_2::Ccb_halfedge_circulator Ccb_halfedge_circulator; - typedef Arr_construction_subcurve Subcurve; + typedef Arr_construction_subcurve Subcurve; typedef Arr_construction_event Event; @@ -74,10 +74,10 @@ class Gps_polygon_simplifier Subcurve, Event> Sweep_line_2; - typedef Unique_hash_map Edges_hash; - typedef Unique_hash_map Faces_hash; typedef Gps_bfs_join_visitor Bfs_visitor; typedef Gps_bfs_scanner Bfs_scanner; @@ -85,6 +85,7 @@ class Gps_polygon_simplifier protected: Arrangement_2* m_arr; Meta_traits* m_traits; + bool m_own_traits; Visitor m_visitor; Sweep_line_2 m_sweep_line; Edges_hash m_edges_hash; // maps halfedge to its BC (boundary counter) @@ -92,18 +93,28 @@ protected: public: /*! Constructor. */ - Gps_polygon_simplifier (Arrangement_2& arr, Traits_2& tr) : - m_arr (&arr), + Gps_polygon_simplifier(Arrangement_2& arr, Traits_2& tr) : + m_arr(&arr), m_traits(new Meta_traits(tr)), - m_visitor (&arr, &m_edges_hash), - m_sweep_line (m_traits, &m_visitor) + m_own_traits(true), + m_visitor(&arr, &m_edges_hash), + m_sweep_line(m_traits, &m_visitor) {} + /*! Destructor. */ + ~Gps_polygon_simplifier() + { + if (m_own_traits && (m_traits != NULL)) { + delete m_traits; + m_traits = NULL; + } + } + void simplify(const Polygon_2& pgn) { - Construct_curves_2 ctr_curves = + Construct_curves_2 ctr_curves = reinterpret_cast(m_traits)->construct_curves_2_object(); - + std::list curves_list; std::pairset_polygon_size(static_cast(curves_list.size())); - + m_sweep_line.sweep(curves_list.begin(), curves_list.end()); // we use the first face with out outer ccbs. This assumpsion should @@ -129,8 +140,8 @@ public: if (it->number_of_outer_ccbs() == 0) break; CGAL_assertion(it != m_arr->faces_end()); - - m_faces_hash[it] = 0; + + m_faces_hash[it] = 0; Bfs_visitor visitor(&m_edges_hash, &m_faces_hash, 1); visitor.visit_ubf(it, 0); Bfs_scanner scanner(visitor); From bd9abb7f2f6911ec4646b00283d2bce51d54c826 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Fri, 6 Dec 2013 16:22:03 +0200 Subject: [PATCH 46/50] Eliminated warning messages by replacing typedefs --- .../internal_functions_on_line_arc_2.h | 185 +++++++++--------- 1 file changed, 92 insertions(+), 93 deletions(-) diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h index 94c1fe2b6ac..0fcb8b0f0bb 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h @@ -18,9 +18,9 @@ // Author(s) : Monique Teillaud, Sylvain Pion, Pedro Machado // Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (ECG - Effective Computational Geometry for Curves and Surfaces) -// and a STREP (FET Open) Project under Contract No IST-006413 +// RTD (FET Open) Project under Contract No IST-2000-26473 +// (ECG - Effective Computational Geometry for Curves and Surfaces) +// and a STREP (FET Open) Project under Contract No IST-006413 // (ACS -- Algorithms for Complex Shapes) #ifndef CGAL_CIRCULAR_KERNEL_PREDICATES_ON_LINE_ARC_2_H @@ -36,20 +36,20 @@ namespace CircularFunctors { template < class CK > bool point_in_x_range(const typename CK::Line_arc_2 &A, - const typename CK::Circular_arc_point_2 &p) + const typename CK::Circular_arc_point_2 &p) { // range includes endpoints here - return ( (CircularFunctors::compare_x(p, A.source()) != CircularFunctors::compare_x(p, A.target())) + return ( (CircularFunctors::compare_x(p, A.source()) != CircularFunctors::compare_x(p, A.target())) || (CircularFunctors::compare_x(p, A.source()) == CGAL::EQUAL) ); } - + template < class CK > bool equal(const typename CK::Line_arc_2 &A1, const typename CK::Line_arc_2 &A2) { if (!LinearFunctors::non_oriented_equal( - A1.supporting_line(),A2.supporting_line())) + A1.supporting_line(),A2.supporting_line())) return false; return ( (equal(A1.source(), A2.source()) && @@ -64,11 +64,11 @@ namespace CircularFunctors { const typename CK::Line_arc_2 &A2) { if (!LinearFunctors::non_oriented_equal( - A1.supporting_line(),A2.supporting_line())) + A1.supporting_line(),A2.supporting_line())) return false; return CircularFunctors::compare_xy(A1.right(), A2.left()) >= 0 - && CircularFunctors::compare_xy(A1.left(), A2.right()) <= 0; + && CircularFunctors::compare_xy(A1.left(), A2.right()) <= 0; } @@ -86,7 +86,7 @@ namespace CircularFunctors { if(!CGAL::LinearFunctors::has_on(a.supporting_line(),p)) return false; } - + return (CircularFunctors::compare_xy(p, a.source()) != CircularFunctors::compare_xy(p, a.target())); } @@ -134,7 +134,7 @@ namespace CircularFunctors { //general case typedef typename CK::Polynomial_1_2 Polynomial_1_2; typedef typename CK::Root_of_2 Root_of_2; - Polynomial_1_2 equation = + Polynomial_1_2 equation = CGAL::LinearFunctors::get_equation(A1.supporting_line()); Root_of_2 y((-p.x()*equation.a() - equation.c())/equation.b()); if (y == p.y()) @@ -145,9 +145,9 @@ namespace CircularFunctors { } template < class CK > - Comparison_result + Comparison_result compare_y_to_right(const typename CK::Line_arc_2 &A1, - const typename CK::Line_arc_2 &A2, + const typename CK::Line_arc_2 &A2, const typename CK::Circular_arc_point_2 &/*p*/) { if(A1.supporting_line().is_vertical()){ @@ -157,7 +157,7 @@ namespace CircularFunctors { } if(A2.supporting_line().is_vertical()) return CGAL::SMALLER; - + typedef typename CK::Polynomial_1_2 Polynomial_1_2; typedef typename CK::Root_of_2 Root_of_2; @@ -182,13 +182,13 @@ namespace CircularFunctors { return CGAL::SMALLER; return CGAL::LARGER; } - + } template < class CK > - Comparison_result + Comparison_result compare_y_to_right(const typename CK::Line_arc_2 &A1, - const typename CK::Circular_arc_2 &A2, + const typename CK::Circular_arc_2 &A2, const typename CK::Circular_arc_point_2 &p) { //CGAL_kernel_precondition (A2.is_x_monotone()); @@ -222,7 +222,7 @@ namespace CircularFunctors { tangent_2_y = -b2_x; } - Polynomial_1_2 equation = + Polynomial_1_2 equation = CGAL::LinearFunctors::get_equation(A1.supporting_line()); typedef typename CK::FT FT; FT tangent_1_x; @@ -235,10 +235,10 @@ namespace CircularFunctors { tangent_1_x = equation.b(); tangent_1_y = -equation.a(); } - - if (((tangent_1_x < 0) && (tangent_2_x > 0)) || + + if (((tangent_1_x < 0) && (tangent_2_x > 0)) || ((tangent_1_x > 0) && (tangent_2_x < 0))){ Root_of_2 prod_left = tangent_1_y * tangent_2_x; Root_of_2 prod_right = tangent_2_y * tangent_1_x; @@ -263,11 +263,11 @@ namespace CircularFunctors { } } - + template < class CK > - Comparison_result + Comparison_result compare_y_to_left(const typename CK::Line_arc_2 &A1, - const typename CK::Circular_arc_2 &A2, + const typename CK::Circular_arc_2 &A2, const typename CK::Circular_arc_point_2 &p) { //CGAL_kernel_precondition (A2.is_x_monotone()); @@ -291,7 +291,7 @@ namespace CircularFunctors { Root_of_2 tangent_2_x; Root_of_2 tangent_2_y; - if (b2_y < 0){ + if (b2_y < 0){ tangent_2_x = -b2_y; tangent_2_y = b2_x; } @@ -300,7 +300,7 @@ namespace CircularFunctors { tangent_2_y = -b2_x; } - Polynomial_1_2 equation = + Polynomial_1_2 equation = CGAL::LinearFunctors::get_equation(A1.supporting_line()); typedef typename CK::FT FT; FT tangent_1_x; @@ -313,10 +313,10 @@ namespace CircularFunctors { tangent_1_x = equation.b(); tangent_1_y = -equation.a(); } - - if (((tangent_1_x < 0) && (tangent_2_x > 0)) || + + if (((tangent_1_x < 0) && (tangent_2_x > 0)) || ((tangent_1_x > 0) && (tangent_2_x < 0))){ Root_of_2 prod_left = tangent_1_y * tangent_2_x; Root_of_2 prod_right = tangent_2_y * tangent_1_x; @@ -341,11 +341,11 @@ namespace CircularFunctors { } } - + template < class CK > - Comparison_result + Comparison_result compare_y_to_right(const typename CK::Circular_arc_2 &A1, - const typename CK::Line_arc_2 &A2, + const typename CK::Line_arc_2 &A2, const typename CK::Circular_arc_point_2 &p) { if (compare_y_to_right(A2, A1, p) == CGAL::LARGER) @@ -353,21 +353,21 @@ namespace CircularFunctors { return CGAL::LARGER; } - + template < class CK > void split(const typename CK::Line_arc_2 &A, const typename CK::Circular_arc_point_2 &p, typename CK::Line_arc_2 &ca1, typename CK::Line_arc_2 &ca2) - { + { CGAL_kernel_precondition( has_on(A, p)); - + typedef typename CK::Line_arc_2 Line_arc_2; ca1 = Line_arc_2( A.supporting_line(), A.source(), p); ca2 = Line_arc_2( A.supporting_line(), p, A.target()); - + if ( CircularFunctors::compare_xy(ca1.left(), ca2.left()) != SMALLER ) { std::swap(ca1,ca2); @@ -386,22 +386,22 @@ namespace CircularFunctors { ::type result_type; typedef typename CK::Algebraic_kernel AK; typedef typename CK::Polynomial_1_2 Equation_line; - typedef typename CK::Polynomial_for_circles_2_2 Equation_circle; + typedef typename CK::Polynomial_for_circles_2_2 Equation_circle; typedef typename CK::Root_for_circles_2_2 Root_for_circles_2_2; - + Equation_line e1 = CK().get_equation_object()(l); Equation_circle e2 = CK().get_equation_object()(c); - - typedef std::vector< std::pair < Root_for_circles_2_2, unsigned > > + + typedef std::vector< std::pair < Root_for_circles_2_2, unsigned > > solutions_container; solutions_container solutions; - AK().solve_object()(e1, e2, std::back_inserter(solutions)); + AK().solve_object()(e1, e2, std::back_inserter(solutions)); // to be optimized typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - for ( typename solutions_container::iterator it = solutions.begin(); + for ( typename solutions_container::iterator it = solutions.begin(); it != solutions.end(); ++it ) { *res++ = CGAL::internal::ck2_intersection_return @@ -432,7 +432,7 @@ namespace CircularFunctors { if((a1s_a2s && a1t_a2t) || (a1s_a2t && a1t_a2s)){ - *res++ = result_type(a1); + *res++ = result_type(a1); return res; } if(a1s_a2s || a1s_a2t || a1t_a2s || a1t_a2t) { @@ -443,7 +443,7 @@ namespace CircularFunctors { } } #endif - + if(LinearFunctors::non_oriented_equal( a1.supporting_line(),a2.supporting_line())) { if(compare_xy(a1.left(),a2.left()) < 0) { @@ -482,7 +482,7 @@ namespace CircularFunctors { return res; } } - + typename Intersection_traits::result_type v = CGAL::internal::intersection(a1.supporting_line(), a2.supporting_line(), CK()); if(!v) return res; @@ -491,7 +491,7 @@ namespace CircularFunctors { if(pt == NULL) return res; Circular_arc_point_2 intersect_point = Circular_arc_point_2(*pt); // (Root_for_circles_2_2(Root_of_2(pt->x()),Root_of_2(pt->y()))); - + if ((CircularFunctors::compare_xy(intersect_point, a1.source()) != CircularFunctors::compare_xy(intersect_point, a1.target())) && (CircularFunctors::compare_xy(intersect_point, a2.source()) != @@ -515,15 +515,15 @@ namespace CircularFunctors { intersect_2( const typename CK::Line_arc_2 &l, const typename CK::Circle_2 &c, OutputIterator res ) - { - typedef std::vector::type> + { + typedef std::vector::type> solutions_container; solutions_container solutions; CircularFunctors::intersect_2 ( l.supporting_line(), c, std::back_inserter(solutions) ); - - for (typename solutions_container::iterator it = solutions.begin(); + + for (typename solutions_container::iterator it = solutions.begin(); it != solutions.end(); ++it) { #if CGAL_INTERSECTION_VERSION < 2 if(const std::pair* p = @@ -547,7 +547,7 @@ namespace CircularFunctors { intersect_2( const typename CK::Circle_2 &c, const typename CK::Line_arc_2 &l, OutputIterator res ) - { + { return intersect_2(l,c,res); } @@ -558,19 +558,18 @@ namespace CircularFunctors { OutputIterator res ) { typedef std::vector solutions_container; - typedef typename CK2_Intersection_traits - ::type result_type; - typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Line_arc_2 Line_arc_2; #ifdef CGAL_CK_EXPLOIT_IDENTITY - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + typedef typename CK::Circular_arc_2 Circular_arc_2; + typedef typename CK2_Intersection_traits + ::type result_type; bool ls_cs = l.source().equal_ref(c.source()); bool ls_ct = l.source().equal_ref(c.target()); bool lt_cs = l.target().equal_ref(c.source()); bool lt_ct = l.target().equal_ref(c.target()); - + if((ls_cs && lt_ct) || (ls_ct && lt_cs)){ // Case 0 if (compare_xy(l.source(), l.target()) == SMALLER){ *res++ = result_type(std::make_pair(l.source(), 1u)); @@ -582,7 +581,7 @@ namespace CircularFunctors { return res; } else if (ls_cs || lt_ct || ls_ct || lt_cs) { Circular_arc_point_2 p,q,r; - + if(ls_cs){ p = l.target(); q = l.source(); @@ -600,7 +599,7 @@ namespace CircularFunctors { q = l.target(); r = c.source(); } - + if( (CircularFunctors::compare_x(p,q) == EQUAL) || CircularFunctors::point_in_x_range(p,r,q)){ // Case 1 *res++ = result_type(std::make_pair(q,1u)); return res; @@ -614,7 +613,7 @@ namespace CircularFunctors { } } else { if(CircularFunctors::orientation(r,q,p) == RIGHT_TURN // Case 2 - || CircularFunctors::compare_y_to_left(l,c,q) == LARGER){ // Case 3c + || CircularFunctors::compare_y_to_left(l,c,q) == LARGER){ // Case 3c *res++ = result_type(std::make_pair(q,1u)); return res; } @@ -625,27 +624,27 @@ namespace CircularFunctors { || CircularFunctors::compare_y_to_right(l,c,q) == SMALLER){ // Case 3b *res++ = result_type(std::make_pair(q,1u)); return res; - } + } } else { if(CircularFunctors::orientation(r,q,p) == LEFT_TURN - || CircularFunctors::compare_y_to_left(l,c,q) == SMALLER){ // Case 3d + || CircularFunctors::compare_y_to_left(l,c,q) == SMALLER){ // Case 3d *res++ = result_type(std::make_pair(q,1u)); return res; - } - } + } + } } - + typename CK::Linear_kernel::Bounded_side bs = CircularFunctors::bounded_side(c.supporting_circle(),p); - if(bs == ON_BOUNDED_SIDE){ + if(bs == ON_BOUNDED_SIDE){ *res++ = result_type(std::make_pair(q,1u)); return res; } else { //Case 4b - typedef std::vector::type> + typedef std::vector::type> container; container solutions; CGAL::CircularFunctors::intersect_2( l.supporting_line(), c.supporting_circle(), std::back_inserter(solutions) ); - + if(CircularFunctors::compare_x(r,q) == LARGER){ *res++ = result_type(std::make_pair(q,1u)); *res++ = solutions.back(); @@ -655,31 +654,30 @@ namespace CircularFunctors { *res++ = result_type(std::make_pair(q,1u)); return res; } - + } // Case 4b - - + + std::cout << "oops we missed a case" << std::endl; - + } #endif // CGAL_CK_EXPLOIT_IDENTITY - + typedef std::vector solutions_container; solutions_container solutions; #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES - typedef typename CK::Line_arc_2 Line_arc_2; - if(!Line_arc_2::template - find_intersection_circle_line< solutions_container > - (c,l,solutions)) { + if(!Line_arc_2::template + find_intersection_circle_line< solutions_container > + (c,l,solutions)) { #endif CGAL::CircularFunctors::intersect_2 ( l.supporting_line(), c.supporting_circle(), std::back_inserter(solutions) ); - + #ifdef CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES - Line_arc_2::template + Line_arc_2::template put_intersection_circle_line< std::vector < CGAL::Object > > (c,l,solutions); } @@ -687,18 +685,18 @@ namespace CircularFunctors { for (typename solutions_container::iterator it = solutions.begin(); it != solutions.end(); ++it) { - const std::pair + const std::pair *result = CGAL::object_cast - > (&(*it)); + > (&(*it)); #ifdef CGAL_CK_TEST_BBOX_BEFORE_HAS_ON Bbox_2 rb = result->first.bbox(); if(do_overlap(l.bbox(), rb) && do_overlap(c.bbox(),rb)){ - if (has_on(l,result->first,true) && + if (has_on(l,result->first,true) && has_on(c,result->first,true)) { *res++ = *it; } } -#else +#else if (has_on(l,result->first,true) && has_on(c,result->first,true)) { *res++ = *it; @@ -719,28 +717,28 @@ namespace CircularFunctors { { typedef typename CK::Circular_arc_2 Circular_arc_2; typedef std::vector solutions_container; - + solutions_container solutions; CGAL::LinearFunctors::intersect_2 - ( l.supporting_line(), c.supporting_circle(), + ( l.supporting_line(), c.supporting_circle(), std::back_inserter(solutions) ); - + solutions_container objects_monotone; - std::vector arcs_x_monotone; + std::vector arcs_x_monotone; make_x_monotone( c, std::back_inserter(objects_monotone)); for(typename solutions_container::iterator it2 = objects_monotone.begin(); it2 != objects_monotone.end(); ++it2){ arcs_x_monotone.push_back(CGAL::object_cast(&(*it2))); } - - for (typename solutions_container::iterator it = solutions.begin(); + + for (typename solutions_container::iterator it = solutions.begin(); it != solutions.end(); ++it){ const std::pair *result; result = CGAL::object_cast > (&(*it)); if ( has_on(l,result->first)) { bool is_on_arc = false; - for(typename std::vector::iterator + for(typename std::vector::iterator it2 = arcs_x_monotone.begin(); it2 != arcs_x_monotone.end(); ++it2){ if(has_on(**it2, result->first)){ @@ -770,8 +768,8 @@ namespace CircularFunctors { if(LinearFunctors::non_oriented_equal(l, la.supporting_line())) { *res++ = result_type(la); } - - typename Intersection_traits::result_type + + typename Intersection_traits::result_type v = intersection(l, la.supporting_line()); if(!v) return res; @@ -797,7 +795,8 @@ namespace CircularFunctors { typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_2 Line_2; - typedef std::vector< typename CK2_Intersection_traits::type> + typedef typename CK::Circle_2 Circle_2; + typedef std::vector< typename CK2_Intersection_traits::type> solutions_container; solutions_container solutions; @@ -828,7 +827,7 @@ namespace CircularFunctors { OutputIterator res ) { return intersect_2(l,c,res); - } + } template < class CK, class OutputIterator > OutputIterator @@ -838,8 +837,8 @@ namespace CircularFunctors { *res++ = make_object(A); return res; } - -} // namespace CircularFunctors + +} // namespace CircularFunctors } // namespace CGAL #endif // CGAL_CIRCULAR_KERNEL_PREDICATES_ON_LINE_ARC_2_H From a1bd7bd05d8eb414997d0a4f3a002c0d1e899706 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 8 Dec 2013 11:06:35 +0200 Subject: [PATCH 47/50] removed unnecessaty typedef --- .../CGAL/Arr_point_location/Arr_triangulation_pl_functions.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h index 9788270153c..f2f1e77e561 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h @@ -69,8 +69,6 @@ typename Arr_triangulation_point_location::result_type Arr_triangulation_point_location::locate(const Point_2& p) const { - typedef Arrangement_2_ Arrangement; - CGAL_TRG_PRINT_DEBUG("------ locate point " << p); //locate in the CDT From 784c9259734eea49f1f3a5f2138b570a39dadc87 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 8 Dec 2013 11:07:21 +0200 Subject: [PATCH 48/50] Condionally defined some types --- .../internal_functions_on_line_arc_2.h | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h index 0fcb8b0f0bb..d398dd10c8b 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h @@ -559,7 +559,11 @@ namespace CircularFunctors { { typedef std::vector solutions_container; typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + +#if defined(CGAL_CK_EXPLOIT_IDENTITY) || \ + defined(CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES) typedef typename CK::Line_arc_2 Line_arc_2; +#endif #ifdef CGAL_CK_EXPLOIT_IDENTITY typedef typename CK::Circular_arc_2 Circular_arc_2; @@ -791,7 +795,6 @@ namespace CircularFunctors { const typename CK::Circular_arc_2 &c, OutputIterator res ) { - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; typedef typename CK::Circular_arc_2 Circular_arc_2; typedef typename CK::Line_2 Line_2; @@ -807,15 +810,16 @@ namespace CircularFunctors { for (typename solutions_container::const_iterator it = solutions.begin(); it != solutions.end(); ++it) { - #if CGAL_INTERSECTION_VERSION < 2 - const std::pair* p = - object_cast >(& (*it)); - Has_on_visitor vis(&c); - if(vis(*p)) *res++ = *it; - #else - if(boost::apply_visitor(Has_on_visitor(&c), *it)) - *res++ = *it; - #endif +#if CGAL_INTERSECTION_VERSION < 2 + typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; + const std::pair* p = + object_cast >(& (*it)); + Has_on_visitor vis(&c); + if(vis(*p)) *res++ = *it; +#else + if(boost::apply_visitor(Has_on_visitor(&c), *it)) + *res++ = *it; +#endif } return res; } From d6ef591c061547b5f783fe11709a697c0bddf572 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Mon, 9 Dec 2013 08:49:37 +0200 Subject: [PATCH 49/50] removed unused typedef --- .../Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h index 0630b9d36a3..4e53ebca441 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h @@ -100,7 +100,6 @@ assign(const Self& other) template void Arr_spherical_topology_traits_2::dcel_updated() { - typedef GeomTraits_ GeomTraits; typedef Dcel_ Dcel; // Go over the DCEL vertices and locate the south and north pole (if any) From c398ede5b543d359db04831cca32a6982b6fda25 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Tue, 10 Dec 2013 15:35:34 +0200 Subject: [PATCH 50/50] Added (i) bug fix in landmark pl strategy of 2D Arrangements, and (ii) memory leaks fix of 2D Reg. Boolean Set Ops. --- Installation/changes.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Installation/changes.html b/Installation/changes.html index d4986456341..5ddb7391a51 100755 --- a/Installation/changes.html +++ b/Installation/changes.html @@ -118,13 +118,19 @@ and src/ directories).
  • ... And the price
  • +

    2D Regularized Boolean Set-Operations

    +
      +
    • Fixed two memory leaks in + CGAL::General_polygon_set_2. +
    • +

    2D Arrangements

    • Revise the API of polylines. In particular, construction is now done using functors and iteration is possible only on the segments of a polyline. -
    • +
    • Fixed a bug in the Landmark point-location strategy.

    3D Alpha Shapes