| 285 |
|
* @return the length of this vector |
| 286 |
|
*/ |
| 287 |
|
inline double length() { |
| 288 |
< |
return sqrt(lengthSquared()); |
| 288 |
> |
return sqrt(lengthSquare()); |
| 289 |
|
} |
| 290 |
|
|
| 291 |
|
/** |
| 301 |
|
double len; |
| 302 |
|
|
| 303 |
|
len = length(); |
| 304 |
+ |
|
| 305 |
+ |
//if (len < oopse:epsilon) |
| 306 |
+ |
// throw(); |
| 307 |
+ |
|
| 308 |
|
*this /= len; |
| 309 |
|
} |
| 310 |
|
|
| 312 |
|
* Tests if this vector is normalized |
| 313 |
|
* @return true if this vector is normalized, otherwise return false |
| 314 |
|
*/ |
| 315 |
< |
inline bool isNormalized() const |
| 316 |
< |
{ |
| 313 |
< |
return lengthSquare() == 1.0; |
| 315 |
> |
inline bool isNormalized() { |
| 316 |
> |
return equal(lengthSquare(), 1.0); |
| 317 |
|
} |
| 318 |
|
|
| 319 |
|
protected: |
| 395 |
|
return result; |
| 396 |
|
} |
| 397 |
|
|
| 395 |
– |
/** fuzzy comparson */ |
| 396 |
– |
template<typename Real, unsigned int Dim> |
| 397 |
– |
inline bool epsilonEqual( const Vector<Real, Dim>& v1, const Vector<Real, Dim>& v2 ) { |
| 398 |
– |
|
| 399 |
– |
} |
| 400 |
– |
|
| 401 |
– |
|
| 398 |
|
/** |
| 399 |
|
* Returns the dot product of two Vectors |
| 400 |
|
* @param v1 first vector |