DGtal  1.0.0
LibBoard::Point Struct Reference

Struct representing a 2D point. More...

#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

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.

## ◆ Point() [1/3]

 LibBoard::Point::Point ( )
inline

Point constructor.

Definition at line 36 of file Point.h.

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

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

## ◆ Point() [2/3]

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

Point constructor.

Parameters
 other point 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
 xc The point's first coordinate. yc The 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

## ◆ get()

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

Get the values of the x and y values.

Parameters
 xout Reference to the x to be set. yout Reference to the y to be set.

Definition at line 96 of file Point.h.

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

References x, and y.

## ◆ norm()

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

Definition at line 214 of file Point.h.

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

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

## ◆ operator *=()

 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 }

## ◆ operator+=()

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

Definition at line 139 of file Point.h.

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

References x, and y.

## ◆ operator-()

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

Definition at line 219 of file Point.h.

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

References Point().

## ◆ operator-=()

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

Definition at line 147 of file Point.h.

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

References x, and y.

## ◆ operator/=()

 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 }

## ◆ rotate() [1/2]

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

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

Parameters
 angle The rotation angle.

Definition at line 183 of file Point.h.

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

References x, and y.

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

## ◆ rotate() [2/2]

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

Definition at line 199 of file Point.h.

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

References rotate().

## ◆ rotated() [1/2]

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

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

Parameters
 angle The rotation angle.
Returns
The rotated point.

Definition at line 193 of file Point.h.

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

References Point().

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

## ◆ rotated() [2/2]

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

Definition at line 208 of file Point.h.

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

References Point().

## ◆ y

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