Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3971 in orxonox.OLD


Ignore:
Timestamp:
Apr 26, 2005, 1:23:57 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: return value of quat-slerp was wrong

Location:
orxonox/trunk/src
Files:
4 edited

Legend:

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

    r3970 r3971  
    441441   \returns the Result of the smooth move
    442442*/
    443 Quaternion Quaternion::quatSlerp(const Quaternion& from, const Quaternion& to, float t)
     443Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t)
    444444{
    445445  float tol[4];
    446446  double omega, cosom, sinom, scale0, scale1;
    447   DELTA = 0.2;
     447  //  float DELTA = 0.2;
    448448
    449449  cosom = from.v.x * to.v.x + from.v.y * to.v.y + from.v.z * to.v.z + from.w * to.w;
     
    488488    res.w = scale0 * from.w + scale1 * tol[3];
    489489  */
    490   return Quaternion(scale0 * from.w + scale1 * tol[3],
    491                     Vector(scale0 * from.v.x + scale1 * tol[0],
     490  return Quaternion(Vector(scale0 * from.v.x + scale1 * tol[0],
    492491                           scale0 * from.v.y + scale1 * tol[1],
    493                            scale0 * from.v.z + scale1 * tol[2]));
     492                           scale0 * from.v.z + scale1 * tol[2]),
     493                    scale0 * from.w + scale1 * tol[3]);
    494494}
    495495
  • orxonox/trunk/src/lib/math/vector.h

    r3966 r3971  
    7676 
    7777  inline Quaternion () { w = 1; v = Vector(0,0,0); }
    78   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; }
    7979  Quaternion (float m[4][4]);
    8080  inline Quaternion (float angle, const Vector& axis) { w = cos(angle/2); v = axis * sin(angle/2); }
     
    9999  float norm () const;
    100100  void matrix (float m[4][4]) const;
    101   Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t);
    102101 
    103102  void debug();
    104  private:
    105   float DELTA;      //!< resolution of calculation
     103};
    106104
    107 };
     105Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t);
     106
     107
    108108
    109109//! 3D rotation (OBSOLETE)
  • orxonox/trunk/src/story_entities/world.cc

    r3970 r3971  
    476476            Animation3D* animation = new Animation3D(c);
    477477            animation->setInfinity(ANIM_INF_REPLAY);
    478             animation->addKeyFrame(Vector(0, 0, 0), Quaternion(Vector(0,0,1), Vector(0,0,1)), 1.0, ANIM_LINEAR);
    479             animation->addKeyFrame(Vector(0, 2, 0), Quaternion(Vector(0,0,1), Vector(1,0,0)), 1.0, ANIM_LINEAR);
     478            animation->addKeyFrame(Vector(0, 0, 0), Quaternion(0, Vector(0,1,0)), 1.0, ANIM_LINEAR);
     479            animation->addKeyFrame(Vector(0, 2, 0), Quaternion(360, Vector(0,1,0)), 1.0, ANIM_LINEAR);
     480            animation->addKeyFrame(Vector(0, 0, 0), Quaternion(0, Vector(0,1,0)), 1.0, ANIM_LINEAR);
    480481            //animation->addKeyFrame(Vector(0, 0, 0), Quaternion(), 1.0, ANIM_LINEAR);
    481482
  • orxonox/trunk/src/util/animation/animation3d.cc

    r3970 r3971  
    203203                          (timePassed/this->currentKeyFrame->duration));
    204204
    205   this->object->setRelDir( this->nextKeyFrame->direction.quatSlerp( this->nextKeyFrame->direction,
    206                                                                     this->currentKeyFrame->direction, timePassed /
    207                                                                     this->currentKeyFrame->duration) );
     205  this->object->setRelDir(quatSlerp( this->nextKeyFrame->direction,
     206                                     this->currentKeyFrame->direction,
     207                                     timePassed/this->currentKeyFrame->duration) );
    208208
    209209}
Note: See TracChangeset for help on using the changeset viewer.