EMAN2
Public Member Functions | Private Attributes
EMAN::ScreenVector Class Reference

#include <vecmath.h>

List of all members.

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 55 of file vecmath.h.


Constructor & Destructor Documentation

EMAN::ScreenVector::ScreenVector ( ) [inline]

Definition at line 57 of file vecmath.h.

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

: x(0), y(0) {}
EMAN::ScreenVector::ScreenVector ( const ScreenVector v) [inline]

Definition at line 58 of file vecmath.h.

: x(v[0]), y(v[1]) {}
EMAN::ScreenVector::ScreenVector ( int  _x,
int  _y 
) [inline]

Definition at line 59 of file vecmath.h.

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

Member Function Documentation

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

Definition at line 109 of file vecmath.h.

References sqrt(), x, and y.

                                  {
                return (double) sqrt( (double) (x * x + y * y) );
            }
int EMAN::ScreenVector::lengthSquared ( ) const [inline]

Definition at line 113 of file vecmath.h.

References x, and y.

                                      {
                return x * x + y * y;
            }
bool EMAN::ScreenVector::operator!= ( const ScreenVector v) const [inline]

Definition at line 121 of file vecmath.h.

References x, and y.

                                                           {
                return x != v.x || y != v.y;
            }
int EMAN::ScreenVector::operator* ( const ScreenVector v) const [inline]

Definition at line 105 of file vecmath.h.

References x, and y.

                                                         {
                return x * v.x + y * v.y;
            }
ScreenVector EMAN::ScreenVector::operator* ( const double  s) const [inline]

Definition at line 100 of file vecmath.h.

References ScreenVector(), x, and y.

                                                           {
                return ScreenVector( (int)(x * s), (int)(y * s) );
            }
ScreenVector& EMAN::ScreenVector::operator*= ( int  s) [inline]

Definition at line 79 of file vecmath.h.

References x, and y.

                                            {
                x *= s; y *= s;
                return *this;
            }
ScreenVector EMAN::ScreenVector::operator+ ( const ScreenVector v) const [inline]

Definition at line 92 of file vecmath.h.

References ScreenVector(), x, and y.

                                                                  {
                return ScreenVector( x + v.x, y + v.y );
            }
ScreenVector EMAN::ScreenVector::operator+ ( ) const [inline]

Definition at line 88 of file vecmath.h.

                                           {
                return *this;
            }
ScreenVector& EMAN::ScreenVector::operator+= ( const ScreenVector a) [inline]

Definition at line 69 of file vecmath.h.

References x, and y.

                                                            {
                x += a[0]; y += a[1];
                return *this;
            }
ScreenVector EMAN::ScreenVector::operator- ( const ScreenVector v) const [inline]

Definition at line 96 of file vecmath.h.

References ScreenVector(), x, and y.

                                                                  {
                return ScreenVector( x - v.x, y - v.y );
            }
ScreenVector EMAN::ScreenVector::operator- ( ) const [inline]

Definition at line 84 of file vecmath.h.

References ScreenVector(), x, and y.

                                           {
                return ScreenVector(-x, -y);
            }
ScreenVector& EMAN::ScreenVector::operator-= ( const ScreenVector a) [inline]

Definition at line 74 of file vecmath.h.

References x, and y.

                                                            {
                x -= a[0]; y -= a[1];
                return *this;
            }
ScreenVector& EMAN::ScreenVector::operator= ( const ScreenVector a) [inline]

Definition at line 61 of file vecmath.h.

References x, and y.

                                                           {
                x = a[0]; y = a[1];
                return *this;
            }
bool EMAN::ScreenVector::operator== ( const ScreenVector v) const [inline]

Definition at line 117 of file vecmath.h.

References x, and y.

                                                           {
                return x == v.x && y == v.y;
            }
const int& EMAN::ScreenVector::operator[] ( int  n) const [inline]

Definition at line 66 of file vecmath.h.

References x.

{ return (&x)[n]; }
int& EMAN::ScreenVector::operator[] ( int  n) [inline]

Definition at line 67 of file vecmath.h.

References x.

{ return (&x)[n]; }
void EMAN::ScreenVector::print ( ) const [inline]

Definition at line 125 of file vecmath.h.

References x, and y.

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

Member Data Documentation

int EMAN::ScreenVector::x [private]
int EMAN::ScreenVector::y [private]

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