00001
00002
00003
00004
00005
00006 #ifndef __VECTOR3D_H_
00007 #define __VECTOR3D_H_
00008
00010
00011 class Point3D;
00012
00013 class Vector3D
00014 {
00015 private:
00016 float x,y,z;
00017
00018 public:
00019
00020 Vector3D();
00021 Vector3D(float x, float y, float z);
00022
00023 Vector3D(const Point3D &p, const Point3D &q);
00024
00025
00026
00028
00029 void Round(void);
00030 void Zero_Clamp(void);
00031
00032 int IsUnit(void) const;
00033 int IsZero(void) const;
00034 int IsParallel(const Vector3D &v) const;
00035
00036 float GetX() const;
00037 float GetY() const;
00038 float GetZ() const;
00039
00040 void GetValues(float &x, float &y, float &z) const;
00041 void SetValues(const float x, const float y, const float z);
00042 void CreateVector(const Point3D &p, const Point3D &q);
00043
00045
00046 double DotProduct(const Vector3D &v) const;
00047 void CrossProduct(const Vector3D &a, const Vector3D &b);
00048 double GetAngleDeg(const Vector3D &v) const;
00049 double GetAngleRad(const Vector3D &v) const;
00050
00051 double Length(void) const;
00052
00054
00055 double Normalize(void);
00056 void Scale(float s);
00057 void Negate(void);
00058
00060
00061
00062 void glTranslate(void) const;
00063 void glRotate(const float angle) const;
00064
00066
00067
00068 Vector3D operator*(const Vector3D &v) const;
00069
00070
00071
00072
00073 Vector3D operator+(const Vector3D &v) const;
00074 Vector3D operator-(const Vector3D &v) const;
00075 Vector3D operator-() const;
00076
00077 Vector3D& operator=(const Vector3D &v);
00078 Vector3D& operator+=(const Vector3D &v);
00079 Vector3D& operator-=(const Vector3D &v);
00080 Vector3D& operator*=(const float s);
00081
00082 int operator==(const Vector3D &v) const;
00083 int operator!=(const Vector3D &v) const;
00084
00085
00086 void Print();
00087 };
00088
00090
00091 #endif // __VECTOR3D_H_