EMAN2
Public Member Functions | Private Attributes
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-().

: x(0), y(0), z(0) {}
EMAN::Point3::Point3 ( const Point3 p) [inline]

Definition at line 328 of file vecmath.h.

: 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.

: 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.

                                                                          {
                return isZero( x - p.x, eps ) && isZero( y - p.y, eps ) && isZero( z - p.z, eps );
            }
double EMAN::Point3::distanceFromOrigin ( ) const [inline]

Definition at line 378 of file vecmath.h.

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

                                              {
                return (double) sqrt(x * x + y * y + z * z);
            }
double EMAN::Point3::distanceFromOriginSquared ( ) const [inline]

Definition at line 382 of file vecmath.h.

References x, y, and z.

                                                     {
                return x * x + y * y + z * z;
            }
double EMAN::Point3::distanceTo ( const Point3 p) const [inline]

Definition at line 366 of file vecmath.h.

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

                                                     {
                return (double) sqrt((p[0] - x) * (p[0] - x) +
                                     (p[1] - y) * (p[1] - y) +
                                     (p[2] - z) * (p[2] - z));
            }
double EMAN::Point3::distanceToSquared ( const Point3 p) const [inline]

Definition at line 372 of file vecmath.h.

References x, y, and z.

                                                            {
                return ((p[0] - x) * (p[0] - x) +
                        (p[1] - y) * (p[1] - y) +
                        (p[2] - z) * (p[2] - z));
            }
bool EMAN::Point3::operator!= ( const Point3 p) const [inline]

Definition at line 390 of file vecmath.h.

References x, y, and z.

                                                     {
                return x != p.x || y != p.y || z != p.z;
            }   
Point3& EMAN::Point3::operator*= ( double  s) [inline]

Definition at line 349 of file vecmath.h.

References x, y, and z.

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

Definition at line 358 of file vecmath.h.

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

                                                      {
                return Point3(x + v[0], y + v[1], z + v[2]);
            }
Point3& EMAN::Point3::operator+= ( const Vector3 v) [inline]

Definition at line 339 of file vecmath.h.

References x, y, and z.

                                                 {
                x += v[0]; y += v[1]; z += v[2];
                return *this;
            }
Point3 EMAN::Point3::operator- ( const Vector3 v) const [inline]

Definition at line 362 of file vecmath.h.

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

                                                      {
                return Point3(x - v[0], y - v[1], z - v[2]);
            }
Vector3 EMAN::Point3::operator- ( const Point3 p) const [inline]

Definition at line 354 of file vecmath.h.

References x, y, and z.

                                                      {
                return Vector3(x - p.x, y - p.y, z - p.z);
            }
Point3& EMAN::Point3::operator-= ( const Vector3 v) [inline]

Definition at line 344 of file vecmath.h.

References x, y, and z.

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

Definition at line 331 of file vecmath.h.

References x, y, and z.

                                               {
                x = a[0]; y = a[1]; z = a[2];
                return *this;
            }
bool EMAN::Point3::operator== ( const Point3 p) const [inline]

Definition at line 386 of file vecmath.h.

References x, y, and z.

                                                     {
                return x == p.x && y == p.y && z == p.z;
            }
double& EMAN::Point3::operator[] ( int  n) [inline]

Definition at line 337 of file vecmath.h.

References x.

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

Definition at line 336 of file vecmath.h.

References x.

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

Definition at line 398 of file vecmath.h.

References x, y, and z.

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

Member Data Documentation

double EMAN::Point3::x [private]
double EMAN::Point3::y [private]
double EMAN::Point3::z [private]

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