CGAL 6.1.1 - 2D Regularized Boolean Set-Operations

Loading...
Searching...
No Matches
List of all members | Related Functions
CGAL::General_polygon_2< ArrTraits > Class Template Reference
Reference Manual

`#include <CGAL/General_polygon_2.h>`

## Definition

template<typename ArrTraits>
class CGAL::General_polygon_2< ArrTraits >

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 `AosDirectionalXMonotoneTraits_2`. The latter is a refinement of the concept `AosXMonotoneTraits_2`. In addition to the requirements of the concept `AosXMonotoneTraits_2`, a model of the concept `AosDirectionalXMonotoneTraits_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
  Boolean_set_operations_2/conic_traits_adapter.cpp.

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

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

## Predicates
bool | is_empty ()
| returns `true` if the polygon is empty, and `false` otherwise.
Orientation | orientation ()
| returns the orientation of the polygon.

## Member Function Documentation

## ◆ 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()`.

## Friends And Related Function Documentation

## ◆ operator<<()

template<class ArrTraits >

std::ostream & operator<< | ( | std::ostream & | out,
|  | CGAL::General_polygon_2< ArrTraits > & | P
| ) |  |
| related

This operator exports a general polygon to the output stream `out`.

An ASCII and a binary format exist. The format can be selected with the CGAL modifiers for streams, `set_ascii_mode` and `set_binary_mode` respectively. The modifier `set_pretty_mode` can be used to allow for (a few) structuring comments in the output. Otherwise, the output would be free of comments. The default for writing is ASCII without comments.

The number of curves of the outer boundary is exported followed by the curves themselves in counterclockwise order.

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