This file is indexed.

/usr/include/CGAL/min_quadrilateral_2.h is in libcgal-dev 4.5-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
// Copyright (c) 1999-2003  ETH Zurich (Switzerland).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// 
//
// Author(s)     : Michael Hoffmann <hoffmann@inf.ethz.ch> and
//                 Emo Welzl <emo@inf.ethz.ch>

#ifndef CGAL_MIN_QUADRILATERAL_2_H
#define CGAL_MIN_QUADRILATERAL_2_H 1

#include <CGAL/basic.h>
#include <CGAL/Optimisation/assertions.h>
#include <iterator>
#include <boost/bind.hpp>
#include <boost/function.hpp>

#ifdef CGAL_OPTIMISATION_EXPENSIVE_PRECONDITION_TAG
#include <CGAL/Polygon_2_algorithms.h>
#endif

namespace CGAL {

template < class ForwardIterator, class OutputIterator, class Traits >
OutputIterator
convex_bounding_box_2(
  ForwardIterator f, ForwardIterator l, OutputIterator o, Traits& t)
// PRE:
//   * f != l
//   * value type of ForwardIterator is Traits::Point_2
//   * [f,l) form a the vertices of a convex polygon
//     oriented counterclockwise
//   * OutputIterator accepts ForwardIterator as value type
// POST:
//   writes to o iterators from [f,l) referring to the last points with
//    - smallest y coordinate
//    - largest x coordinate
//    - largest y coordinate
//    - smallest x coordinate
//   in that order.
{
  CGAL_precondition(f != l);

  // make sure that we have two distinct points, such that it
  // can be determined in which quadrant of the polygon we are
  ForwardIterator first;
  do {
    first = f;
    // catch the one-element case:
    if (++f == l) {
      f = first;
      break;
    }
  } while (t.equal_2_object()(*first, *f));

  // Four extremes
  ForwardIterator minx = first;
  ForwardIterator maxx;
  ForwardIterator miny;
  ForwardIterator maxy;

  typedef typename Traits::Point_2                Point_2;
  typedef typename Traits::Less_xy_2              Less_xy_2;
  typedef typename Traits::Less_yx_2              Less_yx_2;
  typedef boost::function2<bool,Point_2,Point_2>  Greater_xy_2;
  typedef boost::function2<bool,Point_2,Point_2>  Greater_yx_2;

  Less_xy_2    less_xy_2    = t.less_xy_2_object();
  Less_yx_2    less_yx_2    = t.less_yx_2_object();
  Greater_xy_2 greater_xy_2 = boost::bind(less_xy_2, _2, _1);
  Greater_yx_2 greater_yx_2 = boost::bind(less_yx_2, _2, _1);

  if (less_xy_2(*minx, *f) ||
      (less_yx_2(*minx, *f) && !less_xy_2(*f, *minx)))
    if (less_yx_2(*minx, *f))
      // first quadrant
      for (;;) {
        maxx = f;
        if (++f == l) {
          maxy = minx = miny = maxx;
          break;
        }
        if (less_xy_2(*f, *maxx)) {
          f = maxx;
          for (;;) {
            maxy = f;
            if (++f == l) {
              minx = miny = maxy;
              break;
            }
            if (less_yx_2(*f, *maxy)) {
              f = maxy;
              for (;;) {
                minx = f;
                if (++f == l) {
                  miny = minx;
                  break;
                }
                if (greater_xy_2(*f, *minx)) {
                  f = minx;
                  do
                    miny = f;
                  while (++f != l && !greater_yx_2(*f, *miny));
                  break;
                }
              } // for (;;)
              break;
            } // if (less_yx_2(*f, *maxy))
          } // for (;;)
          break;
        } // if (less_xy_2(*f, *maxx))
      } // for (;;)
    else
      // fourth quadrant
      for (;;) {
        miny = f;
        if (++f == l) {
          maxx = maxy = minx = miny;
          break;
        }
        if (greater_yx_2(*f, *miny)) {
          f = miny;
          for (;;) {
            maxx = f;
            if (++f == l) {
              maxy = minx = maxx;
              break;
            }
            if (less_xy_2(*f, *maxx)) {
              f = maxx;
              for (;;) {
                maxy = f;
                if (++f == l) {
                  minx = maxy;
                  break;
                }
                if (less_yx_2(*f, *maxy)) {
                  f = maxy;
                  do
                    minx = f;
                  while (++f != l && !greater_xy_2(*f, *minx));
                  break;
                }
              } // for (;;)
              break;
            } // if (less_xy_2(*f, *maxx))
          } // for (;;)
          break;
        } // if (greater_yx_2(*f, *miny))
      } // for (;;)
  else
    if (less_yx_2(*f, *minx))
      // third quadrant
      for (;;) {
        minx = f;
        if (++f == l) {
          miny = maxx = maxy = minx;
          break;
        }
        if (greater_xy_2(*f, *minx)) {
          f = minx;
          for (;;) {
            miny = f;
            if (++f == l) {
              maxx = maxy = miny;
              break;
            }
            if (greater_yx_2(*f, *miny)) {
              f = miny;
              for (;;) {
                maxx = f;
                if (++f == l) {
                  maxy = maxx;
                  break;
                }
                if (less_xy_2(*f, *maxx)) {
                  f = maxx;
                  do
                    maxy = f;
                  while (++f != l && !less_yx_2(*f, *maxy));
                  break;
                }
              } // for (;;)
              break;
            } // if (greater_yx_2(*f, *miny))
          } // for (;;)
          break;
        } // if (greater_xy_2(*f, *minx))
      } // for (;;)
    else
      // second quadrant
      for (;;) {
        maxy = f;
        if (++f == l) {
          minx = miny = maxx = maxy;
          break;
        }
        if (less_yx_2(*f, *maxy)) {
          f = maxy;
          for (;;) {
            minx = f;
            if (++f == l) {
              miny = maxx = minx;
              break;
            }
            if (greater_xy_2(*f, *minx)) {
              f = minx;
              for (;;) {
                miny = f;
                if (++f == l) {
                  maxx = miny;
                  break;
                }
                if (greater_yx_2(*f, *miny)) {
                  f = miny;
                  do
                    maxx = f;
                  while (++f != l && !less_xy_2(*f, *maxx));
                  break;
                }
              } // for (;;)
              break;
            } // if (greater_xy_2(*f, *minx))
          } // for (;;)
          break;
        } // if (less_yx_2(*f, *maxy))
      } // for (;;)

  // Output
  *o++ = less_yx_2(*first, *miny) ? first : miny;
  *o++ = less_xy_2(*maxx, *first) ? first : maxx;
  *o++ = less_yx_2(*maxy, *first) ? first : maxy;
  *o++ = less_xy_2(*first, *minx) ? first : minx;
  return o;
} // convex_bounding_box_2(f, l, o, t)

namespace Optimisation {
  // Adds certain redundant functionality for convenience
  template < typename Traits >
  struct Min_quadrilateral_traits_wrapper : public Traits
  {
    typedef Traits                                      Base;
    // types inherited from Traits
    typedef typename Base::Point_2                      Point_2;
    typedef typename Base::Direction_2                  Direction_2;
    // predicates and constructions inherited from Traits
    typedef typename Base::Has_on_negative_side_2       HONS;
    typedef typename Base::Construct_vector_2           CV2;
    typedef typename Base::Construct_direction_2        CD2;
    typedef typename Base::Construct_line_2             Construct_line_2;
    typedef typename Base::Compare_angle_with_x_axis_2  CAWXA;

    using Traits::has_on_negative_side_2_object;
    using Traits::construct_line_2_object;
    using Traits::construct_vector_2_object;
    using Traits::compare_angle_with_x_axis_2_object;

    Min_quadrilateral_traits_wrapper(const Traits& bt) : Base(bt) {}

    // ---------------------------------------------------------------
    // Right_of_implicit_line_2
    // ---------------------------------------------------------------
    typedef boost::function3<bool,Point_2,Point_2,Direction_2> 
      Right_of_implicit_line_2;
    
    Right_of_implicit_line_2 right_of_implicit_line_2_object() const {
      return boost::bind(has_on_negative_side_2_object(),
			 boost::bind(construct_line_2_object(), _2, _3),
			 _1);
    }
    
    typedef boost::function2<Direction_2,Point_2,Point_2> 
      Construct_direction_2;
    
    Construct_direction_2 construct_direction_2_object() const {
      return boost::bind(Base::construct_direction_2_object(),
			 boost::bind(construct_vector_2_object(), _1, _2));
    }
    
    template < class Kernel >
    class Rdbmop
    : public std::binary_function< Direction_2, int, Direction_2 >
    {
      typename Kernel::Construct_perpendicular_vector_2   cperpvec;
      typename Kernel::Construct_vector_from_direction_2  cvec;
      typename Kernel::Construct_direction_2              dir;
      typename Kernel::Construct_opposite_direction_2     oppdir;
    public:
    
      Rdbmop() {}
    
      Rdbmop(const Kernel& k)
      : cperpvec(k.construct_perpendicular_vector_2_object()),
        cvec(k.construct_vector_from_direction_2_object()),
        dir(k.construct_direction_2_object()),
        oppdir(k.construct_opposite_direction_2_object())
      {}
    
      Direction_2
      operator()(const Direction_2& d, int i) const
      {
        // FIXME: here I would like to construct a vector from a
        // direction, but this is not in the kernel concept
        // maybe, we can get rid of directions soon...
        CGAL_precondition(i >= 0 && i < 4);
        if (i == 0) return d;
        if (i == 1) return dir(cperpvec(cvec(d), CLOCKWISE));
        if (i == 2) return oppdir(d);
        return dir(cperpvec(cvec(d), COUNTERCLOCKWISE));
      }
    };
    
    typedef Rdbmop<Traits> Rotate_direction_by_multiple_of_pi_2;
    
    Rotate_direction_by_multiple_of_pi_2
    rotate_direction_by_multiple_of_pi_2_object() const
    { return Rotate_direction_by_multiple_of_pi_2(*this); }
    
    typedef boost::function2<bool,Direction_2,Direction_2>
      Less_angle_with_x_axis_2;
    Less_angle_with_x_axis_2 less_angle_with_x_axis_2_object() const {
      return boost::bind(std::equal_to<Comparison_result>(), 
                         boost::bind(compare_angle_with_x_axis_2_object(),
                                     _1, _2),
                         SMALLER);
    }

  };
} // namespace Optimisation

template < class ForwardIterator, class OutputIterator, class BTraits >
OutputIterator
min_rectangle_2(
  ForwardIterator f,
  ForwardIterator l,
  OutputIterator o,
  BTraits& bt)
{
  typedef Optimisation::Min_quadrilateral_traits_wrapper<BTraits> Traits;
  Traits t(bt);
  CGAL_optimisation_expensive_precondition(is_convex_2(f, l, t));
  CGAL_optimisation_expensive_precondition(
    orientation_2(f, l, t) == COUNTERCLOCKWISE);

  // check for trivial cases
  if (f == l) return o;
  ForwardIterator tst = f;
  if (++tst == l) {
    // all points are equal
    for (int i = 0; i < 4; ++i) *o++ = *f;
    return o;
  }

  // types from the traits class
  typedef typename Traits::Rectangle_2            Rectangle_2;
  typedef typename Traits::Direction_2            Direction_2;
  typedef typename Traits::Construct_direction_2  Construct_direction_2;
  typedef typename Traits::Construct_rectangle_2  Construct_rectangle_2;

  Construct_direction_2 direction = t.construct_direction_2_object();
  Construct_rectangle_2 rectangle = t.construct_rectangle_2_object();
  typename Traits::Rotate_direction_by_multiple_of_pi_2
    rotate = t.rotate_direction_by_multiple_of_pi_2_object();
  typename Traits::Less_angle_with_x_axis_2
    less_angle = t.less_angle_with_x_axis_2_object();
  typename Traits::Area_less_rectangle_2
    area_less = t.area_less_rectangle_2_object();

  // quadruple of points defining the current rectangle
  ForwardIterator curr[4];
  // initialised to the points defining the bounding box
  convex_bounding_box_2(f, l, curr, t);

  // curr[i] can be advanced (cyclically) until it reaches limit[i]
  ForwardIterator limit[4];
  limit[0] = curr[1], limit[1] = curr[2],
    limit[2] = curr[3], limit[3] = curr[0];

  // quadruple of direction candidates defining the current rectangle
  Direction_2  dir[4];
  for (int i = 0; i < 4; i++) {
    ForwardIterator cp = curr[i];
    if (++cp == l)
      cp = f;
    dir[i] = rotate(direction(*(curr[i]), *cp), i);
  }

  int yet_to_finish = 0;
  for (int i1 = 0; i1 < 4; ++i1) {
    CGAL_optimisation_assertion(limit[i1] != l);
    if (curr[i1] != limit[i1])
      ++yet_to_finish;
  }

  int low = less_angle(dir[0], dir[1]) ? 0 : 1;
  int upp = less_angle(dir[2], dir[3]) ? 2 : 3;

  int event = less_angle(dir[low], dir[upp]) ? low : upp;

  Rectangle_2 rect_so_far =
    rectangle(*(curr[0]), dir[event], *(curr[1]), *(curr[2]), *(curr[3]));

  for (;;) {
    if (++curr[event] == l)
      curr[event] = f;
    ForwardIterator cp = curr[event];
    if (++cp == l)
      cp = f;

    dir[event] = rotate(direction(*(curr[event]), *cp), event);

    if (curr[event] == limit[event])
      if (--yet_to_finish <= 0)
        break;

    if (event < 2)
      low = less_angle(dir[0], dir[1]) ? 0 : 1;
    else
      upp = less_angle(dir[2], dir[3]) ? 2 : 3;

    event = less_angle(dir[low], dir[upp]) ? low : upp;

    Rectangle_2 test_rect = rectangle(*(curr[0]), dir[event],
                                      *(curr[1]), *(curr[2]), *(curr[3]));
    if (area_less(test_rect, rect_so_far))
      rect_so_far = test_rect;

  } // for (;;)

  return t.copy_rectangle_vertices_2(rect_so_far, o);

} // min_rectangle_2( f, l, o , t)

template < class ForwardIterator, class OutputIterator, class BTraits >
OutputIterator
min_parallelogram_2(ForwardIterator f,
                    ForwardIterator l,
                    OutputIterator o,
                    BTraits& bt)
{
  typedef Optimisation::Min_quadrilateral_traits_wrapper<BTraits> Traits;
  Traits t(bt);
  CGAL_optimisation_expensive_precondition(is_convex_2(f, l, t));

  // types from the traits class
  typedef typename Traits::Direction_2            Direction_2;
  typedef typename Traits::Parallelogram_2        Parallelogram_2;
  typedef typename Traits::Construct_direction_2  Construct_direction_2;
  typedef typename Traits::Equal_2                Equal_2;

  Equal_2 equal = t.equal_2_object();
  Construct_direction_2 direction = t.construct_direction_2_object();
  typename Traits::Construct_parallelogram_2
    parallelogram = t.construct_parallelogram_2_object();
  typename Traits::Less_angle_with_x_axis_2
    less_angle = t.less_angle_with_x_axis_2_object();
  typename Traits::Area_less_parallelogram_2
    area_less = t.area_less_parallelogram_2_object();
  typename Traits::Right_of_implicit_line_2
    right_of_line = t.right_of_implicit_line_2_object();

  // check for trivial cases
  if (f == l) return o;
  
  ForwardIterator first;
  do {
    first = f;
    if (++f == l) {
      // all points are equal
      for (int i = 0; i < 4; ++i) *o++ = *first;
      return o;
    }
  } while (equal(*first, *f));

  // quadruple of points defining the bounding box
  ForwardIterator curr[4];
  // initialised to the points defining the bounding box
  convex_bounding_box_2(first, l, curr, t);


  ForwardIterator low   = curr[0];
  ForwardIterator upp   = curr[2];
  ForwardIterator right = low;
  ForwardIterator left  = upp;

  int yet_to_finish = 2;

  // initialize parallelogram
  ForwardIterator ln = low;
  do
    if (++ln == l)
      ln = first;
  while (equal(*ln, *low));
  Direction_2 d_low = direction(*low, *ln);
  ForwardIterator un = upp;
  do
    if (++un == l)
      un = first;
  while (equal(*un, *upp));
  Direction_2 d_upp = direction(*un, *upp);

  bool low_goes_next = less_angle(d_low, d_upp);
  Direction_2 next_dir = low_goes_next ? d_low : d_upp;

  Direction_2 d_leftright = next_dir;
  for (;;) {
    // compute the next left/right candidate and store it to d_leftright
    ForwardIterator rig = right;
    do
      if (++rig == l)
        rig = first;
    while (equal(*rig, *right));
    Direction_2 d_right = direction(*right, *rig);
  
    ForwardIterator len = left;
    do
      if (++len == l)
        len = first;
    while (equal(*len, *left));
    Direction_2 d_left = direction(*len, *left);
  
    if (less_angle(d_right, d_left))
      if (right_of_line(*rig, *left, next_dir))
        right = rig;
      else {
        d_leftright = d_right;
        break;
      }
    else
      if (right_of_line(*right, *len, next_dir))
        left = len;
      else {
        d_leftright = d_left;
        break;
      }
  } // for (;;)

  Parallelogram_2 para_so_far =
    parallelogram(*low, next_dir, *right, d_leftright, *upp, *left);

  for (;;) {
    if (low_goes_next) {
      low = ln;
      if (low == curr[2])
        if (--yet_to_finish <= 0)
          break;
    } else {
      upp = un;
      if (upp == curr[0])
        if (--yet_to_finish <= 0)
          break;
    }

    // compute the next lower/upper candidate
    ln = low;
    do
      if (++ln == l)
        ln = first;
    while (equal(*ln, *low));
    d_low = direction(*low, *ln);
    un = upp;
    do
      if (++un == l)
        un = first;
    while (equal(*un, *upp));
    d_upp = direction(*un, *upp);

    low_goes_next = less_angle(d_low, d_upp);
    next_dir = low_goes_next ? d_low : d_upp;

    for (;;) {
      // compute the next left/right candidate and store it to d_leftright
      ForwardIterator rig = right;
      do
        if (++rig == l)
          rig = first;
      while (equal(*rig, *right));
      Direction_2 d_right = direction(*right, *rig);
    
      ForwardIterator len = left;
      do
        if (++len == l)
          len = first;
      while (equal(*len, *left));
      Direction_2 d_left = direction(*len, *left);
    
      if (less_angle(d_right, d_left))
        if (right_of_line(*rig, *left, next_dir))
          right = rig;
        else {
          d_leftright = d_right;
          break;
        }
      else
        if (right_of_line(*right, *len, next_dir))
          left = len;
        else {
          d_leftright = d_left;
          break;
        }
    } // for (;;)

    // check whether we found a smaller parallelogram
    Parallelogram_2 test_para =
      parallelogram(*low, next_dir, *right, d_leftright, *upp, *left);


    if (area_less(test_para, para_so_far))
      para_so_far = test_para;

  } // for (;;)


   return t.copy_parallelogram_vertices_2(para_so_far, o);
 } // min_parallelogram_2(f, l, o , t)
template < class ForwardIterator, class OutputIterator, class BTraits >
OutputIterator
min_strip_2(ForwardIterator f,
            ForwardIterator l,
            OutputIterator o,
            BTraits& bt)
{
  typedef Optimisation::Min_quadrilateral_traits_wrapper<BTraits> Traits;
  Traits t(bt);
  CGAL_optimisation_expensive_precondition(is_convex_2(f, l, t));

  // types from the traits class
  typedef typename Traits::Direction_2            Direction_2;
  typedef typename Traits::Strip_2                Strip_2;
  typedef typename Traits::Equal_2                Equal_2;
  typedef typename Traits::Construct_direction_2  Construct_direction_2;
  typedef typename Traits::Construct_strip_2      Construct_strip_2;
  typedef typename Traits::Width_less_strip_2     Width_less_strip_2;

  Equal_2 equal = t.equal_2_object();
  Construct_direction_2 direction = t.construct_direction_2_object();
  Construct_strip_2 strip = t.construct_strip_2_object();
  Width_less_strip_2 width_less = t.width_less_strip_2_object();
  typename Traits::Less_angle_with_x_axis_2
    less_angle = t.less_angle_with_x_axis_2_object();

  // check for trivial cases
  if (f == l) return o;
  ForwardIterator first;
  do {
    first = f;
    if (++f == l)
      // strip undefined, if no two distinct points exist
      return o;
  } while (equal(*first, *f));

  // quadruple of points defining the bounding box
  ForwardIterator curr[4];
  // initialised to the points defining the bounding box
  convex_bounding_box_2(first, l, curr, t);

  ForwardIterator low = curr[0];
  ForwardIterator upp = curr[2];

  int yet_to_finish = 2;

  ForwardIterator nlow = low;
  if (++nlow == l)
    nlow = first;
  Direction_2 low_dir = direction(*low, *nlow);
  ForwardIterator nupp = upp;
  if (++nupp == l)
    nupp = first;
  Direction_2 upp_dir = direction(*nupp, *upp);

  bool low_goes_next = less_angle(low_dir, upp_dir);
  Strip_2 strip_so_far = low_goes_next ?
    strip(*low, low_dir, *upp) : strip(*low, upp_dir, *upp);

  for (;;) {
    // compute next direction
    if (low_goes_next) {
      low = nlow;
      if (low == curr[2])
        if (--yet_to_finish <= 0)
          break;
      if (++nlow == l)
        nlow = first;
      low_dir = direction(*low, *nlow);
    } else {
      upp = nupp;
      if (upp == curr[0])
        if (--yet_to_finish <= 0)
          break;
      if (++nupp == l)
        nupp = first;
      upp_dir = direction(*nupp, *upp);
    }

    low_goes_next = less_angle(low_dir, upp_dir);
    Strip_2 test_strip = low_goes_next ?
      strip(*low, low_dir, *upp) : strip(*low, upp_dir, *upp);
    if (width_less(test_strip, strip_so_far))
      strip_so_far = test_strip;

  } // for (;;)

  // return the result
  return t.copy_strip_lines_2(strip_so_far, o);

} // min_strip_2(f, l, o, t)


} //namespace CGAL
#include <CGAL/Min_quadrilateral_traits_2.h>
namespace CGAL {

template < class ForwardIterator, class OutputIterator >
inline
OutputIterator
min_rectangle_2(ForwardIterator f,
         ForwardIterator l,
         OutputIterator o)
{
  typedef typename std::iterator_traits< ForwardIterator >::value_type VT;
  typedef typename Kernel_traits<VT>::Kernel Kernel;
  Min_quadrilateral_default_traits_2<Kernel> t;
  return min_rectangle_2(f, l, o, t);
} // min_rectangle_2(f, l, o)

#ifndef CGAL_NO_DEPRECATED_CODE
// backwards compatibility
template < class ForwardIterator, class OutputIterator >
inline
OutputIterator
minimum_enclosing_rectangle_2(ForwardIterator f,
                       ForwardIterator l,
                       OutputIterator o)
{ return min_rectangle_2(f, l, o); }
#endif // CGAL_NO_DEPRECATED_CODE
template < class ForwardIterator, class OutputIterator >
inline
OutputIterator
min_parallelogram_2(ForwardIterator f,
         ForwardIterator l,
         OutputIterator o)
{
  typedef typename std::iterator_traits< ForwardIterator >::value_type VT;
  typedef typename Kernel_traits<VT>::Kernel Kernel;
  Min_quadrilateral_default_traits_2<Kernel> t;
  return min_parallelogram_2(f, l, o, t);
} // min_parallelogram_2(f, l, o)

#ifndef CGAL_NO_DEPRECATED_CODE
// backwards compatibility
template < class ForwardIterator, class OutputIterator >
inline
OutputIterator
minimum_enclosing_parallelogram_2(ForwardIterator f,
                       ForwardIterator l,
                       OutputIterator o)
{ return min_parallelogram_2(f, l, o); }
#endif // CGAL_NO_DEPRECATED_CODE
template < class ForwardIterator, class OutputIterator >
inline
OutputIterator
min_strip_2(ForwardIterator f,
         ForwardIterator l,
         OutputIterator o)
{
  typedef typename std::iterator_traits< ForwardIterator >::value_type VT;
  typedef typename Kernel_traits<VT>::Kernel Kernel;
  Min_quadrilateral_default_traits_2<Kernel> t;
  return min_strip_2(f, l, o, t);
} // min_strip_2(f, l, o)

#ifndef CGAL_NO_DEPRECATED_CODE
// backwards compatibility
template < class ForwardIterator, class OutputIterator >
inline
OutputIterator
minimum_enclosing_strip_2(ForwardIterator f,
                       ForwardIterator l,
                       OutputIterator o)
{ return min_strip_2(f, l, o); }
#endif // CGAL_NO_DEPRECATED_CODE

} //namespace CGAL

#endif // ! (CGAL_MIN_QUADRILATERAL_2_H)