 CGAL 5.4 - 2D Regularized Boolean Set-Operations
CGAL::General_polygon_2< ArrTraits > Class Template Reference

#include <CGAL/General_polygon_2.h>

## Definition

The class General_polygon_2 models the concept GeneralPolygon_2.

It represents a simple general-polygon. It is parameterized with the type ArrTraits that models the concept ArrangementDirectionalXMonotoneTraits_2. The latter is a refinement of the concept ArrangementXMonotoneTraits_2. In addition to the requirements of the concept ArrangementXMonotoneTraits_2, a model of the concept ArrangementDirectionalXMonotoneTraits_2 must support the following functions:

• Given an $$x$$-monotone curve, construct its opposite curve.
• Given an $$x$$-monotone curve, compare its two endpoints lexicographically.

This class supports a few convenient operations in addition to the requirements that the concept GeneralPolygon_2 lists.

Is Model Of:
GeneralPolygon_2
Examples:

## Related Functions

(Note that these are not member functions.)

template<class ArrTraits >
std::istream & operator>> (std::istream &in, CGAL::General_polygon_2< ArrTraits > &P)
This operator imports a general polygon from the input stream in. More...

template<class ArrTraits >
std::ostream & operator<< (std::ostream &out, CGAL::General_polygon_2< ArrTraits > &P)
This operator exports a general polygon to the output stream out. More...

## Types

typedef unspecified_type Size
number of edges size type.

typedef ArrTraits::Curve_2 Curve_2
a general planar curve.

## Construction

template<class CurveIterator >
General_polygon_2 (CurveIterator begin, CurveIterator end)
constructs a General_polygon_2 from a $$X$$-monotone curves.

## Operations

Size size ()
returns the number of edges of the general polygon.

## Modifiers

void clear ()
clears the polygon.

void reverse_orientation ()
reverses the orientation of the polygon. More...

## Predicates

bool is_empty ()
returns true if the polygon is empty, and false otherwise.

Orientation orientation ()
returns the orientation of the polygon. More...

## ◆ orientation()

template<typename ArrTraits >
 Orientation CGAL::General_polygon_2< ArrTraits >::orientation ( )

returns the orientation of the polygon.

Precondition
is_simple().

## ◆ reverse_orientation()

template<typename ArrTraits >
 void CGAL::General_polygon_2< ArrTraits >::reverse_orientation ( )

reverses the orientation of the polygon.

Precondition
is_simple().

## ◆ operator>>()

template<class ArrTraits >
 std::istream & operator>> ( std::istream & in, CGAL::General_polygon_2< ArrTraits > & P )
related

This operator imports a general polygon from the input stream in.

Both ASCII and binary formats are supported, and the format is automatically detected.

The format consists of the number of points of the outer boundary followed by the points themselves in counterclockwise order, followed by the number of holes, and for each hole, the number of points of the outer boundary is followed by the points themselves in clockwise order.