PPolygonf Class Reference

Detailed Description

The PPolygonf class represents a 2D closed polygon with float coordinates.

Definition at line 29 of file PPolygonf.h.

#include <PPolygonf.h>

Constructor & Destructor Documentation

◆ PPolygonf() [1/3]

PPolygonf::PPolygonf ( const std::vector< PPoint2Df > &  points = std::vector< PPoint2Df >())

Constructs a polygon from the specified list of 2D-points.

◆ PPolygonf() [2/3]

PPolygonf::PPolygonf ( const PRectanglef r)

Constructs a polygon from the specified rectangle.

◆ PPolygonf() [3/3]

PPolygonf::PPolygonf ( const PPolygonf other)

Constructs a shared copy of other.

◆ ~PPolygonf()

virtual PPolygonf::~PPolygonf ( )
virtual

Destroys this object.

Member Function Documentation

◆ AddPoint() [1/2]

PPolygonf& PPolygonf::AddPoint ( float  x,
float  y,
papillon::int32  index = -1 
)

Inserts a point to this polygon at the specified index.

If index is -1 or invalid, then add the point at the end.

AddPoint() can be chained.

◆ AddPoint() [2/2]

PPolygonf& PPolygonf::AddPoint ( const PPoint2Df p,
papillon::int32  index = -1 
)

Inserts a point to this polygon at the specified index.

If index is -1 or invalid, then add the point at the end.

AddPoint() can be chained.

◆ Clear()

void PPolygonf::Clear ( )

Removes all points of this polygon.

◆ GetBoundingRectangle()

PRectanglef PPolygonf::GetBoundingRectangle ( ) const

Returns the bounding rectangle of this polygon.

◆ GetConvexHull()

PPolygonf PPolygonf::GetConvexHull ( ) const

Returns the convex hull of this polygon.

If the polygon is convex, then the convex hull is the same polygon.

◆ GetFirstPoint()

PPoint2Df PPolygonf::GetFirstPoint ( ) const

Returns the first point of this polygon of PPoint2Df::Bad() if the polygon is empty.

◆ GetLastPoint()

PPoint2Df PPolygonf::GetLastPoint ( ) const

Returns the last point of this polygon of PPoint2Df::Bad() if the polygon is empty.

◆ GetPoint()

PPoint2Df PPolygonf::GetPoint ( papillon::int32  index) const

Returns the point with the specified index.

Returns an invalid point (PPoint2Df::Bad() if the index is invalid.

◆ Intersected()

PPolygonf PPolygonf::Intersected ( const PPolygonf other) const

Returns a polygon which is the intersection of this polygon and other.

◆ IsEmpty()

bool PPolygonf::IsEmpty ( ) const

Returns true if this polygon has no points, false otherwise.

◆ operator=()

PPolygonf& PPolygonf::operator= ( const PPolygonf other)

Performs a shared copy of other to this object.

◆ SetPoint()

void PPolygonf::SetPoint ( papillon::int32  index,
const PPoint2Df pt 
)

Sets the coordinates of the point with the specified index.

Do nothing if the index is invalid.

◆ Size()

papillon::int32 PPolygonf::Size ( ) const

Returns the number of points in this polygon.

◆ Translated()

PPolygonf PPolygonf::Translated ( const PPoint2Df v) const

Returns a translated polygon from this one.

v is the translation vector.

◆ United()

PPolygonf PPolygonf::United ( const PPolygonf other) const

Returns a polygon which is the union of this polygon and other.