Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 13, 2005, 11:16:33 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/physics: merged the Trunk into the physics Branche again:
merged with command:
svn merge ../trunk physics -r 3953:HEAD
no important conflicts

Location:
orxonox/branches/physics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics

    • Property svn:externals
      •  

        old new  
        1 data http://svn.orxonox.ethz.ch/data
         1
  • orxonox/branches/physics/src/lib/math/vector.h

    r3860 r4178  
    3131
    3232  inline Vector operator+ (const Vector& v) const { return Vector(x + v.x, y + v.y, z + v.z); }
     33  inline const Vector& operator+= (const Vector& v) {this->x += v.x; this->y += v.y; this->z += v.z; return *this;}
    3334  inline Vector operator- (const Vector& v) const { return Vector(x - v.x, y - v.y, z - v.z); }
     35  inline const Vector& operator-= (const Vector& v) {this->x -= v.x; this->y -= v.y; this->z -= v.z; return *this;}
    3436  inline float operator* (const Vector& v) const { return x * v.x + y * v.y + z * v.z; }
     37  inline const Vector& operator*= (const Vector& v) {this->x *= v.x; this->y *= v.y; this->z *= v.z; return *this;}
    3538  inline Vector operator* (float f) const { return Vector(x * f, y * f, z * f); }
     39  inline const Vector& operator*= (float f) {this->x *= f; this->y *= f; this->z *= f; return *this;}
    3640  Vector operator/ (float f) const;
     41  inline const Vector& operator/= (float f) {this->x /= f; this->y /= f; this->z /= f; return *this;}
     42  inline const Vector& operator= (const Vector& v) {this->x = v.x; this->y = v.y; this->z = v.z; return *this;}
    3743  float dot (const Vector& v) const;
    38   inline Vector cross (const Vector& v) const {  return Vector(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x ); }
     44  inline Vector cross (const Vector& v) const { return Vector(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x ); }
    3945  void scale(const Vector& v);
    4046  inline float len() const { return sqrt (x*x+y*y+z*z); }
     
    5056                      z = z / l;
    5157                    }
    52   Vector* getNormalized();
     58  Vector getNormalized();
    5359  Vector abs();
    5460
    55   void debug();
     61  void debug() const;
    5662};
    5763
     
    7076 
    7177  inline Quaternion () { w = 1; v = Vector(0,0,0); }
    72   inline Quaternion (const Vector& b, float a) { w = a; v = b; }
     78  inline Quaternion (const Vector& v, float f) { this->w = f; this->v = v; }
    7379  Quaternion (float m[4][4]);
    7480  inline Quaternion (float angle, const Vector& axis) { w = cos(angle/2); v = axis * sin(angle/2); }
     
    7682  Quaternion (float roll, float pitch, float yaw);
    7783  Quaternion operator/ (const float& f) const;
     84  inline const Quaternion operator/= (const float& f) {*this = *this / f; return *this;}
    7885  Quaternion operator* (const float& f) const;
     86  inline const Quaternion operator*= (const float& f) {*this = *this * f; return *this;}
    7987  Quaternion operator* (const Quaternion& q) const;
     88  inline const Quaternion operator*= (const Quaternion& q) {*this = *this * q; return *this;}
    8089  inline Quaternion operator+ (const Quaternion& q) const { return Quaternion(q.v + v, q.w + w); }
     90  inline const Quaternion& operator+= (const Quaternion& q) {this->v += q.v; this->w += q.w; return *this;}
    8191  inline Quaternion operator- (const Quaternion& q) const { return Quaternion(q.v - v, q.w - w); }
     92  inline const Quaternion& operator-= (const Quaternion& q) {this->v -= q.v; this->w -= q.w; return *this;}
     93  inline Quaternion operator= (const Quaternion& q) {this->v = q.v; this->w = q.w; return *this;}
    8294  Quaternion conjugate () const {  Quaternion r(*this);
    8395  r.v = Vector() - r.v;
     
    8799  float norm () const;
    88100  void matrix (float m[4][4]) const;
    89   void quatSlerp(const Quaternion* from, const Quaternion* to, const float t, Quaternion* res);
    90101 
    91102  void debug();
    92  private:
    93   float DELTA;      //!< resolution of calculation
     103};
    94104
    95 };
     105Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t);
     106
     107
    96108
    97109//! 3D rotation (OBSOLETE)
Note: See TracChangeset for help on using the changeset viewer.