Xmipp  v3.23.11-Nereus
Public Member Functions | Public Attributes | Friends | List of all members
Point2D< T > Class Template Reference

#include <point2D.h>

Inheritance diagram for Point2D< T >:
Inheritance graph
[legend]
Collaboration diagram for Point2D< T >:
Collaboration graph
[legend]

Public Member Functions

 Point2D (T x, T y)
 
 Point2D (const std::initializer_list< T > &l)
 
Point2D operator/= (T rhs) const
 
Point2D operator-= (T rhs) const
 
Point2D operator+= (T rhs) const
 
Point2D operator+= (const Point2D &rhs) const
 
Point2D operator+= (const Point2D &rhs)
 
Point2D operator-= (const Point2D &rhs) const
 

Public Attributes

x
 
y
 

Friends

Point2D operator/ (const Point2D &lhs, T rhs)
 
Point2D operator- (const Point2D &lhs, T rhs)
 
Point2D operator+ (const Point2D &lhs, T rhs)
 
Point2D operator+ (const Point2D &lhs, const Point2D &rhs)
 
Point2D operator- (const Point2D &lhs, const Point2D &rhs)
 

Detailed Description

template<typename T>
class Point2D< T >

Struct represents a point in 2D

Definition at line 37 of file point2D.h.

Constructor & Destructor Documentation

◆ Point2D() [1/2]

template<typename T>
Point2D< T >::Point2D ( x,
y 
)
inlineexplicit

Definition at line 39 of file point2D.h.

39  :
40  x(x), y(y) {
41  }
T y
Definition: point2D.h:53
T x
Definition: point2D.h:52

◆ Point2D() [2/2]

template<typename T>
Point2D< T >::Point2D ( const std::initializer_list< T > &  l)
inline

Definition at line 43 of file point2D.h.

43  {
44  if (2 == l.size())
45  {
46  auto it = l.begin();
47  x = *it++;
48  y = *it++;
49  }
50  }
T y
Definition: point2D.h:53
T x
Definition: point2D.h:52

Member Function Documentation

◆ operator+=() [1/3]

template<typename T>
Point2D Point2D< T >::operator+= ( rhs) const
inline

Definition at line 68 of file point2D.h.

68  {
69  return Point2D(x + rhs, y + rhs);
70  }
T y
Definition: point2D.h:53
Point2D(T x, T y)
Definition: point2D.h:39
T x
Definition: point2D.h:52

◆ operator+=() [2/3]

template<typename T>
Point2D Point2D< T >::operator+= ( const Point2D< T > &  rhs) const
inline

Definition at line 72 of file point2D.h.

72  {
73  return Point2D(x + rhs.x, y + rhs.y);
74  }
T y
Definition: point2D.h:53
Point2D(T x, T y)
Definition: point2D.h:39
T x
Definition: point2D.h:52

◆ operator+=() [3/3]

template<typename T>
Point2D Point2D< T >::operator+= ( const Point2D< T > &  rhs)
inline

Definition at line 76 of file point2D.h.

76  {
77  x += rhs.x;
78  y += rhs.y;
79  return *this;
80  }
T y
Definition: point2D.h:53
T x
Definition: point2D.h:52

◆ operator-=() [1/2]

template<typename T>
Point2D Point2D< T >::operator-= ( rhs) const
inline

Definition at line 64 of file point2D.h.

64  {
65  return Point2D(x - rhs, y - rhs);
66  }
T y
Definition: point2D.h:53
Point2D(T x, T y)
Definition: point2D.h:39
T x
Definition: point2D.h:52

◆ operator-=() [2/2]

template<typename T>
Point2D Point2D< T >::operator-= ( const Point2D< T > &  rhs) const
inline

Definition at line 82 of file point2D.h.

82  {
83  return Point2D(x - rhs.x, y - rhs.y);
84  }
T y
Definition: point2D.h:53
Point2D(T x, T y)
Definition: point2D.h:39
T x
Definition: point2D.h:52

◆ operator/=()

template<typename T>
Point2D Point2D< T >::operator/= ( rhs) const
inline

Definition at line 56 of file point2D.h.

56  {
57  return Point2D(x / rhs, y / rhs);
58  }
T y
Definition: point2D.h:53
Point2D(T x, T y)
Definition: point2D.h:39
T x
Definition: point2D.h:52

Friends And Related Function Documentation

◆ operator+ [1/2]

template<typename T>
Point2D operator+ ( const Point2D< T > &  lhs,
rhs 
)
friend

Definition at line 90 of file point2D.h.

90  {
91  return lhs += rhs;
92  }

◆ operator+ [2/2]

template<typename T>
Point2D operator+ ( const Point2D< T > &  lhs,
const Point2D< T > &  rhs 
)
friend

Definition at line 94 of file point2D.h.

94  {
95  return lhs += rhs;
96  }

◆ operator- [1/2]

template<typename T>
Point2D operator- ( const Point2D< T > &  lhs,
rhs 
)
friend

Definition at line 86 of file point2D.h.

86  {
87  return lhs -= rhs;
88  }

◆ operator- [2/2]

template<typename T>
Point2D operator- ( const Point2D< T > &  lhs,
const Point2D< T > &  rhs 
)
friend

Definition at line 98 of file point2D.h.

98  {
99  return lhs -= rhs;
100  }

◆ operator/

template<typename T>
Point2D operator/ ( const Point2D< T > &  lhs,
rhs 
)
friend

Definition at line 60 of file point2D.h.

60  {
61  return lhs /= rhs;
62  }

Member Data Documentation

◆ x

template<typename T>
T Point2D< T >::x

Definition at line 52 of file point2D.h.

◆ y

template<typename T>
T Point2D< T >::y

Definition at line 53 of file point2D.h.


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