Free Polygon class. More...

#include <rfreepolygon.h>

Inheritance diagram for RFreePolygon:
[legend]
Collaboration diagram for RFreePolygon:
[legend]

Public Member Functions

 RFreePolygon (const RPolygon &poly)
 
 RFreePolygon (const RFreePolygon &poly)
 
bool operator== (const RFreePolygon &poly) const
 
bool operator!= (const RFreePolygon &poly) const
 
int Compare (const RFreePolygon &poly) const
 
int CanContain (const RGeoInfo *info, RPoint &pos) const
 
RPoint GetPos (void)
 
- Public Member Functions inherited from RPolygon
 RPolygon (void)
 
 RPolygon (size_t nb,...)
 
 RPolygon (const RPolygon &poly)
 
int Compare (const RPolygon &poly) const
 
size_t GetNbVertices (void) const
 
R::RCursor< RPointGetVertices (void) const
 
void GetEdges (RContainer< RLine, true, false > &edges) const
 
const RPointoperator[] (size_t idx) const
 
RPointoperator[] (size_t idx)
 
void Clear (void)
 
void InsertVertex (tCoord x, tCoord y)
 
void InsertVertex (const RPoint &pt)
 
void InsertVertex (RPoint *pt)
 
void DeleteVertex (RPoint *pt)
 
RPolygonoperator= (const RPolygon &poly)
 
bool operator== (const RPolygon &poly) const
 
bool operator!= (const RPolygon &poly) const
 
RPolygonoperator+= (const RPoint &pt)
 
RPolygonoperator-= (const RPoint &pt)
 
RPoint GetConX (const RPoint &pt) const
 
RPoint GetConY (const RPoint &pt) const
 
RPoint GetBottomLeft (void) const
 
size_t GetBottomLeftIndex (void) const
 
RPointGetBottomLeft (const tCoord minx, const tCoord miny, const tCoord maxx) const
 
RPointGetLeftBottom (void) const
 
RPointGetLeftBottom (const tCoord minx, const tCoord miny, const tCoord maxy) const
 
RPoint GetTopRight (void) const
 
size_t GetTopRightIndex (void) const
 
RPointGetTopRight (const tCoord minx, const tCoord miny, const tCoord maxx) const
 
RPointGetRightTop (void) const
 
RPointGetRightTop (const tCoord minx, const tCoord miny, const tCoord maxy) const
 
bool IsVertex (const tCoord x, const tCoord y) const
 
bool IsVertex (const RPoint &pt) const
 
bool IsOnEdge (const tCoord x, const tCoord y) const
 
bool IsOnEdge (const RPoint &pt) const
 
bool IsOnEdge (const RPoint &pt1, const RPoint &pt2) const
 
bool IsIn (const RPoint &pt, bool overlap=true) const
 
bool IsIn (const tCoord x, const tCoord y, bool overlap=true) const
 
bool IsIn (const RPolygon &poly, bool overlap=true) const
 
size_t GetNbInter (const RLine &line) const
 
bool IsIn (const RLine &line, bool overlap=true) const
 
bool Contained (const RRect &rect) const
 
tCoord Area (void) const
 
void EdgeDecomposition (RContainer< RLine, true, false > &edges, RRect &outside) const
 
void ExternalBoundary (RRect &rect) const
 
void ChangeOrientation (const tOrientation o)
 
void RectDecomposition (RContainer< RRect, true, false > &rects) const
 
void Rectangularize (double loss)
 
void GetEdges (RContainer< RPoint, true, false > &points) const
 
bool IsClockwise (void) const
 
void ReOrder (void)
 
void ReValid (double t=0.0)
 
bool DuplicateVertices (void) const
 
RPoint GetCentralPoint (void)
 
void Save (RTextFile &f)
 
RPoint Calibrate (void)
 
bool IsRect (void) const
 
bool IsRectangular (void) const
 
bool IsSquare (void) const
 

Private Attributes

RPoint Pos
 
tCoord Area
 

Detailed Description

Free Polygon class.

The RFreePolygon class provides a representation of a "free" polygon on the grid.

Constructor & Destructor Documentation

RFreePolygon ( const RPolygon poly)

Construct a free polygon.

RFreePolygon ( const RFreePolygon poly)

Construct a free polygon from another one.

Member Function Documentation

bool operator== ( const RFreePolygon poly) const

The equal operator.

bool operator!= ( const RFreePolygon poly) const

The non-equal operator.

int Compare ( const RFreePolygon poly) const

This function compares two polygons and returns 0 if there have the same number of points and at the same positions. This function is used for the class RContainer.

Parameters
polyPolygon used for the comparison.
int CanContain ( const RGeoInfo info,
RPoint pos 
) const

This function test if a geometric information can be contained in the free polygon.

Parameters
infoThe geometric information to compare.
posPosition where the geometric information can eventually be inserted.
Returns
The function returns 0 if the polygon can't be contained, >0 if the polygon can be contained. The less is the space wasted, the greatest is the return value.
RPoint GetPos ( void  )

Return the position of the free polygon.

Member Data Documentation

RPoint Pos
private

The position of the polygon.

tCoord Area
private

Area of the polygon.