/vol/vipdata/irtk/contrib++/include/irtkVector3.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef IRTKVECTOR3_H
00014
00015 #define IRTKVECTOR3_H
00016
00017 #include <irtkArith.h>
00018
00019 class irtkVector3
00020 {
00021 public:
00022
00023 irtkVector3 ();
00024 irtkVector3 (double fX, double fY, double fZ);
00025 irtkVector3 (double afCoordinate[3]);
00026 irtkVector3 (const irtkVector3& rkVector);
00027
00028
00029 double x, y, z;
00030 double& operator[] (int i) const;
00031 operator double* ();
00032
00033
00034 irtkVector3& operator= (const irtkVector3& rkVector);
00035 bool operator== (const irtkVector3& rkVector) const;
00036 bool operator!= (const irtkVector3& rkVector) const;
00037
00038
00039 irtkVector3 operator+ (const irtkVector3& rkVector) const;
00040 irtkVector3 operator- (const irtkVector3& rkVector) const;
00041 irtkVector3 operator* (double fScalar) const;
00042 irtkVector3 operator/ (double fScalar) const;
00043 irtkVector3 operator- () const;
00044 friend irtkVector3 operator* (double fScalar, const irtkVector3& rkVector);
00045
00046
00047 irtkVector3& operator+= (const irtkVector3& rkVector);
00048 irtkVector3& operator-= (const irtkVector3& rkVector);
00049 irtkVector3& operator*= (double fScalar);
00050 irtkVector3& operator/= (double fScalar);
00051
00052
00053 double Length () const;
00054 double SquaredLength () const;
00055 double Dot (const irtkVector3& rkVector) const;
00056 double Unitize (double fTolerance = 1e-06);
00057 irtkVector3 Cross (const irtkVector3& rkVector) const;
00058 irtkVector3 UnitCross (const irtkVector3& rkVector) const;
00059
00060
00061 static void Orthonormalize (irtkVector3 akVector[3]);
00062
00063
00064
00065
00066 static void GenerateOrthonormalBasis (irtkVector3& rkU, irtkVector3& rkV,
00067 irtkVector3& rkW, bool bUnitLengthW = true);
00068
00069
00070 static const irtkVector3 ZERO;
00071 static const irtkVector3 UNIT_X;
00072 static const irtkVector3 UNIT_Y;
00073 static const irtkVector3 UNIT_Z;
00074 };
00075
00076 #endif