Changeset 3971 in orxonox.OLD
- Timestamp:
- Apr 26, 2005, 1:23:57 AM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/math/vector.cc
r3970 r3971 441 441 \returns the Result of the smooth move 442 442 */ 443 Quaternion Quaternion::quatSlerp(const Quaternion& from, const Quaternion& to, float t)443 Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t) 444 444 { 445 445 float tol[4]; 446 446 double omega, cosom, sinom, scale0, scale1; 447 DELTA = 0.2;447 // float DELTA = 0.2; 448 448 449 449 cosom = from.v.x * to.v.x + from.v.y * to.v.y + from.v.z * to.v.z + from.w * to.w; … … 488 488 res.w = scale0 * from.w + scale1 * tol[3]; 489 489 */ 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], 492 491 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]); 494 494 } 495 495 -
orxonox/trunk/src/lib/math/vector.h
r3966 r3971 76 76 77 77 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; } 79 79 Quaternion (float m[4][4]); 80 80 inline Quaternion (float angle, const Vector& axis) { w = cos(angle/2); v = axis * sin(angle/2); } … … 99 99 float norm () const; 100 100 void matrix (float m[4][4]) const; 101 Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t);102 101 103 102 void debug(); 104 private: 105 float DELTA; //!< resolution of calculation 103 }; 106 104 107 }; 105 Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t); 106 107 108 108 109 109 //! 3D rotation (OBSOLETE) -
orxonox/trunk/src/story_entities/world.cc
r3970 r3971 476 476 Animation3D* animation = new Animation3D(c); 477 477 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); 480 481 //animation->addKeyFrame(Vector(0, 0, 0), Quaternion(), 1.0, ANIM_LINEAR); 481 482 -
orxonox/trunk/src/util/animation/animation3d.cc
r3970 r3971 203 203 (timePassed/this->currentKeyFrame->duration)); 204 204 205 this->object->setRelDir( this->nextKeyFrame->direction.quatSlerp( this->nextKeyFrame->direction,206 this->currentKeyFrame->direction, timePassed /207 205 this->object->setRelDir(quatSlerp( this->nextKeyFrame->direction, 206 this->currentKeyFrame->direction, 207 timePassed/this->currentKeyFrame->duration) ); 208 208 209 209 }
Note: See TracChangeset
for help on using the changeset viewer.