DGtal  0.9.3
Public Member Functions | Data Fields
LibBoard::Point Struct Reference

#include <Board/Point.h>

Public Member Functions

 Point ()
 
 Point (const Point &other)
 
 Point (double xc, double yc)
 
Pointrotate (double angle)
 
void get (double &xout, double &yout) const
 
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- ()
 
double norm () const
 

Data Fields

double x
 
double y
 

Detailed Description

Struct representing a 2D point.

The Point structure.

Examples:
geometry/curves/exampleAlphaThickSegmentTgtCover.cpp, and geometry/curves/greedyAlphaThickDecomposition.cpp.

Definition at line 27 of file Point.h.

Constructor & Destructor Documentation

◆ Point() [1/3]

LibBoard::Point::Point ( )
inline

Point constructor.

Definition at line 36 of file Point.h.

Referenced by LibBoard::operator*(), LibBoard::operator+(), operator-(), LibBoard::operator-(), LibBoard::operator/(), and rotated().

36 :x(0.0),y(0.0) { }
double x
Definition: Point.h:29
double y
Definition: Point.h:30

◆ Point() [2/3]

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

Point constructor.

Parameters
otherpoint to copy

Definition at line 43 of file Point.h.

43 :x(other.x),y(other.y) { }
double x
Definition: Point.h:29
double y
Definition: Point.h:30

◆ Point() [3/3]

LibBoard::Point::Point ( double  xc,
double  yc 
)
inline

Point constructor.

Parameters
xcThe point's first coordinate.
ycThe point's second coordinate.

Definition at line 51 of file Point.h.

References norm(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), rotate(), and rotated().

51 :x(xc),y(yc) { }
double x
Definition: Point.h:29
double y
Definition: Point.h:30

Member Function Documentation

◆ get()

void LibBoard::Point::get ( double &  xout,
double &  yout 
) const
inline

Get the values of the x and y values.

Parameters
xoutReference to the x to be set.
youtReference to the y to be set.

Definition at line 96 of file Point.h.

References x, and y.

97 {
98  xout = x;
99  yout = y;
100 }
double x
Definition: Point.h:29
double y
Definition: Point.h:30

◆ norm()

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

Definition at line 214 of file Point.h.

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

215 {
216  return sqrt( x*x + y*y );
217 }

◆ operator*=()

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

Definition at line 155 of file Point.h.

Referenced by Point().

156 {
157  x *= s;
158  y *= s;
159  return *this;
160 }

◆ operator+=()

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

Definition at line 139 of file Point.h.

References x, and y.

Referenced by Point().

140 {
141  x += other.x;
142  y += other.y;
143  return *this;
144 }

◆ operator-()

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

Definition at line 219 of file Point.h.

References Point().

Referenced by Point().

220 {
221  return Point( -x, -y );
222 }

◆ operator-=()

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

Definition at line 147 of file Point.h.

References x, and y.

Referenced by Point().

148 {
149  x -= other.x;
150  y -= other.y;
151  return *this;
152 }

◆ operator/=()

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

Definition at line 163 of file Point.h.

Referenced by Point().

164 {
165  x /= s;
166  y /= s;
167  return *this;
168 }

◆ 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.

Definition at line 183 of file Point.h.

References x, and y.

Referenced by Point(), rotate(), and LibBoard::Text::rotate().

184 {
185  double newx = cos( angle ) * Point::x - sin( angle ) * Point::y;
186  double newy = sin( angle ) * Point::x + cos( angle ) * Point::y;
187  x = newx;
188  y = newy;
189  return *this;
190 }
double x
Definition: Point.h:29
double y
Definition: Point.h:30

◆ rotate() [2/2]

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

Definition at line 199 of file Point.h.

References rotate().

200 {
201  (*this) -= center;
202  (*this).rotate( angle );
203  (*this) += center;
204  return *this;
205 }

◆ rotated() [1/2]

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

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

Parameters
angleThe rotation angle.
Returns
The rotated point.

Definition at line 193 of file Point.h.

References Point().

Referenced by Point(), and LibBoard::Ellipse::rotate().

194 {
195  return Point(*this).rotate( angle );
196 }

◆ rotated() [2/2]

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

Definition at line 208 of file Point.h.

References Point().

209 {
210  return Point(*this).rotate( angle, center );
211 }

Field Documentation

◆ x

double LibBoard::Point::x

◆ y

double LibBoard::Point::y

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