- Timestamp:
- Mar 1, 2006, 10:30:06 AM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/math/quaternion.cc
r7003 r7191 131 131 m[2][3] = 0; m[3][3] = 1; 132 132 } 133 134 135 /** 136 * Slerps this QUaternion performs a smooth move. 137 * @param toQuat to this Quaternion 138 * @param t \% inth the the direction[0..1] 139 */ 140 void Quaternion::slerpTo(const Quaternion& toQuat, float t) 141 { 142 float tol[4]; 143 double omega, cosom, sinom, scale0, scale1; 144 // float DELTA = 0.2; 145 146 cosom = this->v.x * toQuat.v.x + this->v.y * toQuat.v.y + this->v.z * toQuat.v.z + this->w * toQuat.w; 147 148 if( cosom < 0.0 ) 149 { 150 cosom = -cosom; 151 tol[0] = -toQuat.v.x; 152 tol[1] = -toQuat.v.y; 153 tol[2] = -toQuat.v.z; 154 tol[3] = -toQuat.w; 155 } 156 else 157 { 158 tol[0] = toQuat.v.x; 159 tol[1] = toQuat.v.y; 160 tol[2] = toQuat.v.z; 161 tol[3] = toQuat.w; 162 } 163 164 omega = acos(cosom); 165 sinom = sin(omega); 166 scale0 = sin((1.0 - t) * omega) / sinom; 167 scale1 = sin(t * omega) / sinom; 168 this->v = Vector(scale0 * this->v.x + scale1 * tol[0], 169 scale0 * this->v.y + scale1 * tol[1], 170 scale0 * this->v.z + scale1 * tol[2]); 171 this->w = scale0 * this->w + scale1 * tol[3]; 172 } 173 133 174 134 175 /** -
trunk/src/lib/math/quaternion.h
r7003 r7191 101 101 inline float getSpacialAxisAngle() const { return 360.0 / M_PI * acos( this->w ); }; 102 102 103 104 inline void slerpTo(const Quaternion& toQuat, float t); 103 105 static Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t); 104 106 -
trunk/src/lib/math/vector.h
r6617 r7191 97 97 Vector getNormalized() const; 98 98 Vector abs(); 99 /** @param toVec nears this Vector to... @param t how much to advance (0.0: not at all; 1.0: fully) */ 100 inline void slerpTo(const Vector& toVec, float t) { *this + (toVec - *this) * t; }; 99 101 100 102 void debug() const; -
trunk/src/subprojects/collision_detection/Makefile.am
r7156 r7191 5 5 include $(MAINSRCDIR)/lib/BuildLibs.am 6 6 7 8 importer_LDFLAGS = \9 $(MWINDOWS)10 7 11 8 bin_PROGRAMS = collision … … 24 21 $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS) 25 22 26 importer_SOURCES= \27 ../framework.cc \28 importer.cc \29 $(MAINSRCDIR)/world_entities/space_ships/space_ship.cc \30 $(MAINSRCDIR)/world_entities/weapons/test_gun.cc31 32 33 23 34 24 collision_CPPFLAGS = \
Note: See TracChangeset
for help on using the changeset viewer.