Board  0.9.2
Public Member Functions | Public Attributes | List of all members
LibBoard::Point Struct Reference

Struct representing a 2D point. More...

#include <Point.h>

Public Member Functions

 Point ()
 
 Point (const Point &other)
 
 Point (double x, double y)
 
void get (double &x, double &y) const
 
Pointrotate (double angle)
 
Point rotated (double angle) const
 
Pointrotate (double angle, const Point &center)
 
Point rotated (double angle, const Point &center) const
 
Pointoperator+= (const Point &other)
 
Pointoperator-= (const Point &other)
 
Pointoperator*= (double s)
 
Pointoperator/= (double s)
 
Point operator- () const
 
double norm () const
 

Public Attributes

double x
 
double y
 

Detailed Description

Struct representing a 2D point.

The Point structure.

Examples:
examples/clipping.cpp, examples/example1.cpp, examples/example2.cpp, examples/flag.cpp, examples/koch.cpp, and examples/logo.cpp.

Constructor & Destructor Documentation

LibBoard::Point::Point ( )
inline

Point constructor.

Parameters
xThe point's first coordinate.
yThe point's second coordinate.

Referenced by operator-(), and rotated().

LibBoard::Point::Point ( const Point other)
inline

Point constructor.

Parameters
xThe point's first coordinate.
yThe point's second coordinate.
LibBoard::Point::Point ( double  x,
double  y 
)
inline

Point constructor.

Parameters
xThe point's first coordinate.
yThe point's second coordinate.

Member Function Documentation

void LibBoard::Point::get ( double &  x,
double &  y 
) const
inline

Get the values of the x and y values.

Parameters
xReference to the x to be set.
yReference to the y to be set.

References x, and y.

Referenced by LibBoard::Dot::rotate(), LibBoard::Line::rotate(), LibBoard::Line::rotated(), and LibBoard::Arrow::rotated().

double LibBoard::Point::norm ( ) const
inline

Compute the norm of the point (seen as a vector).

Returns
The norm of the point.

References x, and y.

Referenced by LibBoard::Rectangle::flushSVG(), and LibBoard::Text::rotate().

Point & LibBoard::Point::operator*= ( double  s)
inline

Scale the point's coordinates.

Parameters
sA scaling factor.
Returns
The point itself, once scaled.

References x, and y.

Point & LibBoard::Point::operator+= ( const Point other)
inline

Move the point given a translation vector (given as another Point).

Parameters
otherA point seen as a translation vector.
Returns
The point itself, once translated.

References x, and y.

Point LibBoard::Point::operator- ( ) const
inline

Get the opposite copy of the point.

Returns
The opposite copy of the point.

References Point(), x, and y.

Point & LibBoard::Point::operator-= ( const Point other)
inline

Move (backward) the point given a translation vector (given as another Point).

Parameters
otherA point seen as a translation vector.
Returns
The point itself, once translated.

References x, and y.

Point & LibBoard::Point::operator/= ( double  s)
inline

Downscale the point's coordinates.

Parameters
sA (down)scaling factor.
Returns
The point itself, once scaled.

References x, and y.

Point & LibBoard::Point::rotate ( double  angle)
inline

Rotate the point with a given angle around the origin (0,0)

Parameters
angleThe rotation angle.

References x, and y.

Referenced by rotate(), LibBoard::Dot::rotate(), LibBoard::Line::rotate(), LibBoard::Circle::rotate(), LibBoard::Text::rotate(), LibBoard::Line::rotated(), and LibBoard::Arrow::rotated().

Point & LibBoard::Point::rotate ( double  angle,
const Point center 
)
inline

Rotate the point, given a rotation center and an angle.

Parameters
angleThe rotation angle (in radians).
centerThe rotation center.
Returns
The point itself (once rotated).

References rotate().

Point LibBoard::Point::rotated ( double  angle) const
inline

Get a rotated copy of the point, around the origin, by a given angle.

Parameters
angleThe rotation angle (in radians).
Returns
The rotated point.
Examples:
examples/koch.cpp.

References Point().

Referenced by LibBoard::Ellipse::rotate().

Point LibBoard::Point::rotated ( double  angle,
const Point center 
) const
inline

Get a rotated copy of the point, given a rotation center and an angle.

Parameters
angleThe rotation angle (in radians).
centerThe rotation center.
Returns
A rotated copy of the point.

References Point().

Member Data Documentation

double LibBoard::Point::x
double LibBoard::Point::y

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