EMAN2
Public Member Functions | Private Attributes | List of all members
EMAN::Point3 Class Reference

#include <vecmath.h>

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

Constructor & Destructor Documentation

◆ Point3() [1/3]

EMAN::Point3::Point3 ( )
inline

Definition at line 323 of file vecmath.h.

323: x(0), y(0), z(0) {}
double y
Definition: vecmath.h:399
double x
Definition: vecmath.h:399
double z
Definition: vecmath.h:399

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

◆ Point3() [2/3]

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

Definition at line 324 of file vecmath.h.

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

◆ Point3() [3/3]

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

Definition at line 325 of file vecmath.h.

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

Member Function Documentation

◆ approxEqual()

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

Definition at line 390 of file vecmath.h.

390 {
391 return isZero( x - p.x, eps ) && isZero( y - p.y, eps ) && isZero( z - p.z, eps );
392 }
bool isZero(double in_d, double in_dEps=1e-16)
Definition: vecmath.h:44

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

◆ distanceFromOrigin()

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

Definition at line 374 of file vecmath.h.

374 {
375 return (double) sqrt(x * x + y * y + z * z);
376 }
EMData * sqrt() const
return square root of current image

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

◆ distanceFromOriginSquared()

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

Definition at line 378 of file vecmath.h.

378 {
379 return x * x + y * y + z * z;
380 }

References x, y, and z.

◆ distanceTo()

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

Definition at line 362 of file vecmath.h.

362 {
363 return (double) sqrt((p[0] - x) * (p[0] - x) +
364 (p[1] - y) * (p[1] - y) +
365 (p[2] - z) * (p[2] - z));
366 }

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

◆ distanceToSquared()

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

Definition at line 368 of file vecmath.h.

368 {
369 return ((p[0] - x) * (p[0] - x) +
370 (p[1] - y) * (p[1] - y) +
371 (p[2] - z) * (p[2] - z));
372 }

References x, y, and z.

◆ operator!=()

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

Definition at line 386 of file vecmath.h.

386 {
387 return x != p.x || y != p.y || z != p.z;
388 }

References x, y, and z.

◆ operator*=()

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

Definition at line 345 of file vecmath.h.

345 {
346 x *= s; y *= s; z *= s;
347 return *this;
348 }

References x, y, and z.

◆ operator+()

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

Definition at line 354 of file vecmath.h.

354 {
355 return Point3(x + v[0], y + v[1], z + v[2]);
356 }

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

◆ operator+=()

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

Definition at line 335 of file vecmath.h.

335 {
336 x += v[0]; y += v[1]; z += v[2];
337 return *this;
338 }

References x, y, and z.

◆ operator-() [1/2]

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

Definition at line 350 of file vecmath.h.

350 {
351 return Vector3(x - p.x, y - p.y, z - p.z);
352 }

References x, y, and z.

◆ operator-() [2/2]

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

Definition at line 358 of file vecmath.h.

358 {
359 return Point3(x - v[0], y - v[1], z - v[2]);
360 }

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

◆ operator-=()

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

Definition at line 340 of file vecmath.h.

340 {
341 x -= v[0]; y -= v[1]; z -= v[2];
342 return *this;
343 }

References x, y, and z.

◆ operator=()

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

Definition at line 327 of file vecmath.h.

327 {
328 x = a[0]; y = a[1]; z = a[2];
329 return *this;
330 }

References x, y, and z.

◆ operator==()

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

Definition at line 382 of file vecmath.h.

382 {
383 return x == p.x && y == p.y && z == p.z;
384 }

References x, y, and z.

◆ operator[]() [1/2]

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

Definition at line 333 of file vecmath.h.

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

References x.

◆ operator[]() [2/2]

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

Definition at line 332 of file vecmath.h.

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

References x.

◆ print()

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

Definition at line 394 of file vecmath.h.

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

References x, y, and z.

Member Data Documentation

◆ x

double EMAN::Point3::x
private

◆ y

double EMAN::Point3::y
private

◆ z

double EMAN::Point3::z
private

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