Walls And Holes  1
BetterPolygon Class Reference

The Polygon class. More...

#include <polygon.h>

Public Member Functions

 BetterPolygon ()
 
 BetterPolygon (const QVector< QPointF > &points)
 
 BetterPolygon (const QPolygonF &polygon)
 
bool isValid () const
 
bool chordIsClear (int ind1, int ind2) const
 chordIsClear More...
 
bool connectionIsClear (const BetterPolygon &other, int pointOnThis, int pointOnOther) const
 
bool overlaps (const BetterPolygon &other) const
 
QPair< BetterPolygon, BetterPolygonsplitPolygon () const
 splitPolygon More...
 
QPair< BetterPolygon, BetterPolygonsplitPolygon (QPair< int, int > chord) const
 splitPolygon More...
 
QList< Triplet< QPointF, QPointF, QPointF > > triangulate () const
 triangulate More...
 
QVector< BetterPolygonsubtract (const BetterPolygon &other) const
 
QVector< BetterPolygonintersect (const BetterPolygon &other) const
 
QVector< BetterPolygonunited (const BetterPolygon &other) const
 
const QVector< QPointF > & points () const
 
QVector< QPointF > & points ()
 
void translate (const QPointF &p)
 
void translate (float x, float y)
 

Detailed Description

The Polygon class.

Strict polygon class with floating point precision.

Rules of this are: All points must be unique No edges may overlap Points must be counter clockwise

Constructor & Destructor Documentation

◆ BetterPolygon() [1/3]

BetterPolygon::BetterPolygon ( )
inline
Here is the caller graph for this function:

◆ BetterPolygon() [2/3]

BetterPolygon::BetterPolygon ( const QVector< QPointF > &  points)
Here is the call graph for this function:

◆ BetterPolygon() [3/3]

BetterPolygon::BetterPolygon ( const QPolygonF &  polygon)

Member Function Documentation

◆ chordIsClear()

bool BetterPolygon::chordIsClear ( int  ind1,
int  ind2 
) const

chordIsClear

Returns true if the chord between ind1 and ind2 do not intersect anypart of the polygon

Parameters
ind1
ind2
Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ connectionIsClear()

bool BetterPolygon::connectionIsClear ( const BetterPolygon other,
int  pointOnThis,
int  pointOnOther 
) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ intersect()

QVector< BetterPolygon > BetterPolygon::intersect ( const BetterPolygon other) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isValid()

bool BetterPolygon::isValid ( ) const
Here is the call graph for this function:

◆ overlaps()

bool BetterPolygon::overlaps ( const BetterPolygon other) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ points() [1/2]

const QVector<QPointF>& BetterPolygon::points ( ) const
inline
Here is the caller graph for this function:

◆ points() [2/2]

QVector<QPointF>& BetterPolygon::points ( )
inline

◆ splitPolygon() [1/2]

QPair< BetterPolygon, BetterPolygon > BetterPolygon::splitPolygon ( ) const

splitPolygon

split this polygon into two with some chord. The chord is choosen at random.

Returns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ splitPolygon() [2/2]

QPair< BetterPolygon, BetterPolygon > BetterPolygon::splitPolygon ( QPair< int, int >  chord) const

splitPolygon

Attempt to split the polygon at a given chord. If the chord is not clear, this will be returned as the first Polygon, and the second will be empty.

Parameters
chord
Returns
Here is the call graph for this function:

◆ subtract()

QVector< BetterPolygon > BetterPolygon::subtract ( const BetterPolygon other) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ translate() [1/2]

void BetterPolygon::translate ( const QPointF &  p)
inline

◆ translate() [2/2]

void BetterPolygon::translate ( float  x,
float  y 
)
inline

◆ triangulate()

QList< Triplet< QPointF, QPointF, QPointF > > BetterPolygon::triangulate ( ) const

triangulate

Returns a list of triangles that represent this polygon

Returns
Here is the call graph for this function:

◆ united()

QVector< BetterPolygon > BetterPolygon::united ( const BetterPolygon other) const
Here is the call graph for this function:

The documentation for this class was generated from the following files: