00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef VERTEX_HH
00026 #define VERTEX_HH
00027
00028 #include "math-extension.hh"
00029 #include "inline-macro.hh"
00030
00031 #include <iostream>
00032
00047 class CVertex
00048 {
00049 private:
00050 TCoordinate FCoord[3];
00051
00052 public:
00053
00054
00055
00063 CVertex();
00064
00075 CVertex(TCoordinate Ax, TCoordinate Ay, TCoordinate Az);
00076
00085 CVertex(TCoordinate ATab[3]);
00086
00095 CVertex(const CVertex& AVertex);
00096
00100 ~CVertex();
00101
00102
00103
00104
00105
00109 TCoordinate getX() const;
00110
00114 TCoordinate getY() const;
00115
00119 TCoordinate getZ() const;
00120
00126 TCoordinate getCoord(int ADim) const;
00127
00133 void setX(TCoordinate ANewX);
00134
00140 void setY(TCoordinate ANewY);
00141
00147 void setZ(TCoordinate ANewZ);
00148
00155 void setCoord(int ADim, TCoordinate ANewCoord);
00156
00164 void setXYZ(TCoordinate ANewX, TCoordinate ANewY, TCoordinate ANewZ);
00165
00166
00167
00168
00169
00170 CVertex& operator=(const CVertex& AVertex);
00171
00172 bool operator==(const CVertex& AVertex) const;
00173 bool operator!=(const CVertex& AVertex) const;
00174
00175 CVertex& operator+=(const CVertex&);
00176 CVertex& operator-=(const CVertex&);
00177
00178 CVertex& operator*=(TCoordinate);
00179 CVertex& operator/=(TCoordinate);
00180
00181 CVertex operator*(TCoordinate) const;
00182 CVertex operator/(TCoordinate) const;
00183
00184 CVertex operator+(const CVertex&) const;
00185 CVertex operator-(const CVertex&) const;
00186 CVertex operator+( ) const;
00187 CVertex operator-( ) const;
00188
00189
00190
00191
00192
00196 CVertex operator*(const CVertex& AVector) const;
00197
00201 TCoordinate dot(const CVertex& AVector) const;
00202
00203
00204
00205
00206
00210 TCoordinate norm() const;
00211
00215 TCoordinate normalize();
00216
00220 CVertex normalized() const;
00221
00225 TCoordinate sqrNorm() const;
00226
00231 bool isNull() const;
00232
00239 CVertex multiply(const CVertex& AVector) const;
00240
00247 CVertex divide(const CVertex& AVector) const;
00248
00249
00250 };
00251
00252
00253
00254
00259 CVertex operator*(TCoordinate ACoef, const CVertex& AVertex);
00260
00261
00262
00263
00264
00270 std::ostream& operator<<(std::ostream& AStream, const CVertex& AVertex);
00271
00272
00273
00274
00275
00279 static const CVertex ORIGIN(0,0,0);
00280
00284 static const CVertex OX(1,0,0);
00285
00289 static const CVertex OY(0,1,0);
00290
00294 static const CVertex OZ(0,0,1);
00295
00299 static const CVertex BASE[3] = { OX, OY, OZ };
00300
00301
00302
00303 #include INCLUDE_INLINE("vertex.icc")
00304
00305 #endif // VERTEX_HH
00306