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

« back to all changes in this revision

Viewing changes to demo/Arrangement_on_surface_2/ArrangementGraphicsItem.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:
313
313
  {
314
314
    if (!f->is_unbounded())  // f is not the unbounded face
315
315
    {
 
316
      typedef typename CGAL::Arr_polyline_traits_2<Kernel_> Arr_poly_traits;
 
317
      typedef typename Arr_poly_traits::Compare_endpoints_xy_2 Comp_end_pts_2;
 
318
      typedef typename Arr_poly_traits::Construct_min_vertex_2 Poly_const_min_v;
 
319
      typedef typename Arr_poly_traits::Construct_max_vertex_2 Poly_const_max_v;
 
320
 
 
321
      // Obtain a polyline traits class and construct the needed functors
 
322
      Arr_poly_traits poly_tr;
 
323
      Comp_end_pts_2 comp_end_pts = poly_tr.compare_endpoints_xy_2_object();
 
324
      Poly_const_min_v poly_const_min_v=poly_tr.construct_min_vertex_2_object();
 
325
      Poly_const_max_v poly_const_max_v=poly_tr.construct_max_vertex_2_object();
 
326
 
 
327
      // Construct needed functors from the segment traits
 
328
      typedef typename Arr_poly_traits::Segment_traits_2       Segment_traits;
 
329
      typedef typename Segment_traits::Construct_min_vertex_2  Seg_const_min_v;
 
330
      typedef typename Segment_traits::Construct_max_vertex_2  Seg_const_max_v;
 
331
      Seg_const_min_v construct_min_v = poly_tr.segment_traits_2()->
 
332
        construct_min_vertex_2_object();
 
333
      Seg_const_max_v construct_max_v = poly_tr.segment_traits_2()->
 
334
        construct_max_vertex_2_object();
 
335
 
 
336
      // Iterator of the segments of an x-monotone polyline
 
337
      typename X_monotone_curve_2::Segment_const_iterator seg_it;
 
338
 
316
339
      QVector< QPointF > pts; // holds the points of the polygon
317
 
      typename X_monotone_curve_2::const_iterator           pt_itr;
318
 
      typename X_monotone_curve_2::const_reverse_iterator   pt_rev_itr;
319
340
      X_monotone_curve_2 cv;
320
341
 
321
342
      /* running with around the outer of the face and generate from it
324
345
      Ccb_halfedge_circulator cc = f->outer_ccb();
325
346
      do {
326
347
        cv = cc->curve();
327
 
        bool curve_has_same_direction =
328
 
          ( *(cc->curve().begin()) == cc->source()->point() );
329
 
        if ( curve_has_same_direction )
330
 
        {
331
 
          for( pt_itr = cv.begin() , ++pt_itr ; pt_itr != cv.end(); ++pt_itr)
332
 
          {
333
 
            double x = CGAL::to_double((*pt_itr).x());
334
 
            double y = CGAL::to_double((*pt_itr).y());
 
348
 
 
349
        // Determine the direction of cv (left-to-right or right-to-left)
 
350
        Comparison_result dir = comp_end_pts(cv);
 
351
 
 
352
        for (seg_it = cv.begin_segments();
 
353
             seg_it != cv.end_segments() ; ++seg_it)
 
354
          {
 
355
            if (dir == SMALLER)
 
356
              {
 
357
                // cv is directed from left-to-right
 
358
                // Adding the left-min vertex of the current segment
 
359
                double x = CGAL::to_double((construct_min_v(*seg_it)).x());
 
360
                double y = CGAL::to_double((construct_min_v(*seg_it)).y());
 
361
                QPointF coord_source(x , y);
 
362
                pts.push_back(coord_source );
 
363
              }
 
364
            else
 
365
              {
 
366
                // cv is directed from right-to-left
 
367
                // Adding the right-max vertex of the current segment
 
368
                double x = CGAL::to_double((construct_max_v(*seg_it)).x());
 
369
                double y = CGAL::to_double((construct_max_v(*seg_it)).y());
 
370
                QPointF coord_source(x , y);
 
371
                pts.push_back(coord_source );
 
372
              }
 
373
          }
 
374
 
 
375
        if (dir == SMALLER)
 
376
          {
 
377
            // Add the right-most point of cv
 
378
            double x = CGAL::to_double((poly_const_max_v(cv)).x());
 
379
            double y = CGAL::to_double((poly_const_max_v(cv)).y());
335
380
            QPointF coord_source(x , y);
336
381
            pts.push_back(coord_source );
337
382
          }
338
 
        }
339
383
        else
340
 
        {
341
 
          for (pt_rev_itr = cv.rbegin() , ++pt_rev_itr; pt_rev_itr != cv.rend();
342
 
               ++pt_rev_itr)
343
384
          {
344
 
            double x = CGAL::to_double((*pt_rev_itr).x());
345
 
            double y = CGAL::to_double((*pt_rev_itr).y());
 
385
            // Add the left-most point of cv
 
386
            double x = CGAL::to_double((poly_const_min_v(cv)).x());
 
387
            double y = CGAL::to_double((poly_const_min_v(cv)).y());
346
388
            QPointF coord_source(x , y);
347
389
            pts.push_back(coord_source );
348
390
          }
349
 
        }
350
391
        //created from the outer boundary of the face
351
392
      } while (++cc != f->outer_ccb());
352
393