Class that represents a polygon in 2D space. More...
#include <Common.hpp>
Public Member Functions | |
| Polygon2D () | |
| Constructor of a polygon still without points. | |
| Polygon2D (const std::vector< sal3d::Point2D > &points) | |
| Constructor from a std::vector<sal3d::Point2D>. | |
| Polygon2D (const sal3d_polygon2d &polygon) | |
| Constructor from a C sal3d_polygon2d. Creates a new C++ object that holds it. | |
| Polygon2D (const Polygon2D &polygon) | |
| Copy constructor. | |
| ~Polygon2D () | |
| Destructor. | |
| sal3d_polygon2d | c_polygon_2d () const |
| Returns the internal C polygon2d structrue. | |
| int | numPoints () const |
| Returns the number of sal3d::Point2D points the Polygon2D contains. | |
| void | appendPoint (const sal3d::Point2D &point) |
| Appends a sal3d::Point2D at the end of the polygon. | |
| void | insertPoint (const sal3d::Point2D &point, int pos) |
| Inserts a sal3d::Point2D at the specified location. | |
| sal3d::Point2D | removePoint () |
| Removes a sal3d::Point2D from the end of the polygon. | |
| sal3d::Point2D | removePoint (int pos) |
| Removes the sal3d::Point2D at the specified location. | |
| void | removePoints () |
| Removes all sal3d::Point2D that define the Polygon2D. | |
| void | setPoints (const std::vector< sal3d::Point2D > &points) |
| Sets all the points of the Polygon2D to the ones of the parameter. | |
| std::vector< sal3d::Point2D > | getPoints () const |
| Returns the points that define the Polygon2D. | |
| sal3d::Point2D | getPoint (int pos) const |
| Returns the sal3d::Point2D at the specified location. | |
| bool | isPointInside (const sal3d::Point2D &point) const |
Checks whether the point is inside this Polygon2D. | |
| Polygon2D & | operator= (const Polygon2D &polygon) |
| Assignment operator. | |
Class that represents a polygon in 2D space.
| sal3d::Polygon2D::Polygon2D | ( | const std::vector< sal3d::Point2D > & | points | ) | [inline, explicit] |
Constructor from a std::vector<sal3d::Point2D>.
The list of points should have at least one element.
| [in] | points | A vector of sal3d::Point2D that describe the Polygon2D. |
| sal3d::Polygon2D::Polygon2D | ( | const sal3d_polygon2d & | polygon | ) | [inline, explicit] |
Constructor from a C sal3d_polygon2d. Creates a new C++ object that holds it.
| [in] | polygon | A C representation of a Polygon2D |
| sal3d::Polygon2D::Polygon2D | ( | const Polygon2D & | polygon | ) | [inline] |
Copy constructor.
| [in] | polygon | The Polygon2D to copy from. |
| sal3d::Polygon2D::~Polygon2D | ( | ) | [inline] |
Destructor.
The object is destroyed and its memory released.
| void sal3d::Polygon2D::appendPoint | ( | const sal3d::Point2D & | point | ) | [inline] |
Appends a sal3d::Point2D at the end of the polygon.
| [in] | point | Point2D that will be added to the polygon. |
References sal3d::Point2D::c_point_2d().
| sal3d_polygon2d sal3d::Polygon2D::c_polygon_2d | ( | ) | const [inline] |
Returns the internal C polygon2d structrue.
Referenced by sal3d::COP::cropGL().
| sal3d::Point2D sal3d::Polygon2D::getPoint | ( | int | pos | ) | const [inline] |
Returns the sal3d::Point2D at the specified location.
| [in] | pos | The position of the Point2D to retrieve |
| std::vector<sal3d::Point2D> sal3d::Polygon2D::getPoints | ( | ) | const [inline] |
Returns the points that define the Polygon2D.
References numPoints().
| void sal3d::Polygon2D::insertPoint | ( | const sal3d::Point2D & | point, |
| int | pos | ||
| ) | [inline] |
Inserts a sal3d::Point2D at the specified location.
| [in] | point | Point2D that will be added to the polygon. |
| [in] | pos | The position of the Point2D to add |
References sal3d::Point2D::c_point_2d().
| bool sal3d::Polygon2D::isPointInside | ( | const sal3d::Point2D & | point | ) | const [inline] |
Checks whether the point is inside this Polygon2D.
References sal3d::Point2D::c_point_2d().
| int sal3d::Polygon2D::numPoints | ( | ) | const [inline] |
Returns the number of sal3d::Point2D points the Polygon2D contains.
Referenced by getPoints().
Assignment operator.
| [in] | polygon | The Polygon2D to copy to this object. |
| sal3d::Point2D sal3d::Polygon2D::removePoint | ( | ) | [inline] |
Removes a sal3d::Point2D from the end of the polygon.
| sal3d::Point2D sal3d::Polygon2D::removePoint | ( | int | pos | ) | [inline] |
Removes the sal3d::Point2D at the specified location.
| [in] | pos | The position of the Point2D to remove |
| void sal3d::Polygon2D::setPoints | ( | const std::vector< sal3d::Point2D > & | points | ) | [inline] |
by
1.7.6.1