Board 0.9.6
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)
 
Pointoperator= (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)
 
Pointtranslate (double dx, double dy)
 
Point translated (double dx, double dy) const
 
Pointscale (double sx, double sy)
 
Point scaled (double sx, double sy)
 
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/Huffman.cpp, examples/Julia.cpp, examples/array.cpp, examples/bezier.cpp, examples/board_font_text.cpp, examples/circled_framed.cpp, examples/clipping.cpp, examples/example1.cpp, examples/example2.cpp, examples/flag.cpp, examples/graph.cpp, examples/holes.cpp, examples/hull.cpp, examples/images.cpp, examples/interpolate.cpp, examples/koch.cpp, examples/logo.cpp, examples/rough.cpp, examples/sandbox.cpp, examples/sierpinski.cpp, examples/stroke_path.cpp, examples/test_arrow.cpp, examples/test_depth.cpp, examples/tilings.cpp, examples/triangles.cpp, and examples/xkcd.cpp.

Constructor & Destructor Documentation

◆ Point() [1/3]

LibBoard::Point::Point ( )
inline

Point constructor.

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

◆ Point() [2/3]

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

Point copy.

Parameters
other

◆ Point() [3/3]

LibBoard::Point::Point ( double  x,
double  y 
)
inline

Point constructor.

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

Member Function Documentation

◆ argument()

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.

Referenced by LibBoard::Tools::exteriorRoundIntersection().

◆ get()

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

◆ isInf()

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

Returns true if point is (Inf,Inf).

Returns
true if point is (Inf,Inf).

References Infinity.

Referenced by LibBoard::Tools::exteriorMiterIntersection().

◆ norm()

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

◆ normalise()

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

◆ normalised()

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

◆ operator*=()

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.

◆ operator+=()

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.

◆ operator-()

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.

◆ operator-=()

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.

◆ operator/=()

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.

◆ operator=()

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

Point assignment operator.

Parameters
other

References x, and y.

◆ rotate() [1/2]

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(), and LibBoard::Dot::rotate().

◆ rotate() [2/2]

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

◆ rotated() [1/2]

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, and examples/sierpinski.cpp.

References Point().

Referenced by LibBoard::Arrow::extremity(), Koch(), main(), LibBoard::Ellipse::rotate(), LibBoard::Line::rotate(), LibBoard::Line::rotated(), LibBoard::Line::rotated(), and Sierpinksi().

◆ rotated() [2/2]

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

◆ rotatedPI2()

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

◆ scale()

Point & LibBoard::Point::scale ( double  sx,
double  sy 
)
inline

Scale the point

Parameters
sxx factor.
syy factor.
Returns
The point itself, once scaled.

References x, and y.

◆ scaled()

Point LibBoard::Point::scaled ( double  sx,
double  sy 
)
inline

Return a scaled copy of a point

Parameters
sxx factor.
syy factor.
Returns
The new point, once scaled.

References Point().

◆ translate()

Point & LibBoard::Point::translate ( double  dx,
double  dy 
)
inline

Translate the point

Parameters
dxTranslation along the x axis.
dyTranslation along the y axis.
Returns
The point itself, once translated.

References x, and y.

Referenced by LibBoard::Line::translate(), and LibBoard::Line::translated().

◆ translated()

Point LibBoard::Point::translated ( double  dx,
double  dy 
) const
inline

Return a translated copy of the point

Parameters
dxTranslation along the x axis.
dyTranslation along the y axis.
Returns
The translated point.

References Point(), x, and y.

Referenced by LibBoard::cross().

Member Data Documentation

◆ Infinity

Point LibBoard::Point::Infinity
static

◆ x

double LibBoard::Point::x

The point's first coordinate

Examples
examples/holes.cpp, examples/hull.cpp, and examples/xkcd.cpp.

Referenced by LibBoard::ShapeList::append(), argument(), LibBoard::array(), LibBoard::boardFontText(), LibBoard::Ellipse::boundingBox(), LibBoard::Rect::contains(), LibBoard::Tools::EuclideanLine::EuclideanLine(), LibBoard::Arrow::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Arrow::flushPostscript(), LibBoard::Ellipse::flushPostscript(), LibBoard::Line::flushPostscript(), LibBoard::GouraudTriangle::flushPostscript(), LibBoard::Ellipse::flushSVG(), LibBoard::Line::flushSVG(), LibBoard::GouraudTriangle::flushSVG(), LibBoard::Arrow::flushTikZ(), LibBoard::Ellipse::flushTikZ(), LibBoard::Line::flushTikZ(), get(), LibBoard::grid(), LibBoard::Rect::growToContain(), LibBoard::Tools::intersection(), LibBoard::Path::isClockwise(), isSeparing(), main(), LibBoard::Path::moveCenter(), LibBoard::Shape::moveCenter(), LibBoard::Path::moveCenter(), LibBoard::Shape::moveCenter(), norm(), normalise(), LibBoard::operator!=(), LibBoard::operator*(), LibBoard::operator*(), LibBoard::operator*(), operator*=(), LibBoard::operator+(), operator+=(), operator-(), LibBoard::operator-(), operator-=(), LibBoard::operator/(), operator/=(), operator<<(), operator=(), LibBoard::operator==(), LibBoard::Tools::pathBoundaryPoints(), LibBoard::Bezier::pathThroughLocalExtremums(), rotate(), LibBoard::Ellipse::rotate(), rotatedPI2(), LibBoard::Transform::scale(), LibBoard::Board::scale(), LibBoard::Group::scale(), LibBoard::Path::scale(), scale(), LibBoard::Board::scale(), LibBoard::Group::scale(), LibBoard::Line::scale(), LibBoard::Polyline::scale(), LibBoard::ShapeList::scale(), LibBoard::Line::scaleAll(), LibBoard::TransformEPS::setBoundingBox(), LibBoard::TransformFIG::setBoundingBox(), LibBoard::TransformSVG::setBoundingBox(), LibBoard::Rect::strictlyContains(), LibBoard::tiling(), translate(), and translated().

◆ y

double LibBoard::Point::y

The point's second coordinate

Examples
examples/holes.cpp, examples/hull.cpp, and examples/xkcd.cpp.

Referenced by LibBoard::ShapeList::append(), argument(), LibBoard::array(), LibBoard::boardFontText(), LibBoard::Ellipse::boundingBox(), LibBoard::Rect::contains(), LibBoard::Tools::EuclideanLine::EuclideanLine(), LibBoard::Arrow::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Arrow::flushPostscript(), LibBoard::Ellipse::flushPostscript(), LibBoard::Line::flushPostscript(), LibBoard::GouraudTriangle::flushPostscript(), LibBoard::Ellipse::flushSVG(), LibBoard::Line::flushSVG(), LibBoard::GouraudTriangle::flushSVG(), LibBoard::Arrow::flushTikZ(), LibBoard::Ellipse::flushTikZ(), LibBoard::Line::flushTikZ(), get(), LibBoard::grid(), LibBoard::Rect::growToContain(), LibBoard::Tools::intersection(), LibBoard::Path::isClockwise(), isSeparing(), main(), LibBoard::Path::moveCenter(), LibBoard::Shape::moveCenter(), LibBoard::Path::moveCenter(), LibBoard::Shape::moveCenter(), norm(), normalise(), LibBoard::operator!=(), LibBoard::operator*(), LibBoard::operator*(), LibBoard::operator*(), operator*=(), LibBoard::operator+(), operator+=(), operator-(), LibBoard::operator-(), operator-=(), LibBoard::operator/(), operator/=(), operator<<(), operator=(), LibBoard::operator==(), LibBoard::Tools::pathBoundaryPoints(), LibBoard::Bezier::pathThroughLocalExtremums(), rotate(), LibBoard::Ellipse::rotate(), rotatedPI2(), LibBoard::Transform::scale(), LibBoard::Board::scale(), LibBoard::Group::scale(), LibBoard::Path::scale(), scale(), LibBoard::Board::scale(), LibBoard::Group::scale(), LibBoard::Line::scale(), LibBoard::Polyline::scale(), LibBoard::ShapeList::scale(), LibBoard::Line::scaleAll(), LibBoard::TransformEPS::setBoundingBox(), LibBoard::TransformFIG::setBoundingBox(), LibBoard::TransformSVG::setBoundingBox(), LibBoard::Rect::strictlyContains(), LibBoard::tiling(), translate(), and translated().


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