Navigation: Up, Table of Contents, Bibliography, Index, Title Page

Computing General Extremal Polygons

This section describes a general function to compute a maximal k-gon Pk that can be inscribed in a given convex polygon P. The criterion for maximality and some basic operations have to specified in an appropriate traits class as specified in section reference.

#include <CGAL/extremal_polygons_2.h>

template < class RandomAccessIC, class OutputIterator, class Traits >
OutputIterator
extremal_polygon (
RandomAccessIC points_begin,
RandomAccessIC points_end,
int k,
OutputIterator o,
Traits t)

computes a maximal (as specified by t) inscribed k-gon of the convex polygon described by [points_begin, points_end), writes its vertices to o and returns the past-the-end iterator of this sequence.

Precondition

  1. Traits has to satisfy the requirements stated in section reference,
  2. Value type of RandomAccessIC must be Traits::Point_2,
  3. OutputIterator accepts Traits::Point_2 as value type,
  4. the - at least three - points denoted by the range [points_begin, points_end) form the boundary of a convex polygon (oriented clock- or counterclockwise) and
  5. k t.min_k().

Implementation

The implementation uses monotone matrix search[AKM+87] and has a worst case running time of O(k · n + n · logn), where n is the number of vertices in P.
Next: Class declaration of Exp_traits
Navigation: Up, Table of Contents, Bibliography, Index, Title Page
The GALIA project. Jan 18, 2000.