Represents a point whose coordinates are integers, in a two-dimensional space. More...
#include <OSDLPoint2D.h>
Public Member Functions | |
Point2D (Coordinate x=0, Coordinate y=0) | |
Constructor of a two dimensional point, from two coordinates. | |
Point2D (const Point2D &source) | |
Copy constructor. | |
Point2D (const Ceylan::Maths::Linear::Bipoint &source) | |
Creates a two dimensional point from a bipoint (conversion operator). | |
Point2D (const Ceylan::Maths::Linear::Vector2 &source) | |
Creates a two dimensional point from a 2D vector (conversion operator). | |
virtual | ~Point2D () throw () |
Virtual destructor of a two dimensional point. | |
virtual void | setTo (Coordinate x, Coordinate y) |
Sets the coordinates of this point to specified coordinates. | |
virtual void | setTo (FloatingPointCoordinate x, FloatingPointCoordinate y) |
Sets the coordinates of this point from specified floating-point coordinates. | |
virtual void | setFrom (const Point2D &source) |
Sets this point coordinates from specified point, whose coordinates are copied. | |
virtual void | setFrom (const Ceylan::Maths::Linear::Vector2 &source) |
Sets this point coordinates from specified 2D vector, whose coordinates are copied. | |
Coordinate | getX () const |
Returns the first coordinate (abscissa) of the point. | |
void | setX (Coordinate newX) |
Sets the first coordinate (abscissa) of the point. | |
Coordinate | getY () const |
Returns the second coordinate (ordinate) of the point. | |
void | setY (Coordinate newY) |
Sets the second coordinate (ordinate) of the point. | |
void | translate (Offset x, Offset y) |
Translates this point of vector [x,y]: adds x to this point's abscissa, and adds y to its ordinate. | |
virtual void | flip () |
Flips the coordinates of the point. | |
virtual void | flipX () |
Flips the abscissa of this point. | |
virtual void | flipY () |
Flips the oridinate of this point. | |
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 Point2D & | CreateFrom (FloatingPointCoordinate x=0, FloatingPointCoordinate y=0) |
Factory to create a two dimensional point from two floating-point coordinates. | |
static void | Translate (std::list< Point2D * > &pointList, Offset x, Offset y) |
Translates all the points in the list of vector [x,y]: adds x to each point's abscissa, and adds y to each point'sordinate. | |
Static Public Attributes | |
static const Point2D | Origin |
The origin of a 2D referential. | |
static const Ceylan::Maths::Linear::MatrixIndex | Dimensions = 2 |
Tells what is the dimension of the space this point is defined in. | |
Protected Attributes | |
Coordinate | _coord [Dimensions] |
Coordinates of the 2D point in space (abscissa, ordinate). |
Represents a point whose coordinates are integers, in a two-dimensional space.
Definition at line 67 of file OSDLPoint2D.h.
Point2D::Point2D | ( | Coordinate | x = 0 , |
|
Coordinate | y = 0 | |||
) | [explicit] |
Constructor of a two dimensional point, from two coordinates.
Definition at line 45 of file OSDLPoint2D.cc.
References _coord.
Referenced by CreateFrom().
Point2D::Point2D | ( | const Point2D & | source | ) |
Copy constructor.
Definition at line 55 of file OSDLPoint2D.cc.
References _coord.
Point2D::Point2D | ( | const Ceylan::Maths::Linear::Bipoint & | source | ) | [explicit] |
Creates a two dimensional point from a bipoint (conversion operator).
Definition at line 66 of file OSDLPoint2D.cc.
References _coord.
Point2D::Point2D | ( | const Ceylan::Maths::Linear::Vector2 & | source | ) | [explicit] |
Creates a two dimensional point from a 2D vector (conversion operator).
Definition at line 76 of file OSDLPoint2D.cc.
References _coord.
Point2D::~Point2D | ( | ) | throw () [virtual] |
Virtual destructor of a two dimensional point.
Definition at line 96 of file OSDLPoint2D.cc.
Point2D & Point2D::CreateFrom | ( | FloatingPointCoordinate | x = 0 , |
|
FloatingPointCoordinate | y = 0 | |||
) | [static] |
Factory to create a two dimensional point from two floating-point coordinates.
Floating-point coordinates are rounded to nearest integer coordinates.
x | the point abscissa. | |
y | the point ordinate. |
This is not a constructor, since otherwise it would collide with basic Coordinate-based constructor and force the user to cast integer values to Coordinates.
Definition at line 86 of file OSDLPoint2D.cc.
References Point2D().
void Point2D::flip | ( | ) | [virtual] |
Flips the coordinates of the point.
Implements OSDL::Video::TwoDimensional::Point.
Definition at line 166 of file OSDLPoint2D.cc.
References _coord.
void Point2D::flipX | ( | ) | [virtual] |
void Point2D::flipY | ( | ) | [virtual] |
Flips the oridinate of this point.
Definition at line 185 of file OSDLPoint2D.cc.
References _coord.
Coordinate OSDL::Video::TwoDimensional::Point2D::getX | ( | ) | const [inline] |
Returns the first coordinate (abscissa) of the point.
Definition at line 309 of file OSDLPoint2D.h.
References _coord.
Referenced by OSDL::Video::Surface::blitTo(), OSDL::Video::TwoDimensional::Line::draw(), OSDL::Video::TwoDimensional::Line::drawCross(), OSDL::Video::TwoDimensional::drawTriangle(), OSDL::Events::Mouse::setCursorPosition(), OSDL::Video::TwoDimensional::UprightRectangle::setLowerRightCorner(), OSDL::Video::TwoDimensional::UprightRectangle::setUpperLeftCorner(), OSDL::Video::OpenGL::OpenGLContext::setViewPort(), and OSDL::Video::TwoDimensional::UprightRectangle::UprightRectangle().
Coordinate OSDL::Video::TwoDimensional::Point2D::getY | ( | ) | const [inline] |
Returns the second coordinate (ordinate) of the point.
Definition at line 327 of file OSDLPoint2D.h.
References _coord.
Referenced by OSDL::Video::Surface::blitTo(), OSDL::Video::TwoDimensional::Line::draw(), OSDL::Video::TwoDimensional::Line::drawCross(), OSDL::Video::TwoDimensional::drawTriangle(), OSDL::Events::Mouse::setCursorPosition(), OSDL::Video::TwoDimensional::UprightRectangle::setLowerRightCorner(), OSDL::Video::TwoDimensional::UprightRectangle::setUpperLeftCorner(), OSDL::Video::OpenGL::OpenGLContext::setViewPort(), and OSDL::Video::TwoDimensional::UprightRectangle::UprightRectangle().
void Point2D::setFrom | ( | const Ceylan::Maths::Linear::Vector2 & | source | ) | [virtual] |
Sets this point coordinates from specified 2D vector, whose coordinates are copied.
Definition at line 133 of file OSDLPoint2D.cc.
References _coord.
void Point2D::setFrom | ( | const Point2D & | source | ) | [virtual] |
Sets this point coordinates from specified point, whose coordinates are copied.
Definition at line 123 of file OSDLPoint2D.cc.
References _coord.
void Point2D::setTo | ( | FloatingPointCoordinate | x, | |
FloatingPointCoordinate | y | |||
) | [virtual] |
Sets the coordinates of this point from specified floating-point coordinates.
Definition at line 113 of file OSDLPoint2D.cc.
References _coord.
void Point2D::setTo | ( | Coordinate | x, | |
Coordinate | y | |||
) | [virtual] |
Sets the coordinates of this point to specified coordinates.
Definition at line 103 of file OSDLPoint2D.cc.
References _coord.
void OSDL::Video::TwoDimensional::Point2D::setX | ( | Coordinate | newX | ) | [inline] |
Sets the first coordinate (abscissa) of the point.
Definition at line 318 of file OSDLPoint2D.h.
References _coord.
Referenced by OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners().
void OSDL::Video::TwoDimensional::Point2D::setY | ( | Coordinate | newY | ) | [inline] |
Sets the second coordinate (ordinate) of the point.
Definition at line 336 of file OSDLPoint2D.h.
References _coord.
Referenced by OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners().
const string Point2D::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const [virtual] |
Returns an user-friendly description of the state of this object.
level | the requested verbosity level. |
Reimplemented from OSDL::Video::TwoDimensional::Point.
Definition at line 143 of file OSDLPoint2D.cc.
References _coord.
Referenced by OSDL::Video::Surface::blitTo(), operator<<(), OSDL::Video::TwoDimensional::UprightRectangle::setLowerRightCorner(), OSDL::Video::OpenGL::OpenGLContext::setViewPort(), and OSDL::Video::TwoDimensional::Widget::toString().
Translates all the points in the list of vector [x,y]: adds x to each point's abscissa, and adds y to each point'sordinate.
Definition at line 194 of file OSDLPoint2D.cc.
Translates this point of vector [x,y]: adds x to this point's abscissa, and adds y to its ordinate.
Definition at line 156 of file OSDLPoint2D.cc.
References _coord.
Coordinates of the 2D point in space (abscissa, ordinate).
Definition at line 295 of file OSDLPoint2D.h.
Referenced by flip(), flipX(), flipY(), getX(), getY(), Point2D(), setFrom(), setTo(), setX(), setY(), toString(), and translate().
const Ceylan::Maths::Linear::MatrixIndex OSDL::Video::TwoDimensional::Point2D::Dimensions = 2 [static] |
Tells what is the dimension of the space this point is defined in.
Reimplemented from OSDL::Video::TwoDimensional::Point.
Definition at line 282 of file OSDLPoint2D.h.
const Point2D Point2D::Origin [static] |
The origin of a 2D referential.
Definition at line 261 of file OSDLPoint2D.h.