\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.12 - 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:
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. 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...
 

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.

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.