Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #pragma once
00014
00015 #include "GeomExport.h"
00016 #include "maxheap.h"
00017 #include <iosfwd>
00018 #include <math.h>
00019
00028 class IPoint3: public MaxHeapOperators {
00029 public:
00030 int x,y,z;
00031
00032
00034 IPoint3(){}
00037 IPoint3(int X, int Y, int Z) { x = X; y = Y; z = Z; }
00040 IPoint3(const IPoint3& a) { x = a.x; y = a.y; z = a.z; }
00043 IPoint3(int ai[3]) { x = ai[0]; y = ai[1]; z = ai[2]; }
00044
00045
00048 int& operator[](int i) { return (&x)[i]; }
00051 const int& operator[](int i) const { return (&x)[i]; }
00052
00053
00055 operator int*() { return(&x); }
00056
00057
00059 IPoint3 operator-() const { return(IPoint3(-x,-y,-z)); }
00061 IPoint3 operator+() const { return *this; }
00062
00063
00065 GEOMEXPORT IPoint3& operator-=(const IPoint3&);
00067 GEOMEXPORT IPoint3& operator+=(const IPoint3&);
00068
00069
00071 GEOMEXPORT IPoint3 operator-(const IPoint3&) const;
00073 GEOMEXPORT IPoint3 operator+(const IPoint3&) const;
00075 GEOMEXPORT int operator*(const IPoint3&) const;
00077 GEOMEXPORT int DotProd(const IPoint3&) const;
00079 GEOMEXPORT IPoint3 operator^(const IPoint3&) const;
00083 GEOMEXPORT IPoint3 CrossProd(const IPoint3&) const;
00084
00085
00089 int operator==(const IPoint3& p) const { return (x == p.x && y == p.y && z == p.z); }
00090 int operator!=(const IPoint3& p) const { return ( (x != p.x) || (y != p.y) || (z != p.z) ); }
00091 };
00092
00093
00096 GEOMEXPORT int MaxComponent(const IPoint3&);
00099 GEOMEXPORT int MinComponent(const IPoint3&);
00100
00101 GEOMEXPORT std::ostream &operator<<(std::ostream&, const IPoint3&);
00102
00103
00104
00105
00108 inline float Length(const IPoint3& v) {
00109 return (float)sqrt((double)(v.x*v.x+v.y*v.y+v.z*v.z));
00110 }
00111
00112 inline IPoint3& IPoint3::operator-=(const IPoint3& a) {
00113 x -= a.x; y -= a.y; z -= a.z;
00114 return *this;
00115 }
00116
00117 inline IPoint3& IPoint3::operator+=(const IPoint3& a) {
00118 x += a.x; y += a.y; z += a.z;
00119 return *this;
00120 }
00121
00122 inline IPoint3 IPoint3::operator-(const IPoint3& b) const {
00123 return(IPoint3(x-b.x,y-b.y,z-b.z));
00124 }
00125
00126 inline IPoint3 IPoint3::operator+(const IPoint3& b) const {
00127 return(IPoint3(x+b.x,y+b.y,z+b.z));
00128 }
00129
00130 inline int IPoint3::operator*(const IPoint3& b) const {
00131 return(x*b.x+y*b.y+z*b.z);
00132 }
00133
00134 inline int IPoint3::DotProd(const IPoint3& b) const {
00135 return(x*b.x+y*b.y+z*b.z);
00136 }
00137
00138