DPoint3 Class Reference

#include <dpoint3.h>

Class Description

class DPoint3 Description: This class describes a 3D point using double precision x, y and z coordinates.

Methods are provided to add and subtract points, multiply and divide by scalars, and element by element multiply and divide two points. All methods are implemented by the system. Data Members: double x,y,z;

+ Inheritance diagram for DPoint3:

Public Member Functions

 DPoint3 ()
 Constructor. More...
 
 DPoint3 (double X, double Y, double Z)
 Constructor. More...
 
 DPoint3 (const DPoint3 &a)
 Constructor. More...
 
 DPoint3 (const Point3 &a)
 
 DPoint3 (double af[3])
 Constructor. More...
 
double & operator[] (int i)
 Allows access to x, y and z using the subscript operator. More...
 
const double & operator[] (int i) const
 Allows access to x, y and z using the subscript operator. More...
 
 operator double * ()
 Conversion function. More...
 
DPoint3 operator- () const
 Unary - operator. More...
 
DPoint3 operator+ () const
 Unary +. More...
 
DPoint3operator= (const Point3 &a)
 
DPoint3operator-= (const DPoint3 &)
 Subtracts a DPoint3 from this DPoint3. More...
 
DPoint3operator+= (const DPoint3 &)
 Adds a DPoint3 to this DPoint3. More...
 
DPoint3operator*= (double)
 Each element of this DPoint3 is multiplied by the specified double. More...
 
DPoint3operator/= (double)
 Each element of this DPoint3 is divided by the specified double. More...
 
DPoint3 operator- (const DPoint3 &) const
 Subtracts a DPoint3 from a DPoint3. More...
 
DPoint3 operator+ (const DPoint3 &) const
 Adds a DPoint3 to a DPoint3. More...
 
double operator* (const DPoint3 &) const
 Computes the dot product of this DPoint3 and the specified DPoint3. More...
 
DPoint3 operator^ (const DPoint3 &) const
 Computes the cross product of this DPoint3 and the specified DPoint3. More...
 
double Length () const
 Returns the 'Length' of this point (vector). More...
 
double LengthSquared () const
 The 'Length' squared of this point. More...
 
DPoint3Unify ()
 in place normalize More...
 
int MaxComponent () const
 
int MinComponent () const
 
int operator== (const DPoint3 &p) const
 Equality operator. More...
 
int operator!= (const DPoint3 &p) const
 Equality operator. More...
 

Public Attributes

double x
 
double y
 
double z
 

Static Public Attributes

static const DPoint3 Origin
 const for (0,0,0) More...
 
static const DPoint3 XAxis
 const for (1,0,0) More...
 
static const DPoint3 YAxis
 const for (0,1,0) More...
 
static const DPoint3 ZAxis
 const for (0,0,1) More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 

Constructor & Destructor Documentation

DPoint3 ( )
inline

Constructor.

No initialization is performed.

31 {}
DPoint3 ( double  X,
double  Y,
double  Z 
)
inline

Constructor.

x, y, and z are initialized to the values specified.

34 { x = X; y = Y; z = Z; }
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
double x
Definition: dpoint3.h:27
DPoint3 ( const DPoint3 a)
inline

Constructor.

x, y, and z are initialized to the DPoint3 specified.

37 { x = a.x; y = a.y; z = a.z; }
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
double x
Definition: dpoint3.h:27
DPoint3 ( const Point3 a)
inline
38 { x = a.x; y = a.y; z = a.z; }
float y
Definition: point3.h:55
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
double x
Definition: dpoint3.h:27
float z
Definition: point3.h:55
float x
Definition: point3.h:55
DPoint3 ( double  af[3])
inline

Constructor.

x, y, and z are initialized to. af[0], af[1], and af[2] respectively. Operators:

43 { x = af[0]; y = af[1]; z = af[2]; }
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
double x
Definition: dpoint3.h:27

Member Function Documentation

double& operator[] ( int  i)
inline

Allows access to x, y and z using the subscript operator.

Returns
An index of 0 will return x, 1 will return y, 2 will return z.
48 { return (&x)[i]; }
double x
Definition: dpoint3.h:27
const double& operator[] ( int  i) const
inline

Allows access to x, y and z using the subscript operator.

Returns
An index of 0 will return x, 1 will return y, 2 will return z.
51 { return (&x)[i]; }
double x
Definition: dpoint3.h:27
operator double * ( )
inline

Conversion function.

Returns the address of the DPoint3.x

55 { return(&x); }
double x
Definition: dpoint3.h:27
DPoint3 operator- ( ) const
inline

Unary - operator.

Negates both x, y and z.

59 { return(DPoint3(-x,-y,-z)); }
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
DPoint3()
Constructor.
Definition: dpoint3.h:31
double x
Definition: dpoint3.h:27
DPoint3 operator+ ( ) const
inline

Unary +.

Returns the point unaltered.

61 { return *this; }
DPoint3& operator= ( const Point3 a)
inline
64 { x = a.x; y = a.y; z = a.z; return *this; }
float y
Definition: point3.h:55
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
double x
Definition: dpoint3.h:27
float z
Definition: point3.h:55
float x
Definition: point3.h:55
DPoint3 & operator-= ( const DPoint3 a)
inline

Subtracts a DPoint3 from this DPoint3.

158  {
159  x -= a.x; y -= a.y; z -= a.z;
160  return *this;
161  }
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
double x
Definition: dpoint3.h:27
DPoint3 & operator+= ( const DPoint3 a)
inline

Adds a DPoint3 to this DPoint3.

163  {
164  x += a.x; y += a.y; z += a.z;
165  return *this;
166  }
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
double x
Definition: dpoint3.h:27
DPoint3 & operator*= ( double  f)
inline

Each element of this DPoint3 is multiplied by the specified double.

168  {
169  x *= f; y *= f; z *= f;
170  return *this;
171  }
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
double x
Definition: dpoint3.h:27
DPoint3 & operator/= ( double  f)
inline

Each element of this DPoint3 is divided by the specified double.

173  {
174  x /= f; y /= f; z /= f;
175  return *this;
176  }
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
double x
Definition: dpoint3.h:27
DPoint3 operator- ( const DPoint3 b) const
inline

Subtracts a DPoint3 from a DPoint3.

178  {
179  return(DPoint3(x-b.x,y-b.y,z-b.z));
180  }
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
DPoint3()
Constructor.
Definition: dpoint3.h:31
double x
Definition: dpoint3.h:27
DPoint3 operator+ ( const DPoint3 b) const
inline

Adds a DPoint3 to a DPoint3.

182  {
183  return(DPoint3(x+b.x,y+b.y,z+b.z));
184  }
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
DPoint3()
Constructor.
Definition: dpoint3.h:31
double x
Definition: dpoint3.h:27
double operator* ( const DPoint3 b) const
inline

Computes the dot product of this DPoint3 and the specified DPoint3.

186  {
187  return(x*b.x+y*b.y+z*b.z);
188  }
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
double x
Definition: dpoint3.h:27
DPoint3 operator^ ( const DPoint3 ) const

Computes the cross product of this DPoint3 and the specified DPoint3.

double Length ( ) const

Returns the 'Length' of this point (vector).

This is:

sqrt(v.x*v.x+v.y*v.y+v.z*v.z)

double LengthSquared ( ) const

The 'Length' squared of this point.

This is v.x*v.x+v.y*v.y+v.z*v.z.

DPoint3& Unify ( )

in place normalize

int MaxComponent ( ) const
Returns
The largest axis
int MinComponent ( ) const
Returns
The smallest axis
int operator== ( const DPoint3 p) const
inline

Equality operator.

Test for equality between two Point3's.

Returns
Nonzero if the Point3's are equal; otherwise 0.
109  {
110  return ((p.x==x)&&(p.y==y)&&(p.z==z));
111  }
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
double x
Definition: dpoint3.h:27
int operator!= ( const DPoint3 p) const
inline

Equality operator.

Test for nonequality between two Point3's.

Returns
Nonzero if the Point3's are not equal; otherwise 0.
114  {
115  return ((p.x!=x)||(p.y!=y)||(p.z!=z));
116  }
double y
Definition: dpoint3.h:27
double z
Definition: dpoint3.h:27
double x
Definition: dpoint3.h:27

Member Data Documentation

double x
double y
double z
const DPoint3 Origin
static

const for (0,0,0)

const DPoint3 XAxis
static

const for (1,0,0)

const DPoint3 YAxis
static

const for (0,1,0)

const DPoint3 ZAxis
static

const for (0,0,1)