Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::Vector4 Class Reference

#include <vecmath.h>

List of all members.

Public Member Functions

 Vector4 ()
 Vector4 (const Vector4 &v)
 Vector4 (double _x, double _y, double _z, double _w)
Vector4operator= (const Vector4 &a)
const double & operator[] (int n) const
double & operator[] (int n)
Vector4operator+= (const Vector4 &a)
Vector4operator-= (const Vector4 &a)
Vector4operator *= (double s)
Vector4 operator- ()
Vector4 operator+ ()
Vector4 operator+ (const Vector4 &v) const
Vector4 operator- (const Vector4 &v) const
Vector4 operator/ (const double s) const
Vector4 operator * (const double s) const
double operator * (const Vector4 &v) const
double length () const
double lengthSquared () const
void normalize ()
bool operator== (const Vector4 &v) const
bool operator!= (const Vector4 &v) const
bool approxEqual (const Vector4 &v, double eps=1e-12) const
void print () const

Private Attributes

double x
double y
double z
double w


Constructor & Destructor Documentation

EMAN::Vector4::Vector4  )  [inline]
 

Definition at line 594 of file vecmath.h.

References x, and y.

00594 : x(0), y(0), z(0), w(0) {}

EMAN::Vector4::Vector4 const Vector4 v  )  [inline]
 

Definition at line 595 of file vecmath.h.

References v, x, and y.

00595 : x(v[0]), y(v[1]), z(v[2]), w(v[3]) {}

EMAN::Vector4::Vector4 double  _x,
double  _y,
double  _z,
double  _w
[inline]
 

Definition at line 596 of file vecmath.h.

References x, and y.

00596 : x(_x), y(_y), z(_z), w(_w) {}


Member Function Documentation

bool EMAN::Vector4::approxEqual const Vector4 v,
double  eps = 1e-12
const [inline]
 

Definition at line 672 of file vecmath.h.

References EMAN::isZero(), v, w, x, x, y, y, and z.

00672                                                                            {
00673                 return isZero( x - v.x, eps ) && isZero( y - v.y, eps ) && isZero( z - v.z, eps ) && isZero( w - v.w, eps );
00674             }

double EMAN::Vector4::length  )  const [inline]
 

Definition at line 651 of file vecmath.h.

References sqrt(), x, and y.

Referenced by EMAN::length(), and EMAN::unit().

00651                                   {
00652                 return (double) sqrt(x * x + y * y + z * z + w * w);
00653             }

double EMAN::Vector4::lengthSquared  )  const [inline]
 

Definition at line 655 of file vecmath.h.

References x, and y.

00655                                          {
00656                 return x * x + y * y + z * z + w * w;
00657             }

void EMAN::Vector4::normalize  )  [inline]
 

Definition at line 659 of file vecmath.h.

References EMAN::length(), x, and y.

00659                              {
00660                 double s = 1.0 / length();
00661                 x *= s; y *= s; z *= s; w *= s;
00662             }

double EMAN::Vector4::operator * const Vector4 v  )  const [inline]
 

Definition at line 647 of file vecmath.h.

References v, w, x, x, y, y, and z.

00647                                                        {
00648                 return x * v.x + y * v.y + z * v.z + w * v.w;
00649             }

Vector4 EMAN::Vector4::operator * const double  s  )  const [inline]
 

Definition at line 642 of file vecmath.h.

References x, and y.

00642                                                       {
00643                 return Vector4( x * s, y * s, z * s, w * s );
00644             }

Vector4& EMAN::Vector4::operator *= double  s  )  [inline]
 

Definition at line 616 of file vecmath.h.

References x, and y.

00616                                           {
00617                 x *= s; y *= s; z *= s; w *= s;
00618                 return *this;
00619             }

bool EMAN::Vector4::operator!= const Vector4 v  )  const [inline]
 

Definition at line 668 of file vecmath.h.

References v, w, x, x, y, y, and z.

00668                                                       {
00669                 return x != v.x || y != v.y || z != v.z || w != v.w;
00670             }

Vector4 EMAN::Vector4::operator+ const Vector4 v  )  const [inline]
 

Definition at line 629 of file vecmath.h.

References v, w, x, x, y, y, and z.

00629                                                         {
00630                 return Vector4( x + v.x, y + v.y, z + v.z, w + v.w );
00631             }

Vector4 EMAN::Vector4::operator+  )  [inline]
 

Definition at line 625 of file vecmath.h.

00625                                 {
00626                 return *this;
00627             }

Vector4& EMAN::Vector4::operator+= const Vector4 a  )  [inline]
 

Definition at line 606 of file vecmath.h.

References x, and y.

00606                                                   {
00607                 x += a[0]; y += a[1]; z += a[2]; w += a[3];
00608                 return *this;
00609             }

Vector4 EMAN::Vector4::operator- const Vector4 v  )  const [inline]
 

Definition at line 633 of file vecmath.h.

References v, w, x, x, y, y, and z.

00633                                                         {
00634                 return Vector4( x - v.x, y - v.y, z - v.z, w - v.w );
00635             }

Vector4 EMAN::Vector4::operator-  )  [inline]
 

Definition at line 621 of file vecmath.h.

References x, and y.

00621                                 {
00622                 return Vector4(-x, -y, -z, -w);
00623             }

Vector4& EMAN::Vector4::operator-= const Vector4 a  )  [inline]
 

Definition at line 611 of file vecmath.h.

References x, and y.

00611                                                   {
00612                 x -= a[0]; y -= a[1]; z -= a[2]; w -= a[3];
00613                 return *this;
00614             }

Vector4 EMAN::Vector4::operator/ const double  s  )  const [inline]
 

Definition at line 637 of file vecmath.h.

References Assert, x, and y.

00637                                                       {
00638                 Assert( s > 0.0 );
00639                 return Vector4( x / s, y / s, z / s, w / s );
00640             }

Vector4& EMAN::Vector4::operator= const Vector4 a  )  [inline]
 

Definition at line 598 of file vecmath.h.

References x, and y.

00598                                                  {
00599                 x = a[0]; y = a[1]; z = a[2]; w = a[3];
00600                 return *this;
00601             }

bool EMAN::Vector4::operator== const Vector4 v  )  const [inline]
 

Definition at line 664 of file vecmath.h.

References v, w, x, x, y, y, and z.

00664                                                       {
00665                 return x == v.x && y == v.y && z == v.z && w == v.w;
00666             }

double& EMAN::Vector4::operator[] int  n  )  [inline]
 

Definition at line 604 of file vecmath.h.

00604 { return ((double *) this)[n]; }

const double& EMAN::Vector4::operator[] int  n  )  const [inline]
 

Definition at line 603 of file vecmath.h.

00603 { return ((double *) this)[n]; }

void EMAN::Vector4::print  )  const [inline]
 

Definition at line 676 of file vecmath.h.

References x, and y.

00676                                {
00677                 std::cout << x << " " << y << " " << z << " " << w << "\n";
00678             }


Member Data Documentation

double EMAN::Vector4::w [private]
 

Definition at line 681 of file vecmath.h.

Referenced by approxEqual(), operator *(), operator!=(), operator+(), operator-(), and operator==().

double EMAN::Vector4::x [private]
 

Definition at line 681 of file vecmath.h.

Referenced by approxEqual(), operator *(), operator!=(), operator+(), operator-(), and operator==().

double EMAN::Vector4::y [private]
 

Definition at line 681 of file vecmath.h.

Referenced by approxEqual(), operator *(), operator!=(), operator+(), operator-(), and operator==().

double EMAN::Vector4::z [private]
 

Definition at line 681 of file vecmath.h.

Referenced by approxEqual(), operator *(), operator!=(), operator+(), operator-(), and operator==().


The documentation for this class was generated from the following file:
Generated on Tue Jun 11 13:43:15 2013 for EMAN2 by  doxygen 1.3.9.1