ContRap-Libraries
Public Member Functions | Protected Attributes

crp::Polygon2D Class Reference

Class Polygon2D represents a polygon. More...

#include <primitives.h>

Inheritance diagram for crp::Polygon2D:
crp::Primitive2D

Public Member Functions

 Polygon2D (double x=0.0, double y=0.0)
 Creates a new empty polygon.
virtual ~Polygon2D ()
 Destructor.
 Polygon2D (const Polygon2D &primitive)
 Copy constructor.
Polygon2Doperator= (const Polygon2D &primitive)
 Assignment operator.
std::vector< Pixel > & get_corners ()
 Returns the corners of the polygon.
void set_corners (std::vector< Pixel > &corners)
 Sets the corners of the polygon.
void add_corner (Pixel corner)
 Add the corners to the polygon.
void clean_corners ()
 Cleans list of corners.
virtual Type get_type () const
 Type of the primitive.
virtual Primitive2Dget_copy ()
 Copies the current primitive.

Protected Attributes

std::vector< Pixelcorners
 Corners of the polygon.

Detailed Description

Class Polygon2D represents a polygon.


Constructor & Destructor Documentation

crp::Polygon2D::Polygon2D ( double  x = 0.0,
double  y = 0.0 
) [inline]

Creates a new empty polygon.

Parameters:
xX-Coordinate
yY-Coordinate
rRadius
virtual crp::Polygon2D::~Polygon2D ( ) [inline, virtual]

Destructor.

crp::Polygon2D::Polygon2D ( const Polygon2D primitive) [inline]

Copy constructor.

Parameters:
primitivePrimitive to copy

Member Function Documentation

void crp::Polygon2D::add_corner ( Pixel  corner) [inline]

Add the corners to the polygon.

Parameters:
cornerNew corner of the polygon
void crp::Polygon2D::clean_corners ( ) [inline]

Cleans list of corners.

virtual Primitive2D* crp::Polygon2D::get_copy ( ) [inline, virtual]

Copies the current primitive.

Returns:
New copy of the current primitive

Implements crp::Primitive2D.

std::vector<Pixel>& crp::Polygon2D::get_corners ( ) [inline]

Returns the corners of the polygon.

Returns:
Vector of corners
virtual Type crp::Polygon2D::get_type ( ) const [inline, virtual]

Type of the primitive.

Returns:
Type of the primitive

Implements crp::Primitive2D.

Polygon2D& crp::Polygon2D::operator= ( const Polygon2D primitive) [inline]

Assignment operator.

Parameters:
primitiveObject to assign
void crp::Polygon2D::set_corners ( std::vector< Pixel > &  corners) [inline]

Sets the corners of the polygon.

Parameters:
cornersList of corners.

Field Documentation

std::vector<Pixel> crp::Polygon2D::corners [protected]

Corners of the polygon.


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