~ubuntu-branches/debian/stretch/cgal/stretch

« back to all changes in this revision

Viewing changes to include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h

  • Committer: Package Import Robot
  • Author(s): Joachim Reichel
  • Date: 2014-04-05 10:56:43 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20140405105643-jgnrpu2thtx23zfs
Tags: 4.4-1
* New upstream release.
* Remove patches do-not-link-example-with-qt4-support-library.patch and
  fix_jet_fitting_3.patch (applied upstream).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel).
 
1
// Copyright (c) 2007,2009,2010,2011,2013 Tel-Aviv University (Israel).
2
2
// All rights reserved.
3
3
//
4
4
// This file is part of CGAL (www.cgal.org).
14
14
//
15
15
// $URL$
16
16
// $Id$
17
 
// 
 
17
//
18
18
// Author(s)     : Baruch Zukerman <baruchzu@post.tau.ac.il>
19
19
//                 Ron Wein <wein@post.tau.ac.il>
20
20
//                 Efi Fogel <efif@post.tau.ac.il>
49
49
  typedef Sweep_line_empty_visitor<Traits_2>           Base_visitor;
50
50
  typedef typename Base_visitor::Event                 Event;
51
51
  typedef typename Base_visitor::Subcurve              Subcurve;
 
52
  typedef typename Event::Subcurve_iterator            Subcurve_iterator;
52
53
 
53
54
protected:
54
55
 
56
57
 
57
58
  // Data members:
58
59
  //! The topology-traits class.
59
 
  const Topology_traits * m_top_traits;
 
60
  const Topology_traits* m_top_traits;
60
61
 
61
62
  //! The unbounded arrangement face.
62
 
  Face_const_handle m_unb_face;
 
63
  Face_const_handle m_spherical_face;
63
64
 
64
65
public:
65
66
  /*! Constructor.
66
67
   * \param arr The arrangement.
67
68
   */
68
 
  Arr_spherical_batched_pl_helper(const Arrangement_2 *arr) :
 
69
  Arr_spherical_batched_pl_helper(const Arrangement_2* arr) :
69
70
    m_top_traits(arr->topology_traits())
70
71
  {}
71
72
 
74
75
 
75
76
  /*! A notification issued before the sweep process starts. */
76
77
  void before_sweep()
77
 
  {
78
 
    // Get the unbounded face.
79
 
    m_unb_face = Face_const_handle(m_top_traits->unbounded_face());
80
 
  }
 
78
  { m_spherical_face = Face_const_handle(m_top_traits->spherical_face()); }
81
79
 
82
80
  /*! A notification invoked after the sweep-line finishes handling the given
83
81
   * event.
84
82
   */
85
 
  void after_handle_event(Event * ) { return; }
 
83
  void after_handle_event(Event* event) {
 
84
 
 
85
    if (event->parameter_space_in_y() == ARR_TOP_BOUNDARY) {
 
86
      Arr_curve_end ind = ((event->number_of_left_curves() == 0) &&
 
87
                           (event->number_of_right_curves() != 0)) ?
 
88
        ARR_MIN_END : ARR_MAX_END;
 
89
      Subcurve_iterator it, nit, it_end;
 
90
      if (ind == ARR_MIN_END) {
 
91
        it = nit = event->right_curves_begin();
 
92
        it_end = event->right_curves_end();
 
93
      } else {
 
94
        it = nit = event->left_curves_begin();
 
95
        it_end = event->left_curves_end();
 
96
      }
 
97
 
 
98
      ++nit;
 
99
      if (it != it_end) {
 
100
        while (nit != it_end) {
 
101
          ++it;
 
102
          ++nit;
 
103
        }
 
104
      }
 
105
      const Subcurve* sc = *it;
 
106
      // pick the one facing the top right corner now
 
107
      m_spherical_face = sc->last_curve().halfedge_handle()->face();
 
108
    }
 
109
 
 
110
    // EBEB 2013-12-012 do similar stuff for right boundary
 
111
    if (event->parameter_space_in_y() == ARR_RIGHT_BOUNDARY) {
 
112
      Subcurve_iterator it, nit, it_end;
 
113
      it = nit = event->left_curves_begin();
 
114
      it_end = event->left_curves_end();
 
115
 
 
116
      ++nit;
 
117
      if (it != it_end) {
 
118
        while (nit != it_end) {
 
119
          ++it;
 
120
          ++nit;
 
121
        }
 
122
      }
 
123
      const Subcurve* sc = *it;
 
124
      // pick the one facing the top right corner now
 
125
      CGAL_assertion(sc->last_curve().halfedge_handle()->direction() == ARR_LEFT_TO_RIGHT);
 
126
      m_spherical_face = sc->last_curve().halfedge_handle()->face();
 
127
    }
 
128
 
 
129
 
 
130
    return;
 
131
  }
86
132
  //@}
87
133
 
88
 
  /*! Get the current top face. */
89
 
  Face_const_handle top_face() const
90
 
  {
91
 
    return m_unb_face;
92
 
  }
 
134
  /*! Obtain the current top face. */
 
135
  Face_const_handle top_face() const { return m_spherical_face; }
93
136
};
94
137
 
95
138
} //namespace CGAL