Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4966 in orxonox.OLD for orxonox/trunk/src/lib/math


Ignore:
Timestamp:
Jul 28, 2005, 5:53:15 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Turret is fixed onto the ship as it should.
TestGun fires staight again
PNode now know getParent(), as this is a quite usefull function
Vector still has an error in the getNormalized function, and i am not able to determine the cause of this

Location:
orxonox/trunk/src/lib/math
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/math/vector.cc

    r4836 r4966  
    2929/**
    3030 *  returns the this-vector normalized to length 1.0
     31 * @todo there is some error in this function, that i could not resolve. it just does not, what it is supposed to do.
    3132*/
    3233Vector Vector::getNormalized() const
    3334{
    34   float l = len();
    35   if(unlikely(l != 1.0))
    36     {
    37       return *this;
    38     }
    39   else if(unlikely(l == 0.0))
    40     {
    41       return *this;
    42     }
    43 
    44   return *this / l;
     35  float l = this->len();
     36  if(unlikely(l == 1.0 || l == 0.0))
     37    return *this;
     38  else
     39    return (*this / l);
    4540}
    4641
  • orxonox/trunk/src/lib/math/vector.h

    r4897 r4966  
    5454  inline const Vector& operator*= (float f) { this->x *= f; this->y *= f; this->z *= f; return *this; };
    5555  /** @param f a factor to divide the vector with @returns the vector divided by f (this / f) */
    56   inline Vector operator/ (float f) const {if (unlikely(f == 0.0)) return Vector(0,0,0); else return Vector(this->x / f, this->y / f, this->z / f); };
     56  inline Vector operator/ (float f) const {return (unlikely(f == 0.0))?Vector(0,0,0):Vector(this->x / f, this->y / f, this->z / f); };
    5757  /** @param f a factor to divide the vector with @returns the vector divided by f (this /= f) */
    5858  inline const Vector& operator/= (float f) {if (unlikely(f == 0.0)) {this->x=0;this->y=0;this->z=0;} else {this->x /= f; this->y /= f; this->z /= f;} return *this; };
Note: See TracChangeset for help on using the changeset viewer.