Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9090 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 4, 2006, 2:26:42 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: valgrind fixes

Location:
branches/presentation/src/lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/lib/graphics/importer/md3/md3_model.cc

    r8724 r9090  
    525525    float  interpolatedMatrix[4][4];
    526526
    527     Quaternion currQuat(currFrameTag->matrix); currQuat.matrix(currRot);
    528     Quaternion nextQuat(nextFrameTag->matrix); nextQuat.matrix(nextRot);
     527    /// TODO CHANGED BY BENSCH TO MATCH NEW QUATERNION FUNCTIONALITY
     528    Quaternion currQuat; currQuat.from3x3(currFrameTag->matrix); currQuat.matrix(currRot);
     529    Quaternion nextQuat; nextQuat.from3x3(nextFrameTag->matrix); nextQuat.matrix(nextRot);
    529530
    530531    Quaternion interpolatedQuat = Quaternion::quatSlerp(currQuat, nextQuat, frac); interpolatedQuat.matrix(interpolatedMatrix);
  • branches/presentation/src/lib/math/quaternion.cc

    r8731 r9090  
    7272  m[3][3] = 1;
    7373
    74   *this = Quaternion (m);
     74  this->from4x4(m);
    7575}
    7676
     
    279279 * @param m: a 4x4 matrix in glMatrix order
    280280 */
    281 Quaternion::Quaternion (float m[4][4])
     281void Quaternion::from4x4(float m[4][4])
    282282{
    283283
     
    327327
    328328/**
    329  * Creates a quaternion from a 3x3 rotation matrix.
     329 * applies a quaternion from a 3x3 rotation matrix.
    330330 * @param mat The 3x3 source rotation matrix.
    331331 * @return The equivalent 4 float quaternion.
    332332 */
    333 Quaternion::Quaternion(float mat[3][3])
     333void Quaternion::from3x3(float mat[3][3])
    334334{
    335335  int   NXT[] = {1, 2, 0};
  • branches/presentation/src/lib/math/quaternion.h

    r8894 r9090  
    3939  /** creates a Default quaternion (multiplicational identity Quaternion)*/
    4040  inline Quaternion () { w = 1; v = Vector(0,0,0); }
     41  /** Copy constructor @param q the Quaternion to copy. */
     42  inline Quaternion (const Quaternion& q) { w = q.w; v = q.v; };
    4143  /** creates a Quaternion looking into the direction v @param v: the direction @param f: the value */
    4244  inline Quaternion (const Vector& v, float f) { this->w = f; this->v = v; }
    43   Quaternion (float m[4][4]);
    44   Quaternion (float m[3][3]);
    4545  /** turns a rotation along an axis into a Quaternion @param angle: the amount of radians to rotate @param axis: the axis to rotate around */
    4646  inline Quaternion (float angle, const Vector& axis) { w = cos(angle/2.0); v = axis * sin(angle/2.0); }
    4747  Quaternion (const Vector& dir, const Vector& up);
    4848  Quaternion (float roll, float pitch, float yaw);
     49
     50  void from3x3(float m[3][3]);
     51  void from4x4(float m[4][4]);
     52
    4953
    5054  /** @param q: the Quaternion to compare with this one. @returns true if the Quaternions are the same, false otherwise */
  • branches/presentation/src/lib/math/vector.cc

    r6617 r9090  
    4040Vector Vector::getNormalized() const
    4141{
    42   float l = this->len();
    43   if(unlikely(l == 1.0 || l == 0.0))
     42  float length = this->len();
     43  if (unlikely(length == 0.0))
    4444    return *this;
    4545  else
    46     return (*this / l);
     46    return (*this / length);
    4747}
    4848
  • branches/presentation/src/lib/math/vector.h

    r8894 r9090  
    4242  Vector (float x, float y, float z) : x(x), y(y), z(z) {}  //!< assignment constructor
    4343  Vector () : x(0), y(0), z(0) {}
    44   ~Vector () {}
    4544
    4645  /** @param v: the Vecor to compare with this one @returns true, if the Vecors are the same, false otherwise */
Note: See TracChangeset for help on using the changeset viewer.