EMAN2
Public Member Functions | Private Attributes | List of all members
EMAN::ScreenVector Class Reference

#include <vecmath.h>

Public Member Functions

 ScreenVector ()
 
 ScreenVector (const ScreenVector &v)
 
 ScreenVector (int _x, int _y)
 
ScreenVectoroperator= (const ScreenVector &a)
 
const int & operator[] (int n) const
 
int & operator[] (int n)
 
ScreenVectoroperator+= (const ScreenVector &a)
 
ScreenVectoroperator-= (const ScreenVector &a)
 
ScreenVectoroperator*= (int s)
 
ScreenVector operator- () const
 
ScreenVector operator+ () const
 
ScreenVector operator+ (const ScreenVector &v) const
 
ScreenVector operator- (const ScreenVector &v) const
 
ScreenVector operator* (const double s) const
 
int operator* (const ScreenVector &v) const
 
double length () const
 
int lengthSquared () const
 
bool operator== (const ScreenVector &v) const
 
bool operator!= (const ScreenVector &v) const
 
void print () const
 

Private Attributes

int x
 
int y
 

Detailed Description

Definition at line 51 of file vecmath.h.

Constructor & Destructor Documentation

◆ ScreenVector() [1/3]

EMAN::ScreenVector::ScreenVector ( )
inline

Definition at line 53 of file vecmath.h.

53: x(0), y(0) {}

Referenced by operator*(), operator+(), and operator-().

◆ ScreenVector() [2/3]

EMAN::ScreenVector::ScreenVector ( const ScreenVector v)
inline

Definition at line 54 of file vecmath.h.

54: x(v[0]), y(v[1]) {}

◆ ScreenVector() [3/3]

EMAN::ScreenVector::ScreenVector ( int  _x,
int  _y 
)
inline

Definition at line 55 of file vecmath.h.

55: x(_x), y(_y) {}

Member Function Documentation

◆ length()

double EMAN::ScreenVector::length ( ) const
inline

Definition at line 105 of file vecmath.h.

105 {
106 return (double) sqrt( (double) (x * x + y * y) );
107 }
EMData * sqrt() const
return square root of current image

References sqrt(), x, and y.

◆ lengthSquared()

int EMAN::ScreenVector::lengthSquared ( ) const
inline

Definition at line 109 of file vecmath.h.

109 {
110 return x * x + y * y;
111 }

References x, and y.

◆ operator!=()

bool EMAN::ScreenVector::operator!= ( const ScreenVector v) const
inline

Definition at line 117 of file vecmath.h.

117 {
118 return x != v.x || y != v.y;
119 }

References x, and y.

◆ operator*() [1/2]

ScreenVector EMAN::ScreenVector::operator* ( const double  s) const
inline

Definition at line 96 of file vecmath.h.

96 {
97 return ScreenVector( (int)(x * s), (int)(y * s) );
98 }

References ScreenVector(), x, and y.

◆ operator*() [2/2]

int EMAN::ScreenVector::operator* ( const ScreenVector v) const
inline

Definition at line 101 of file vecmath.h.

101 {
102 return x * v.x + y * v.y;
103 }

References x, and y.

◆ operator*=()

ScreenVector & EMAN::ScreenVector::operator*= ( int  s)
inline

Definition at line 75 of file vecmath.h.

75 {
76 x *= s; y *= s;
77 return *this;
78 }

References x, and y.

◆ operator+() [1/2]

ScreenVector EMAN::ScreenVector::operator+ ( ) const
inline

Definition at line 84 of file vecmath.h.

84 {
85 return *this;
86 }

◆ operator+() [2/2]

ScreenVector EMAN::ScreenVector::operator+ ( const ScreenVector v) const
inline

Definition at line 88 of file vecmath.h.

88 {
89 return ScreenVector( x + v.x, y + v.y );
90 }

References ScreenVector(), x, and y.

◆ operator+=()

ScreenVector & EMAN::ScreenVector::operator+= ( const ScreenVector a)
inline

Definition at line 65 of file vecmath.h.

65 {
66 x += a[0]; y += a[1];
67 return *this;
68 }

References x, and y.

◆ operator-() [1/2]

ScreenVector EMAN::ScreenVector::operator- ( ) const
inline

Definition at line 80 of file vecmath.h.

80 {
81 return ScreenVector(-x, -y);
82 }

References ScreenVector(), x, and y.

◆ operator-() [2/2]

ScreenVector EMAN::ScreenVector::operator- ( const ScreenVector v) const
inline

Definition at line 92 of file vecmath.h.

92 {
93 return ScreenVector( x - v.x, y - v.y );
94 }

References ScreenVector(), x, and y.

◆ operator-=()

ScreenVector & EMAN::ScreenVector::operator-= ( const ScreenVector a)
inline

Definition at line 70 of file vecmath.h.

70 {
71 x -= a[0]; y -= a[1];
72 return *this;
73 }

References x, and y.

◆ operator=()

ScreenVector & EMAN::ScreenVector::operator= ( const ScreenVector a)
inline

Definition at line 57 of file vecmath.h.

57 {
58 x = a[0]; y = a[1];
59 return *this;
60 }

References x, and y.

◆ operator==()

bool EMAN::ScreenVector::operator== ( const ScreenVector v) const
inline

Definition at line 113 of file vecmath.h.

113 {
114 return x == v.x && y == v.y;
115 }

References x, and y.

◆ operator[]() [1/2]

int & EMAN::ScreenVector::operator[] ( int  n)
inline

Definition at line 63 of file vecmath.h.

63{ return (&x)[n]; }

References x.

◆ operator[]() [2/2]

const int & EMAN::ScreenVector::operator[] ( int  n) const
inline

Definition at line 62 of file vecmath.h.

62{ return (&x)[n]; }

References x.

◆ print()

void EMAN::ScreenVector::print ( ) const
inline

Definition at line 121 of file vecmath.h.

121 {
122 std::cout << "(" << x << ", " << y << ")";
123 }

References x, and y.

Member Data Documentation

◆ x

int EMAN::ScreenVector::x
private

◆ y

int EMAN::ScreenVector::y
private

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