Changeset 4998 in orxonox.OLD for orxonox/trunk/src/lib/math
- Timestamp:
- Aug 13, 2005, 7:19:51 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib/math
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/math/vector.cc
r4997 r4998 197 197 * @returns the Result of the smooth move 198 198 */ 199 Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t)199 Quaternion Quaternion::quatSlerp(const Quaternion& from, const Quaternion& to, float t) 200 200 { 201 201 float tol[4]; … … 306 306 void Quaternion::debug() 307 307 { 308 PRINT(0)("Quaternion Debug Information\n");309 308 PRINT(0)("real a=%f; imag: x=%f y=%f z=%f\n", w, v.x, v.y, v.z); 310 309 } -
orxonox/trunk/src/lib/math/vector.h
r4997 r4998 150 150 inline Quaternion operator= (const Quaternion& q) {this->v = q.v; this->w = q.w; return *this;} 151 151 /** conjugates this Quaternion @returns the conjugate */ 152 inline Quaternion conjugate () const { Quaternion r(*this); r.v = Vector() - r.v; return r; };152 inline Quaternion conjugate () const { return Quaternion(Vector(-v.x, -v.y, -v.z), this->w); }; 153 153 /** @returns the norm of The Quaternion */ 154 154 inline float norm () const { return w*w + v.x*v.x + v.y*v.y + v.z*v.z; }; … … 158 158 inline Vector apply (const Vector& v) const { return (*this * Quaternion(v, 0) * conjugate()).v; }; 159 159 void matrix (float m[4][4]) const; 160 /** @returns the normalized Quaternion (|this|) */ 161 inline Quaternion getNormalized() const { float n = this->norm(); return Quaternion(this->v/n, this->w/n); }; 162 /** normalizes the current Quaternion */ 163 inline void normalize() { float n = this->norm(); this->v /= n; this->w/=n; }; 164 165 /** @returns the rotational axis of this Quaternion */ 166 inline Vector getSpacialAxis() const { return this->v / sin(acos(w));/*sqrt(v.x*v.x + v.y*v.y + v.z+v.z);*/ }; 167 /** @returns the rotational angle of this Quaternion around getSpacialAxis() !! IN DEGREE !! */ 168 inline float getSpacialAxisAngle() const { return 360 / M_PI * acos(this->w); }; 169 170 static Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t); 160 171 161 172 void debug(); 173 162 174 163 175 public: … … 167 179 }; 168 180 169 Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t);170 181 171 182
Note: See TracChangeset
for help on using the changeset viewer.