DGtal  0.9.3beta
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

LibBoard::Point::Point ( )
inline

Point constructor.

Definition at line 36 of file Point.h.

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

36 :x(0.0),y(0.0) { }
double x
Definition: Point.h:29
double y
Definition: Point.h:30
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
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.

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

Member Function Documentation

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.

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

97 {
98  xout = x;
99  yout = y;
100 }
double x
Definition: Point.h:29
double y
Definition: Point.h:30
double LibBoard::Point::norm ( ) const
inline

Definition at line 214 of file Point.h.

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

215 {
216  return sqrt( x*x + y*y );
217 }
Point & LibBoard::Point::operator*= ( double  s)
inline

Definition at line 155 of file Point.h.

156 {
157  x *= s;
158  y *= s;
159  return *this;
160 }
Point & LibBoard::Point::operator+= ( const Point other)
inline

Definition at line 139 of file Point.h.

References x, and y.

140 {
141  x += other.x;
142  y += other.y;
143  return *this;
144 }
Point LibBoard::Point::operator- ( )
inline

Definition at line 219 of file Point.h.

References Point().

220 {
221  return Point( -x, -y );
222 }
Point & LibBoard::Point::operator-= ( const Point other)
inline

Definition at line 147 of file Point.h.

References x, and y.

148 {
149  x -= other.x;
150  y -= other.y;
151  return *this;
152 }
Point & LibBoard::Point::operator/= ( double  s)
inline

Definition at line 163 of file Point.h.

164 {
165  x /= s;
166  y /= s;
167  return *this;
168 }
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 rotate(), LibBoard::Dot::rotate(), LibBoard::Line::rotate(), LibBoard::Circle::rotate(), LibBoard::Text::rotate(), LibBoard::Line::rotated(), and LibBoard::Arrow::rotated().

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
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 }
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 LibBoard::Ellipse::rotate().

194 {
195  return Point(*this).rotate( angle );
196 }
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

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

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