$search
00001 00005 #ifndef VECTOR3_HH 00006 #define VECTOR3_HH 00007 00008 #include <iostream> 00009 #include <blort/Recognizer3D/PNamespace.hh> 00010 #include <blort/Recognizer3D/Except.hh> 00011 00012 namespace P 00013 { 00014 00018 class Vector3 00019 { 00020 00021 public: 00022 double x, y, z; 00023 Vector3(); 00024 Vector3(double xx, double yy, double zz); 00025 void Set(double xx, double yy, double zz){ x=xx; y=yy; z=zz;} 00026 Vector3& operator+=(const Vector3 &v); 00027 Vector3& operator-=(const Vector3 &v); 00028 Vector3& operator*=(double s); 00029 Vector3& operator/=(double s) throw(Except); 00030 double NormSquare() const; 00031 double LengthSquare() const; 00032 double Norm() const; 00033 double Length() const; 00034 void Normalise(); 00035 00036 }; 00037 00038 Vector3 operator-(const Vector3 &v); 00039 bool operator==(const Vector3 &a, const Vector3 &b); 00040 bool operator!=(const Vector3 &a, const Vector3 &b); 00041 Vector3 operator+(const Vector3 &a, const Vector3 &b); 00042 Vector3 operator-(const Vector3 &a, const Vector3 &b); 00043 Vector3 operator*(const double s, const Vector3 &v); 00044 Vector3 operator*(const Vector3 &v, const double s); 00045 Vector3 operator/(const Vector3 &v, const double s) throw(Except); 00046 double Length(const Vector3 &v); 00047 Vector3 Normalise(const Vector3 &v); 00048 double Dot(const Vector3 &a, const Vector3 &b); 00049 Vector3 Cross(const Vector3 &a, const Vector3 &b); 00050 Vector3 MidPoint(const Vector3 &a, const Vector3 &b); 00051 double AngleBetween(const Vector3 &a, const Vector3 &b); 00052 double DistanceSquare(const Vector3 &a, const Vector3 &b); 00053 double Distance(const Vector3 &a, const Vector3 &b); 00054 Vector3 PlaneExp2Normal(const Vector3 &a, const Vector3 &b, const Vector3 &c); 00055 00056 ostream& operator<<(ostream &os, const Vector3 &v); 00057 istream& operator>>(istream &is, Vector3 &v) throw(Except); 00058 string& operator<<(string &s, const Vector3 &v); 00059 const string& operator>>(const string &s, Vector3 &v); 00060 } 00061 00062 #include <blort/Recognizer3D/Vector3.ic> 00063 00064 #endif