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

« back to all changes in this revision

Viewing changes to demo/Arrangement_on_surface_2/Utils.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:
337
337
  typedef typename Kernel::Point_2 Point_2;
338
338
  typedef typename Kernel::Segment_2 Segment_2;
339
339
  typedef typename Traits::Curve_2 Curve_2;
340
 
  typedef typename Curve_2::const_iterator Curve_const_iterator;
341
340
  typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
 
341
  typedef typename Curve_2::Segment_const_iterator Seg_const_it;
342
342
 
343
343
  double operator() ( const Point_2& p, const X_monotone_curve_2& c ) const
344
344
  {
345
 
    Curve_const_iterator ps = c.begin();
346
 
    Curve_const_iterator pt = ps; pt++;
 
345
    Seg_const_it seg_it_s = c.begin_segments();
 
346
 
347
347
    bool first = true;
348
348
    FT min_dist = 0;
349
349
 
350
 
    while ( pt != c.end() )
351
 
    {
352
 
      const Point_2& source = *ps;
353
 
      const Point_2& target = *pt;
354
 
      Segment_2 seg( source, target );
355
 
      FT dist = this->squared_distance( p, seg );
356
 
 
357
 
      if ( first || dist < min_dist )
 
350
    while (seg_it_s != c.end_segments())
358
351
      {
359
 
        first = false;
360
 
        min_dist = dist;
 
352
        Segment_2 seg = *seg_it_s;
 
353
        FT dist = this->squared_distance( p, seg );
 
354
 
 
355
        if ( first || dist < min_dist )
 
356
          {
 
357
            first = false;
 
358
            min_dist = dist;
 
359
          }
 
360
        seg_it_s++;
361
361
      }
362
 
      ps++; pt++;
363
 
    }
364
362
 
365
363
    return CGAL::to_double( min_dist );
366
364
  }