Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 867 vs 882 for /trunk/Source Code/Core/Math/Headers/MathVectors.h

Diff revisions: vs.
  @@ -335,13 +335,18 @@
335 335 /// set the 2 components of the vector back to 0
336 336 inline void reset() { this->set((T)0); }
337 337 /// return the vector's length
338 - inline T length() const { return Divide::Sqrt(this->x * this->x + this->y * this->y); }
338 + inline T length() const { return Divide::Sqrt(lengthSquared()); }
339 + inline T lengthSquared() const;
339 340 /// return the angle defined by the 2 components
340 341 inline T angle() const { return (T)std::atan2(this->y, this->x); }
341 342 /// return the angle defined by the 2 components
342 343 inline T angle(const vec2 &v) const {
343 344 return (T)std::atan2(v.y - this->y, v.x - this->x);
344 345 }
346 + /// compute the vector's distance to another specified vector
347 + inline T distance(const vec2 &v, bool absolute = true) const;
348 + /// compute the vector's squared distance to another specified vector
349 + inline T distanceSquared(const vec2 &v) const;
345 350 /// convert the vector to unit length
346 351 inline void normalize();
347 352 /// round both values
  @@ -684,7 +689,7 @@
684 689 /// returns the angle in radians between '*this' and 'v'
685 690 inline T angle(vec3 &v) const;
686 691 /// compute the vector's distance to another specified vector
687 - inline T distance(const vec3 &v) const;
692 + inline T distance(const vec3 &v, bool absolute = true) const;
688 693 /// compute the vector's squared distance to another specified vector
689 694 inline T distanceSquared(const vec3 &v) const;
690 695 /// transform the vector to unit length