Polygons are defined as line segments passing through a suite of 2D points and enclosing a surface, since the last vector points towards the first. More...
#include <OSDLPolygon.h>
Public Member Functions | |
Polygon (listPoint2D &summits, bool listOwner=false) | |
Creates a polygon from a suite of summit vertices. | |
virtual | ~Polygon () throw () |
Basic virtual destructor. | |
virtual bool | draw (Surface &targetSurface, Pixels::ColorDefinition colorDef=Pixels::White, bool filled=true) const |
Draws the polygon on specified surface, with specified color. | |
virtual listPoint2D & | getPoints () const |
Returns the points that this polygon gathered. | |
virtual void | setPoints (listPoint2D &newList) |
Sets the vertex list for this polygon. | |
virtual bool | isListOwner () const |
Tells whether the polygon owns its points. | |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const |
Returns an user-friendly description of the state of this object. | |
Static Public Member Functions | |
static Polygon & | CreateFlakeBranch (Length length=200, Length thickness=20, Ceylan::Maths::AngleInDegrees childAngle=50, Ceylan::Maths::Ratio branchingHeightRatio=0.7, Ceylan::Maths::Ratio scale=0.3) |
Creates a polygon whose shape is a snow flake, and which has no local referential registered. | |
static listPoint2D & | Duplicate (const listPoint2D &source) |
Duplicates specified list of points: returns another list containing clones of each points in source. | |
static void | Delete (listPoint2D &listToBeDeleted) |
Deletes specified list of points, including the points themselves. | |
static listPoint2D & | Append (listPoint2D &toBeAugmented, const listPoint2D &toAppend) |
Appends a shallow (not deep) copy of the toAppend list to the toBeAugmented list. | |
static listPoint2D & | Apply (const Ceylan::Maths::Linear::HomogeneousMatrix3 &transformation, listPoint2D &sourceList) |
Applies transformation, specified as a 3x3 homogeneous matrix, to each point of sourceList. | |
Private Member Functions | |
Polygon (const Polygon &source) | |
Copy constructor made private to ensure that it will be never called. | |
Polygon & | operator= (const Polygon &source) |
Assignment operator made private to ensure that it will be never called. | |
Private Attributes | |
listPoint2D * | _summits |
List of the summits of the polygon. | |
bool | _listOwner |
Tells whether the polygon owns the lists and the points that are stored in it. |
Polygons are defined as line segments passing through a suite of 2D points and enclosing a surface, since the last vector points towards the first.
All these vectors are to be defined in the Polygon's own 2D referential.
Definition at line 385 of file OSDLPolygon.h.
Polygon::Polygon | ( | listPoint2D & | summits, | |
bool | listOwner = false | |||
) | [explicit] |
Creates a polygon from a suite of summit vertices.
summits | the input list of summits for this polygon. | |
listOwner | tells whether this polygon owns the specified point list and the points in it (and therefore will deallocate them) or not (in this case, neither the list object nor the points will be deallocated). |
Definition at line 493 of file OSDLPolygon.cc.
Polygon::~Polygon | ( | ) | throw () [virtual] |
Basic virtual destructor.
Definition at line 503 of file OSDLPolygon.cc.
References _listOwner, and _summits.
OSDL::Video::TwoDimensional::Polygon::Polygon | ( | const Polygon & | source | ) | [explicit, private] |
Copy constructor made private to ensure that it will be never called.
The compiler should complain whenever this undefined constructor is called, implicitly or not.
listPoint2D & Polygon::Append | ( | listPoint2D & | toBeAugmented, | |
const listPoint2D & | toAppend | |||
) | [static] |
Appends a shallow (not deep) copy of the toAppend list to the toBeAugmented list.
Definition at line 810 of file OSDLPolygon.cc.
static listPoint2D& OSDL::Video::TwoDimensional::Polygon::Apply | ( | const Ceylan::Maths::Linear::HomogeneousMatrix3 & | transformation, | |
listPoint2D & | sourceList | |||
) | [static] |
Applies transformation, specified as a 3x3 homogeneous matrix, to each point of sourceList.
transformation | the 2D geometrical transformation, specified as a 3x3 homogeneous matrix. | |
sourceList | the list of points to transform. It will be updated thanks to the transformation. |
Referenced by draw().
static Polygon& OSDL::Video::TwoDimensional::Polygon::CreateFlakeBranch | ( | Length | length = 200 , |
|
Length | thickness = 20 , |
|||
Ceylan::Maths::AngleInDegrees | childAngle = 50 , |
|||
Ceylan::Maths::Ratio | branchingHeightRatio = 0.7 , |
|||
Ceylan::Maths::Ratio | scale = 0.3 | |||
) | [static] |
Creates a polygon whose shape is a snow flake, and which has no local referential registered.
length | defines the height of the main branch of this flake. | |
thickness | defines the width of the main branch of this flake. | |
childAngle | defines the angle, in degrees, between the main branch and the second branch. | |
branchingHeightRatio | tells at which height of the main branch the second shall begin. | |
scale | defines the ratio of the second branch relatively to the main one. |
void Polygon::Delete | ( | listPoint2D & | listToBeDeleted | ) | [static] |
Deletes specified list of points, including the points themselves.
Definition at line 793 of file OSDLPolygon.cc.
Referenced by setPoints(), and OSDL::Video::TwoDimensional::PolygonSet::~PolygonSet().
bool Polygon::draw | ( | Surface & | targetSurface, | |
Pixels::ColorDefinition | colorDef = Pixels::White , |
|||
bool | filled = true | |||
) | const [virtual] |
Draws the polygon on specified surface, with specified color.
The polygon can be rendered after transformation with the embedded matrix, the referential of this Locatable.
In all cases the place where to render the polygon on surface is determined by this inner matrix.
targetSurface | the surface to draw to. | |
colorDef | the polygon color. | |
filled | tells whether the polygon should be filled. |
Definition at line 534 of file OSDLPolygon.cc.
References _summits, Apply(), OSDL::Video::TwoDimensional::drawPolygon(), and Duplicate().
listPoint2D & Polygon::Duplicate | ( | const listPoint2D & | source | ) | [static] |
Duplicates specified list of points: returns another list containing clones of each points in source.
Definition at line 774 of file OSDLPolygon.cc.
Referenced by draw().
listPoint2D & Polygon::getPoints | ( | ) | const [virtual] |
Returns the points that this polygon gathered.
Definition at line 564 of file OSDLPolygon.cc.
References _summits.
Referenced by OSDL::Video::TwoDimensional::PolygonSet::addPointsOf().
bool Polygon::isListOwner | ( | ) | const [virtual] |
Tells whether the polygon owns its points.
Definition at line 590 of file OSDLPolygon.cc.
References _listOwner.
Referenced by OSDL::Video::TwoDimensional::PolygonSet::addPointsOf().
Assignment operator made private to ensure that it will be never called.
The compiler should complain whenever this undefined operator is called, implicitly or not.
void Polygon::setPoints | ( | listPoint2D & | newList | ) | [virtual] |
Sets the vertex list for this polygon.
newList | the new list of vertices. |
Any pre-existing owned list will be deallocated first.
Definition at line 573 of file OSDLPolygon.cc.
References _listOwner, _summits, and Delete().
const string Polygon::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const [virtual] |
Returns an user-friendly description of the state of this object.
level | the requested verbosity level. |
Definition at line 599 of file OSDLPolygon.cc.
References _summits, generate_master_palette::count, and OSDL::Video::Pixels::toString().
bool OSDL::Video::TwoDimensional::Polygon::_listOwner [private] |
Tells whether the polygon owns the lists and the points that are stored in it.
Definition at line 635 of file OSDLPolygon.h.
Referenced by isListOwner(), setPoints(), and ~Polygon().
List of the summits of the polygon.
Definition at line 624 of file OSDLPolygon.h.
Referenced by draw(), getPoints(), setPoints(), toString(), and ~Polygon().