EMAN::Point3 Class Reference

#include <vecmath.h>

List of all members.

Public Member Functions

 Point3 ()
 Point3 (const Point3 &p)
 Point3 (double _x, double _y, double _z)
Point3operator= (const Point3 &a)
const double & operator[] (int n) const
double & operator[] (int n)
Point3operator+= (const Vector3 &v)
Point3operator-= (const Vector3 &v)
Point3operator *= (double s)
Vector3 operator- (const Point3 &p) const
Point3 operator+ (const Vector3 &v) const
Point3 operator- (const Vector3 &v) const
double distanceTo (const Point3 &p) const
double distanceToSquared (const Point3 &p) const
double distanceFromOrigin () const
double distanceFromOriginSquared () const
bool operator== (const Point3 &p) const
bool operator!= (const Point3 &p) const
bool approxEqual (const Point3 &p, double eps=1e-12) const
void print () const

Private Attributes

double x
double y
double z


Detailed Description

Definition at line 325 of file vecmath.h.


Constructor & Destructor Documentation

EMAN::Point3::Point3 (  )  [inline]

Definition at line 327 of file vecmath.h.

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

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

EMAN::Point3::Point3 ( const Point3 p  )  [inline]

Definition at line 328 of file vecmath.h.

00328 : x(p[0]), y(p[1]), z(p[2]) {}

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

Definition at line 329 of file vecmath.h.

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


Member Function Documentation

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

Definition at line 394 of file vecmath.h.

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

00394                                                                           {
00395                 return isZero( x - p.x, eps ) && isZero( y - p.y, eps ) && isZero( z - p.z, eps );
00396             }

double EMAN::Point3::distanceFromOrigin (  )  const [inline]

Definition at line 378 of file vecmath.h.

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

00378                                               {
00379                 return (double) sqrt(x * x + y * y + z * z);
00380             }

double EMAN::Point3::distanceFromOriginSquared (  )  const [inline]

Definition at line 382 of file vecmath.h.

References x, y, and z.

00382                                                      {
00383                 return x * x + y * y + z * z;
00384             }

double EMAN::Point3::distanceTo ( const Point3 p  )  const [inline]

Definition at line 366 of file vecmath.h.

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

00366                                                      {
00367                 return (double) sqrt((p[0] - x) * (p[0] - x) +
00368                                      (p[1] - y) * (p[1] - y) +
00369                                      (p[2] - z) * (p[2] - z));
00370             }

double EMAN::Point3::distanceToSquared ( const Point3 p  )  const [inline]

Definition at line 372 of file vecmath.h.

References x, y, and z.

00372                                                             {
00373                 return ((p[0] - x) * (p[0] - x) +
00374                         (p[1] - y) * (p[1] - y) +
00375                         (p[2] - z) * (p[2] - z));
00376             }

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

Definition at line 349 of file vecmath.h.

References x, y, and z.

00349                                          {
00350                 x *= s; y *= s; z *= s;
00351                 return *this;
00352             }

bool EMAN::Point3::operator!= ( const Point3 p  )  const [inline]

Definition at line 390 of file vecmath.h.

References x, y, and z.

00390                                                      {
00391                 return x != p.x || y != p.y || z != p.z;
00392             }   

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

Definition at line 358 of file vecmath.h.

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

00358                                                       {
00359                 return Point3(x + v[0], y + v[1], z + v[2]);
00360             }

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

Definition at line 339 of file vecmath.h.

References v, x, y, and z.

00339                                                  {
00340                 x += v[0]; y += v[1]; z += v[2];
00341                 return *this;
00342             }

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

Definition at line 362 of file vecmath.h.

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

00362                                                       {
00363                 return Point3(x - v[0], y - v[1], z - v[2]);
00364             }

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

Definition at line 354 of file vecmath.h.

References x, y, and z.

00354                                                       {
00355                 return Vector3(x - p.x, y - p.y, z - p.z);
00356             }

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

Definition at line 344 of file vecmath.h.

References v, x, y, and z.

00344                                                  {
00345                 x -= v[0]; y -= v[1]; z -= v[2];
00346                 return *this;
00347             }

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

Definition at line 331 of file vecmath.h.

References x, y, and z.

00331                                                {
00332                 x = a[0]; y = a[1]; z = a[2];
00333                 return *this;
00334             }

bool EMAN::Point3::operator== ( const Point3 p  )  const [inline]

Definition at line 386 of file vecmath.h.

References x, y, and z.

00386                                                      {
00387                 return x == p.x && y == p.y && z == p.z;
00388             }

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

Definition at line 337 of file vecmath.h.

References x.

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

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

Definition at line 336 of file vecmath.h.

References x.

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

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

Definition at line 398 of file vecmath.h.

References x, y, and z.

00398                                {
00399                 std::cout << x << " " << y << " " << z << "\n";
00400             }


Member Data Documentation

double EMAN::Point3::x [private]

Definition at line 403 of file vecmath.h.

Referenced by approxEqual(), distanceFromOrigin(), distanceFromOriginSquared(), distanceTo(), distanceToSquared(), operator *=(), operator!=(), operator+(), operator+=(), operator-(), operator-=(), operator=(), operator==(), operator[](), and print().

double EMAN::Point3::y [private]

Definition at line 403 of file vecmath.h.

Referenced by approxEqual(), distanceFromOrigin(), distanceFromOriginSquared(), distanceTo(), distanceToSquared(), operator *=(), operator!=(), operator+(), operator+=(), operator-(), operator-=(), operator=(), operator==(), and print().

double EMAN::Point3::z [private]

Definition at line 403 of file vecmath.h.

Referenced by approxEqual(), distanceFromOrigin(), distanceFromOriginSquared(), distanceTo(), distanceToSquared(), 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