EMAN::Vector3 Class Reference

#include <vecmath.h>

List of all members.

Public Member Functions

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

Private Attributes

double x
double y
double z


Detailed Description

Definition at line 206 of file vecmath.h.


Constructor & Destructor Documentation

EMAN::Vector3::Vector3 (  )  [inline]

Definition at line 208 of file vecmath.h.

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

00208 : x(0), y(0), z(0) {}

EMAN::Vector3::Vector3 ( const Vector3 v  )  [inline]

Definition at line 209 of file vecmath.h.

00209 : x(v[0]), y(v[1]), z(v[2]) {}

EMAN::Vector3::Vector3 ( double  _x,
double  _y,
double  _z 
) [inline]

Definition at line 210 of file vecmath.h.

00210 : x(_x), y(_y), z(_z) {}


Member Function Documentation

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

Definition at line 293 of file vecmath.h.

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

00293                                                                            {
00294                 return isZero( x - v.x, eps ) && isZero( y - v.y, eps ) && isZero( z - v.z, eps );
00295             }

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

Definition at line 272 of file vecmath.h.

References sqrt(), x, y, and z.

00272                                   {
00273                 return (double) sqrt(x * x + y * y + z * z);
00274             }

double EMAN::Vector3::lengthSquared (  )  const [inline]

Definition at line 276 of file vecmath.h.

References x, y, and z.

00276                                          {
00277                 return x * x + y * y + z * z;
00278             }

void EMAN::Vector3::normalize (  )  [inline]

Definition at line 280 of file vecmath.h.

References sqrt(), x, y, and z.

Referenced by EMAN::Matrix4::rotation().

00280                              {
00281                 double s = 1.0 / (double) sqrt(x * x + y * y + z * z);
00282                 x *= s; y *= s; z *= s;
00283             }

double EMAN::Vector3::operator * ( const Vector3 v  )  const [inline]

Definition at line 261 of file vecmath.h.

References v, x, y, and z.

00261                                                        {
00262                 return x * v.x + y * v.y + z * v.z;
00263             }

Vector3 EMAN::Vector3::operator * ( const double  s  )  const [inline]

Definition at line 256 of file vecmath.h.

References Vector3(), x, y, and z.

00256                                                       {
00257                 return Vector3( x * s, y * s, z * s );
00258             }

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

Definition at line 230 of file vecmath.h.

References x, y, and z.

00230                                           {
00231                 x *= s; y *= s; z *= s;
00232                 return *this;
00233             }

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

Definition at line 289 of file vecmath.h.

References v, x, y, and z.

00289                                                       {
00290                 return x != v.x || y != v.y || z != v.z;
00291             }

Vector3 EMAN::Vector3::operator+ ( const Vector3 v  )  const [inline]

Definition at line 243 of file vecmath.h.

References v, Vector3(), x, y, and z.

00243                                                         {
00244                 return Vector3( x + v.x, y + v.y, z + v.z );
00245             }

Vector3 EMAN::Vector3::operator+ (  )  const [inline]

Definition at line 239 of file vecmath.h.

00239                                       {
00240                 return *this;
00241             }

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

Definition at line 220 of file vecmath.h.

References x, y, and z.

00220                                                   {
00221                 x += a[0]; y += a[1]; z += a[2];
00222                 return *this;
00223             }

Vector3 EMAN::Vector3::operator- ( const Vector3 v  )  const [inline]

Definition at line 247 of file vecmath.h.

References v, Vector3(), x, y, and z.

00247                                                         {
00248                 return Vector3( x - v.x, y - v.y, z - v.z );
00249             }

Vector3 EMAN::Vector3::operator- (  )  const [inline]

Definition at line 235 of file vecmath.h.

References Vector3(), x, y, and z.

00235                                       {
00236                 return Vector3(-x, -y, -z);
00237             }

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

Definition at line 225 of file vecmath.h.

References x, y, and z.

00225                                                   {
00226                 x -= a[0]; y -= a[1]; z -= a[2];
00227                 return *this;
00228             }

Vector3 EMAN::Vector3::operator/ ( const double  s  )  const [inline]

Definition at line 251 of file vecmath.h.

References Assert, Vector3(), x, y, and z.

00251                                                       {
00252                 Assert( s > 0.0 );
00253                 return Vector3( x / s, y / s, z / s );
00254             }

Vector3& EMAN::Vector3::operator= ( const Vector3 a  )  [inline]

Definition at line 212 of file vecmath.h.

References x, y, and z.

00212                                                  {
00213                 x = a[0]; y = a[1]; z = a[2];
00214                 return *this;
00215             }

bool EMAN::Vector3::operator== ( const Vector3 v  )  const [inline]

Definition at line 285 of file vecmath.h.

References v, x, y, and z.

00285                                                       {
00286                 return x == v.x && y == v.y && z == v.z;
00287             }

double& EMAN::Vector3::operator[] ( int  n  )  [inline]

Definition at line 218 of file vecmath.h.

References x.

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

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

Definition at line 217 of file vecmath.h.

References x.

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

Vector3 EMAN::Vector3::operator^ ( const Vector3 v  )  const [inline]

Definition at line 266 of file vecmath.h.

References v, Vector3(), x, y, and z.

00266                                                         {
00267                 return Vector3( y * v.z - z * v.y,
00268                                 z * v.x - x * v.z,
00269                                 x * v.y - y * v.x );
00270             }

void EMAN::Vector3::print (  )  const [inline]

Definition at line 297 of file vecmath.h.

References x, y, and z.

00297                                {
00298                 std::cout << x << " " << y << " " << z << "\n";
00299             }


Member Data Documentation

double EMAN::Vector3::x [private]

Definition at line 302 of file vecmath.h.

Referenced by approxEqual(), length(), lengthSquared(), normalize(), operator *(), operator *=(), operator!=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator=(), operator==(), operator[](), operator^(), and print().

double EMAN::Vector3::y [private]

Definition at line 302 of file vecmath.h.

Referenced by approxEqual(), length(), lengthSquared(), normalize(), operator *(), operator *=(), operator!=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator=(), operator==(), operator^(), and print().

double EMAN::Vector3::z [private]

Definition at line 302 of file vecmath.h.

Referenced by approxEqual(), length(), lengthSquared(), normalize(), operator *(), operator *=(), operator!=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator=(), operator==(), operator^(), and print().


The documentation for this class was generated from the following file:
Generated on Tue Jun 11 12:45:36 2013 for EMAN2 by  doxygen 1.4.7