IPoint3 Class Reference

#include <ipoint3.h>

Class Description

See also
Class Point3.

Description:
This class describes a 3D point using integer 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:
int x,y,z;
+ Inheritance diagram for IPoint3:

Public Member Functions

 IPoint3 ()
 Initializes all vector components to zero. More...
 
 IPoint3 (int X, int Y, int Z)
 
 IPoint3 (const IPoint3 &a)
 
 IPoint3 (const int ai[3])
 
intoperator[] (int i)
 
const intoperator[] (int i) const
 
 operator int * ()
 
IPoint3 operator- () const
 
IPoint3 operator+ () const
 
IPoint3operator-= (const IPoint3 &)
 
IPoint3operator+= (const IPoint3 &)
 
IPoint3operator*= (const IPoint3 &)
 Member-wise, in-place multiplication of this vector: (x*x, y*y, z*z) More...
 
IPoint3 operator- (const IPoint3 &) const
 
IPoint3 operator+ (const IPoint3 &) const
 
IPoint3 operator* (const IPoint3 &) const
 Member-wise multiplication of two vectors: (x*x, y*y, z*z) More...
 
int DotProd (const IPoint3 &) const
 
IPoint3 operator^ (const IPoint3 &) const
 
IPoint3 CrossProd (const IPoint3 &) const
 
int operator== (const IPoint3 &p) const
 
int operator!= (const IPoint3 &p) const
 

Public Attributes

int x
 
int y
 
int z
 

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...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Constructor & Destructor Documentation

IPoint3 ( )
inline

Initializes all vector components to zero.

36 : x(0), y(0), z(0) { }
int y
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:33
int z
Definition: ipoint3.h:33
IPoint3 ( int  X,
int  Y,
int  Z 
)
inline
Remarks
Constructor. x, y, and z are initialized to the values specified.
39 { x = X; y = Y; z = Z; }
int y
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:33
int z
Definition: ipoint3.h:33
IPoint3 ( const IPoint3 a)
inline
Remarks
Constructor. x, y, and z are initialized to the IPoint3 specified.
42 { x = a.x; y = a.y; z = a.z; }
int y
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:33
int z
Definition: ipoint3.h:33
IPoint3 ( const int  ai[3])
inline
Remarks
Constructor. x, y, and z are initialized to. ai[0], ai[1], and ai[2] respectively.
45 { x = ai[0]; y = ai[1]; z = ai[2]; }
int y
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:33
int z
Definition: ipoint3.h:33

Member Function Documentation

int& operator[] ( int  i)
inline
Remarks
Allows access to x, y and z using the [ ] operator.
Returns
An index of 0 will return x, 1 will return y, 2 will return z.
50 { DbgAssert((i >= 0) && (i <= 2)); return (&x)[i]; }
int x
Definition: ipoint3.h:33
#define DbgAssert(expr)
Definition: assert1.h:72
const int& operator[] ( int  i) const
inline
Remarks
Allows access to x, y and z using the [ ] operator.
Returns
An index of 0 will return x, 1 will return y, 2 will return z.
53 { DbgAssert((i >= 0) && (i <= 2)); return (&x)[i]; }
int x
Definition: ipoint3.h:33
#define DbgAssert(expr)
Definition: assert1.h:72
operator int * ( )
inline
Remarks
Conversion function. Returns the address of the IPoint3.
57 { return(&x); }
int x
Definition: ipoint3.h:33
IPoint3 operator- ( ) const
inline
Remarks
Unary - operator. Negates x, y and z.
61 { return(IPoint3(-x,-y,-z)); }
IPoint3()
Initializes all vector components to zero.
Definition: ipoint3.h:36
int y
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:33
int z
Definition: ipoint3.h:33
IPoint3 operator+ ( ) const
inline
Remarks
Unary +. Returns the point unaltered.
63 { return *this; }
IPoint3 & operator-= ( const IPoint3 a)
inline
Remarks
Subtracts a IPoint3 from this IPoint3.
114  {
115  x -= a.x; y -= a.y; z -= a.z;
116  return *this;
117  }
int y
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:33
int z
Definition: ipoint3.h:33
IPoint3 & operator+= ( const IPoint3 a)
inline
Remarks
Adds a IPoint3 to this IPoint3.
119  {
120  x += a.x; y += a.y; z += a.z;
121  return *this;
122  }
int y
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:33
int z
Definition: ipoint3.h:33
IPoint3 & operator*= ( const IPoint3 rhs)
inline

Member-wise, in-place multiplication of this vector: (x*x, y*y, z*z)

125 {
126  x *= rhs.x;
127  y *= rhs.y;
128  z *= rhs.z;
129  return *this;
130 }
int y
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:33
int z
Definition: ipoint3.h:33
IPoint3 operator- ( const IPoint3 b) const
inline
Remarks
Subtracts a IPoint3 from a IPoint3.
132  {
133  return(IPoint3(x-b.x,y-b.y,z-b.z));
134  }
IPoint3()
Initializes all vector components to zero.
Definition: ipoint3.h:36
int y
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:33
int z
Definition: ipoint3.h:33
IPoint3 operator+ ( const IPoint3 b) const
inline
Remarks
Adds a IPoint3 to a IPoint3.
136  {
137  return(IPoint3(x+b.x,y+b.y,z+b.z));
138  }
IPoint3()
Initializes all vector components to zero.
Definition: ipoint3.h:36
int y
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:33
int z
Definition: ipoint3.h:33
IPoint3 operator* ( const IPoint3 b) const
inline

Member-wise multiplication of two vectors: (x*x, y*y, z*z)

140  {
141  return IPoint3(x * b.x, y * b.y, z * b.z);
142  }
IPoint3()
Initializes all vector components to zero.
Definition: ipoint3.h:36
int y
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:33
int z
Definition: ipoint3.h:33
int DotProd ( const IPoint3 b) const
inline
Remarks
Returns the dot product of two IPoint3s.
144  {
145  return(x*b.x+y*b.y+z*b.z);
146  }
int y
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:33
int z
Definition: ipoint3.h:33
IPoint3 operator^ ( const IPoint3 ) const
Remarks
The cross product of two IPoint3's (vectors).
IPoint3 CrossProd ( const IPoint3 ) const
Remarks
Returns the cross product of two IPoint3's (vectors).
int operator== ( const IPoint3 p) const
inline
Remarks
Test for equality between two IPoint3's.
Returns
Nonzero if the IPoint3's are equal; otherwise 0.

91 { return (x == p.x && y == p.y && z == p.z); }
int y
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:33
int z
Definition: ipoint3.h:33
int operator!= ( const IPoint3 p) const
inline
92 { return ( (x != p.x) || (y != p.y) || (z != p.z) ); }
int y
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:33
int z
Definition: ipoint3.h:33

Member Data Documentation

int x
int y
int z