Core 1.0
Polygons2 Class Reference

Set of disjoint polygons. More...

#include <polygon.h>

Public Member Functions

 Polygons2 ()
 Empty.
 
 Polygons2 (const QVector< Polygon2 > &)
 Create a set of polygons.
 
 Polygons2 (const QVector< Polygonal > &)
 Create a set of polygons by projecting polygons in space.
 
int Size () const
 Return the size of the set.
 
 ~Polygons2 ()
 Empty.
 
bool Inside (const Vector2 &) const
 Test if a point is inside the union of a set of polygons.
 
double R (const Vector2 &) const
 Compute the squared distance between a point and a set of polygons.
 
double Signed (const Vector2 &) const
 Compute the signed distance between a point and a set of polygons.
 
double Area () const
 Compute the area of the set of polygons.
 
double Length () const
 Compute the perimeter of the set of polygons.
 
void Resample (const double &)
 Resample the edges of the set of polygons.
 
const Polygon2At (int) const
 Access.
 
void Add (const Polygon2 &)
 Add a polygon to the set.
 
void Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const
 Draw a polygon.
 

Protected Attributes

QVector< Polygon2poly
 Set of polygons.
 

Detailed Description

Set of disjoint polygons.

Constructor & Destructor Documentation

◆ Polygons2() [1/2]

Polygons2::Polygons2 ( const QVector< Polygon2 > & p)

Create a set of polygons.

Parameters
pSet of polygons.

◆ Polygons2() [2/2]

Polygons2::Polygons2 ( const QVector< Polygonal > & p)

Create a set of polygons by projecting polygons in space.

Parameters
pSet of polygons.

Member Function Documentation

◆ Add()

void Polygons2::Add ( const Polygon2 & p)

Add a polygon to the set.

Parameters
pPolygon.

◆ Area()

double Polygons2::Area ( ) const

Compute the area of the set of polygons.

The polygons should not intersect or overlap.

◆ At()

const Polygon2 & Polygons2::At ( int i) const
inline

Access.

Parameters
iIndex.

◆ Draw()

void Polygons2::Draw ( QGraphicsScene & scene,
const QPen & pen = QPen(),
const QBrush & brush = QBrush() ) const

Draw a polygon.

Parameters
sceneGraphics scene.
penThe pen.
brushThe brush, should the triangle be filled.

◆ Inside()

bool Polygons2::Inside ( const Vector2 & p) const

Test if a point is inside the union of a set of polygons.

Polygons should be non intersecting. Polygons inside others will be considered as holes.

Parameters
pPoint.

◆ R()

double Polygons2::R ( const Vector2 & p) const

Compute the squared distance between a point and a set of polygons.

Parameters
pPoint.

◆ Resample()

void Polygons2::Resample ( const double & e)

Resample the edges of the set of polygons.

See also
Polygons::Resampled(const double&)
Parameters
eDistance.

◆ Signed()

double Polygons2::Signed ( const Vector2 & p) const

Compute the signed distance between a point and a set of polygons.

Parameters
pPoint.