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

« back to all changes in this revision

Viewing changes to include/CGAL/Arr_point_location/Arr_lm_halton_generator.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:
17
17
//
18
18
// Author(s)     : Idit Haran   <haranidi@post.tau.ac.il>
19
19
//                 Ron Wein     <haranidi@post.tau.ac.il>
20
 
#ifndef CGAL_ARR_LM_HALTON_GENERATOR_H
21
 
#define CGAL_ARR_LM_HALTON_GENERATOR_H
 
20
 
 
21
#ifndef CGAL_ARR_LANDMARKS_HALTON_GENERATOR_H
 
22
#define CGAL_ARR_LANDMARKS_HALTON_GENERATOR_H
22
23
 
23
24
/*! \file
24
25
* Definition of the Arr_halton_landmarks_generator<Arrangement> template.
55
56
 
56
57
protected:
57
58
  // Data members:
58
 
  unsigned int     num_landmarks; 
 
59
  unsigned int     num_landmarks;
59
60
 
60
61
private:
61
62
  /*! Copy constructor - not supported. */
64
65
  /*! Assignment operator - not supported. */
65
66
  Self& operator=(const Self&);
66
67
 
67
 
public: 
68
 
  /*! Constructor. */
 
68
public:
 
69
  /*! Constructor from an arrangement.
 
70
   * \param arr (in) The arrangement.
 
71
   */
69
72
  Arr_halton_landmarks_generator(const Arrangement_2& arr,
70
 
                                 unsigned int n_landmarks = 0) : 
 
73
                                 unsigned int n_landmarks = 0) :
71
74
    Base(arr),
72
75
    num_landmarks(n_landmarks)
73
76
  { this->build_landmark_set(); }
79
82
   * The Halton points are constructed in the bounding rectangle of the
80
83
   * arrangement vertices.
81
84
   */
82
 
  virtual void _create_points_set (Points_set& points)
 
85
  virtual void _create_points_set(Points_set& points)
83
86
  {
84
87
    points.clear();
85
88
 
86
89
    // Go over the arrangement vertices and construct their boundig box.
87
90
    const Arrangement_2*  arr = this->arrangement();
88
 
    Vertex_const_iterator vit; 
 
91
    Vertex_const_iterator vit;
89
92
    double                x_min = 0, x_max = 1, y_min = 0, y_max = 1;
90
93
    double                x, y;
91
94
    bool                  first = true;
92
95
 
93
 
    for (vit=arr->vertices_begin(); vit != arr->vertices_end(); ++vit) {
 
96
    for (vit = arr->vertices_begin(); vit != arr->vertices_end(); ++vit) {
94
97
      x = CGAL::to_double(vit->point().x());
95
98
      y = CGAL::to_double(vit->point().y());
96
99
 
100
103
        first = false;
101
104
      }
102
105
      else {
103
 
        if (x < x_min)
104
 
          x_min = x;
105
 
        else if (x > x_max)
106
 
          x_max = x;
 
106
        if (x < x_min) x_min = x;
 
107
        else if (x > x_max) x_max = x;
107
108
 
108
 
        if (y < y_min)
109
 
          y_min = y;
110
 
        else if (y > y_max)
111
 
          y_max = y;
 
109
        if (y < y_min) y_min = y;
 
110
        else if (y > y_max) y_max = y;
112
111
      }
113
112
    }
114
113
 
117
116
    if (num_landmarks == 0)
118
117
      num_landmarks = static_cast<unsigned int>(arr->number_of_vertices());
119
118
 
120
 
    if (num_landmarks == 0)
121
 
      return;
 
119
    if (num_landmarks == 0) return;
122
120
 
123
121
    if (num_landmarks == 1) {
124
 
      points.push_back (Point_2 (x_max, y_max)); 
 
122
      points.push_back (Point_2 (x_max, y_max));
125
123
      return;
126
124
    }
127
125