Diff Revisions 1 vs 10 for /trunk/geometry.h
| 1 | 10 | <- Revisions | |
|
Diff lines for: Rev 1 : Lines 40 -> 69 Rev 10 : Lines 40 -> 69 |
|||
| 40 | 40 | struct Vector | |
| 41 | 41 | { | |
| 42 | 42 | private: | |
| 43 | - | FloatType x,y,z; | |
| 43 | + | FloatType data[noOfAxis]; | |
| 44 | 44 | ||
| 45 | 45 | public: | |
| 46 | - | Vector():x(0.),y(0.),z(0.){} | |
| 47 | - | Vector(FloatType ax, FloatType ay, FloatType az):x(ax),y(ay),z(az){} | |
| 46 | + | Vector(){data[dirXP]=0.;data[dirYP]=0.;data[dirZP]=0.;} | |
| 47 | + | Vector(FloatType ax, FloatType ay, FloatType az){data[dirXP]=ax;data[dirYP]=ay;data[dirZP]=az;} | |
| 48 | 48 | ||
| 49 | - | inline FloatType& operator[](SeqType dir) {return *(&x+dir);} | |
| 50 | - | inline FloatType operator()(SeqType dir)const {return *(&x+dir);} | |
| 51 | - | bool operator==(Vector otherVec); | |
| 52 | - | void operator+=(Vector otherVec); | |
| 53 | - | void operator*=(FloatType r); | |
| 54 | - | void operator/=(FloatType r); | |
| 55 | - | FloatType operator*(Vector otherVec); | |
| 56 | - | Vector operator^(Vector otherVec); | |
| 57 | - | Vector operator*(FloatType r); | |
| 58 | - | Vector operator/(FloatType r); | |
| 59 | - | Vector operator+(Vector otherVec); | |
| 60 | - | Vector operator-(Vector otherVec); | |
| 61 | - | Vector operator-(); | |
| 49 | + | inline FloatType& operator[](const SeqType axis) {return *(data+axis);} | |
| 50 | + | inline FloatType operator()(const SeqType axis) const {return *(data+axis);} | |
| 51 | + | bool operator==(const Vector aVec) const; | |
| 52 | + | void operator+=(const Vector aVec); | |
| 53 | + | void operator*=(const FloatType r); | |
| 54 | + | void operator/=(const FloatType r); | |
| 55 | + | FloatType operator*(const Vector aVec) const; | |
| 56 | + | Vector operator^(const Vector aVec) const; | |
| 57 | + | Vector operator*(const FloatType r) const; | |
| 58 | + | Vector operator/(const FloatType r) const; | |
| 59 | + | Vector operator+(const Vector aVec) const; | |
| 60 | + | Vector operator-(const Vector aVec) const; | |
| 61 | + | Vector operator-() const; | |
| 62 | 62 | ||
| 63 | - | FloatType dist(Vector aVec); | |
| 64 | - | FloatType len(); | |
| 63 | + | FloatType dist(Vector const aVec) const; | |
| 64 | + | FloatType len() const; | |
| 65 | 65 | ||
| 66 | - | static bool less(Vector* a,Vector* b); | |
| 66 | + | static bool less(const Vector& a,const Vector& b); | |
| 67 | 67 | }; | |
| 68 | 68 | ||
| 69 | 69 | struct FractionalComponent | |
View this file contents
View the full history
Commits for aban:/trunk/geometry.h