CGAL 4.12.1 - 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.

## 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.

An ASCII and a binary format exist. The stream detects the format automatically and can read both.

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.