Board  0.9.4
Public Member Functions | Public Attributes | Static 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
 
Point rotatedPI2 () const
 
Pointoperator+= (const Point &other)
 
Pointoperator-= (const Point &other)
 
Pointoperator*= (double s)
 
Pointoperator/= (double s)
 
Point operator- () const
 
double norm () const
 
Pointnormalise ()
 
Point normalised () const
 
double argument () const
 
bool isInf () const
 

Public Attributes

double x
 
double y
 

Static Public Attributes

static Point Infinity
 

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, examples/logo.cpp, examples/stroke_path.cpp, and examples/tilings.cpp.

Constructor & Destructor Documentation

LibBoard::Point::Point ( )
inline

Point constructor.

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

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

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

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

Return the argument of the point (seen as a complex number).

Returns
The argument of the point.

References x, and y.

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().

bool LibBoard::Point::isInf ( ) const
inline

Returns true if point is (Inf,Inf).

Returns
true if point is (Inf,Inf).
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(), normalise(), and normalised().

Point & LibBoard::Point::normalise ( )
inline

Make the point (seen as a vector) a unit vector.

Returns
The point itself.
Examples:
examples/stroke_path.cpp.

References norm(), x, and y.

Point LibBoard::Point::normalised ( ) const
inline

Return a normalized copy of the point (seen as a vector).

Returns
A unit vector.

References norm().

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::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().

Point LibBoard::Point::rotatedPI2 ( ) const
inline

Get a PI/2 rotated copy of the point around (0,0), counterclockwise.

Returns
A rotated copy of the point.
Examples:
examples/stroke_path.cpp.

References Point(), x, and y.

Member Data Documentation

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

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