Changeset 2752 for GTP/trunk/App/Demos/Vis/CHC_revisited/Vector3.h
- Timestamp:
- 06/10/08 15:48:44 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/CHC_revisited/Vector3.h
r2751 r2752 67 67 return (const float*) this; 68 68 } 69 70 69 71 70 const float &operator[] (const int inx) const … … 81 80 } 82 81 83 84 82 void SetValue(float a) 85 83 { … … 90 88 */ 91 89 int DrivingAxis(void) const; 92 93 90 /** returns the axis, where the std::vector has the smallest value 94 91 */ … … 100 97 return (x > y) ? ( (x > z) ? x : z) : ( (y > z) ? y : z); 101 98 } 102 103 99 /** Returns copy of this vector where all components are positiv. 104 100 */ … … 107 103 return Vector3(fabs(x), fabs(y), fabs(z)); 108 104 } 109 110 // normalizes the std::vector of unit size corresponding to given std::vector105 /** normalizes the std::vector of unit size corresponding to given std::vector 106 */ 111 107 inline void Normalize(); 112 113 108 /** Returns false if this std::vector has a nan component. 114 109 */ 115 110 bool CheckValidity() const; 116 117 /**118 ===> Using ArbitraryNormal() for constructing coord systems119 ===> is obsoleted by RightHandedBase() method (<JK> 12/20/03).120 121 Return an arbitrary normal to `v'.122 In fact it tries v x (0,0,1) an if the result is too small,123 it definitely does v x (0,1,0). It will always work for124 non-degenareted std::vector and is much faster than to use125 TangentVectors.126 127 @param v(in) The std::vector we want to find normal for.128 @return The normal std::vector to v.129 */130 friend inline Vector3 ArbitraryNormal(const Vector3 &v);131 132 111 /** 133 112 Find a right handed coordinate system with (*this) being … … 152 131 */ 153 132 void RightHandedBase(Vector3& U, Vector3& V) const; 133 134 135 // Unary operators 136 137 Vector3 operator+ () const; 138 Vector3 operator- () const; 139 140 // Assignment operators 141 142 Vector3& operator+= (const Vector3 &A); 143 Vector3& operator-= (const Vector3 &A); 144 Vector3& operator*= (const Vector3 &A); 145 Vector3& operator*= (float A); 146 Vector3& operator/= (float A); 147 148 149 ////////// 150 //-- friends 151 152 /** 153 ===> Using ArbitraryNormal() for constructing coord systems 154 ===> is obsoleted by RightHandedBase() method (<JK> 12/20/03). 155 156 Return an arbitrary normal to `v'. 157 In fact it tries v x (0,0,1) an if the result is too small, 158 it definitely does v x (0,1,0). It will always work for 159 non-degenareted std::vector and is much faster than to use 160 TangentVectors. 161 162 @param v(in) The std::vector we want to find normal for. 163 @return The normal std::vector to v. 164 */ 165 friend inline Vector3 ArbitraryNormal(const Vector3 &v); 154 166 155 167 /// Transforms a std::vector to the global coordinate frame. … … 162 174 */ 163 175 friend inline Vector3 ToGlobalFrame(const Vector3& loc, 164 const Vector3& U,165 const Vector3& V,166 const Vector3& N);176 const Vector3& U, 177 const Vector3& V, 178 const Vector3& N); 167 179 168 180 /// Transforms a std::vector to a local coordinate frame. … … 175 187 */ 176 188 friend inline Vector3 ToLocalFrame(const Vector3& loc, 177 178 const Vector3& V,179 const Vector3& N);189 const Vector3& U, 190 const Vector3& V, 191 const Vector3& N); 180 192 181 193 /// the magnitude=size of the std::vector … … 187 199 /// SqrMagnitude(v1-v2) 188 200 friend inline float SqrDistance(const Vector3 &v1, const Vector3 &v2); 189 190 // creates the std::vector of unit size corresponding to given std::vector 201 /// creates the std::vector of unit size corresponding to given std::vector 191 202 friend inline Vector3 Normalize(const Vector3 &A); 192 193 // Rotate a normal std::vector. 203 /// // Rotate a direction vector 194 204 friend Vector3 PlaneRotate(const Matrix4x4 &, const Vector3 &); 195 205 … … 209 219 // to the vectors `N','D', and `V'. Then 'N', 'U', and 'V' create 210 220 // the orthonormal base in space R3. 211 friend void TangentVectors(Vector3 &U, 212 Vector3 &V, // output 221 friend void TangentVectors(Vector3 &U, Vector3 &V, // output 213 222 const Vector3 &normal, // input 214 223 const Vector3 &dirIncoming); 215 224 216 // Unary operators217 Vector3 operator+ () const;218 Vector3 operator- () const;219 220 // Assignment operators221 Vector3& operator+= (const Vector3 &A);222 Vector3& operator-= (const Vector3 &A);223 Vector3& operator*= (const Vector3 &A);224 Vector3& operator*= (float A);225 Vector3& operator/= (float A);226 225 227 226 // Binary operators 227 228 228 friend inline Vector3 operator+ (const Vector3 &A, const Vector3 &B); 229 229 friend inline Vector3 operator- (const Vector3 &A, const Vector3 &B);
Note: See TracChangeset
for help on using the changeset viewer.