00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _VEC_H
00011 #define _VEC_H
00012
00013 class Vec {
00014 public:
00015 Vec( double a0, double a1, double a2 );
00016 Vec()
00017 : a0_( 0.0 ), a1_( 0.0 ), a2_( 0.0 )
00018 {;}
00019
00020 double length() const;
00021
00022 double distance( const Vec& other ) const;
00023
00024 double dotProduct( const Vec& other ) const;
00025
00026 Vec crossProduct( const Vec& other ) const;
00027
00029 void unitLength();
00030
00032 void orthogonalAxes( Vec& u, Vec& v ) const;
00033
00034 double a0() const {
00035 return a0_;
00036 }
00037 double a1() const {
00038 return a1_;
00039 }
00040 double a2() const {
00041 return a2_;
00042 }
00043
00049 Vec pointOnLine( const Vec& end, double k );
00050
00051 bool operator==( const Vec& other ) const;
00052
00053 Vec operator-( const Vec& other ) const;
00054
00055 Vec operator+( const Vec& other ) const;
00056
00057 Vec operator*( const double& other ) const;
00058
00059 private:
00060 double a0_;
00061 double a1_;
00062 double a2_;
00063 };
00064
00065 #endif // _VEC_H