Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #pragma once
00015
00016 #include "GeomExport.h"
00017 #include "maxheap.h"
00018 #include "point3.h"
00019 #include <iosfwd>
00020
00029 class DPoint3: public MaxHeapOperators {
00030 public:
00031 double x,y,z;
00032
00033
00035 DPoint3(){}
00038 DPoint3(double X, double Y, double Z) { x = X; y = Y; z = Z; }
00041 DPoint3(const DPoint3& a) { x = a.x; y = a.y; z = a.z; }
00042 DPoint3(const Point3& a) { x = a.x; y = a.y; z = a.z; }
00047 DPoint3(double af[3]) { x = af[0]; y = af[1]; z = af[2]; }
00048
00049
00052 double& operator[](int i) { return (&x)[i]; }
00055 const double& operator[](int i) const { return (&x)[i]; }
00056
00057
00059 operator double*() { return(&x); }
00060
00061
00063 DPoint3 operator-() const { return(DPoint3(-x,-y,-z)); }
00065 DPoint3 operator+() const { return *this; }
00066
00067
00068 GEOMEXPORT DPoint3& operator=(const Point3& a) { x = a.x; y = a.y; z = a.z; return *this; }
00070 GEOMEXPORT DPoint3& operator-=(const DPoint3&);
00072 GEOMEXPORT DPoint3& operator+=(const DPoint3&);
00075 GEOMEXPORT DPoint3& operator*=(double);
00078 GEOMEXPORT DPoint3& operator/=(double);
00079
00080
00082 GEOMEXPORT DPoint3 operator-(const DPoint3&) const;
00084 GEOMEXPORT DPoint3 operator+(const DPoint3&) const;
00087 GEOMEXPORT double operator*(const DPoint3&) const;
00090 GEOMEXPORT DPoint3 operator^(const DPoint3&) const;
00091
00092 };
00093
00096 GEOMEXPORT double Length(const DPoint3&);
00099 GEOMEXPORT int MaxComponent(const DPoint3&);
00102 GEOMEXPORT int MinComponent(const DPoint3&);
00105 GEOMEXPORT DPoint3 Normalize(const DPoint3&);
00106
00107 GEOMEXPORT DPoint3 operator*(double, const DPoint3&);
00108 GEOMEXPORT DPoint3 operator*(const DPoint3&, double);
00109 GEOMEXPORT DPoint3 operator/(const DPoint3&, double);
00110
00111
00112 GEOMEXPORT std::ostream &operator<<(std::ostream&, const DPoint3&);
00113
00114
00115
00116 inline double Length(const DPoint3& v) {
00117 return (double)sqrt(v.x*v.x+v.y*v.y+v.z*v.z);
00118 }
00119
00120 inline DPoint3& DPoint3::operator-=(const DPoint3& a) {
00121 x -= a.x; y -= a.y; z -= a.z;
00122 return *this;
00123 }
00124
00125 inline DPoint3& DPoint3::operator+=(const DPoint3& a) {
00126 x += a.x; y += a.y; z += a.z;
00127 return *this;
00128 }
00129
00130 inline DPoint3& DPoint3::operator*=(double f) {
00131 x *= f; y *= f; z *= f;
00132 return *this;
00133 }
00134
00135 inline DPoint3& DPoint3::operator/=(double f) {
00136 x /= f; y /= f; z /= f;
00137 return *this;
00138 }
00139
00140 inline DPoint3 DPoint3::operator-(const DPoint3& b) const {
00141 return(DPoint3(x-b.x,y-b.y,z-b.z));
00142 }
00143
00144 inline DPoint3 DPoint3::operator+(const DPoint3& b) const {
00145 return(DPoint3(x+b.x,y+b.y,z+b.z));
00146 }
00147
00148 inline double DPoint3::operator*(const DPoint3& b) const {
00149 return(x*b.x+y*b.y+z*b.z);
00150 }
00151
00152 inline DPoint3 operator*(double f, const DPoint3& a) {
00153 return(DPoint3(a.x*f, a.y*f, a.z*f));
00154 }
00155
00156 inline DPoint3 operator*(const DPoint3& a, double f) {
00157 return(DPoint3(a.x*f, a.y*f, a.z*f));
00158 }
00159
00160 inline DPoint3 operator/(const DPoint3& a, double f) {
00161 return(DPoint3(a.x/f, a.y/f, a.z/f));
00162 }
00163
00165 GEOMEXPORT DPoint3 CrossProd(const DPoint3& a, const DPoint3& b);
00166
00168 GEOMEXPORT double DotProd(const DPoint3& a, const DPoint3& b) ;
00169
00170