Changeset 5420 in orxonox.OLD for trunk/src/lib/math
- Timestamp:
- Oct 22, 2005, 1:57:29 PM (19 years ago)
- Location:
- trunk/src/lib/math
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/math/vector.cc
r5005 r5420 15 15 16 16 Quaternion code borrowed from an Gamasutra article by Nick Bobick and Ken Shoemake 17 18 2005-06-02: Benjamin Grauer: speed up, and new Functionality to Vector (mostly inline now) 17 19 */ 18 20 … … 30 32 * returns the this-vector normalized to length 1.0 31 33 * @todo there is some error in this function, that i could not resolve. it just does not, what it is supposed to do. 32 */34 */ 33 35 Vector Vector::getNormalized() const 34 36 { … … 53 55 /** 54 56 * Outputs the values of the Vector 55 */57 */ 56 58 void Vector::debug() const 57 59 { … … 77 79 * 78 80 * @TODO !!! OPTIMIZE THIS !!! 79 */81 */ 80 82 Quaternion::Quaternion (const Vector& dir, const Vector& up) 81 83 { … … 110 112 * @param pitch: the pitch in radians 111 113 * @param yaw: the yaw in radians 112 */114 */ 113 115 Quaternion::Quaternion (float roll, float pitch, float yaw) 114 116 { … … 136 138 * convert the Quaternion to a 4x4 rotational glMatrix 137 139 * @param m: a buffer to store the Matrix in 138 */140 */ 139 141 void Quaternion::matrix (float m[4][4]) const 140 142 { … … 167 169 * @param to where 168 170 * @param t the time this transformation should take value [0..1] 169 170 171 * @returns the Result of the smooth move 171 */172 */ 172 173 Quaternion Quaternion::quatSlerp(const Quaternion& from, const Quaternion& to, float t) 173 174 { … … 194 195 } 195 196 196 //if( (1.0 - cosom) > DELTA )197 //{198 197 omega = acos(cosom); 199 198 sinom = sin(omega); 200 199 scale0 = sin((1.0 - t) * omega) / sinom; 201 200 scale1 = sin(t * omega) / sinom; 202 //}203 /*204 else205 {206 scale0 = 1.0 - t;207 scale1 = t;208 }209 */210 211 212 /*213 Quaternion res;214 res.v.x = scale0 * from.v.x + scale1 * tol[0];215 res.v.y = scale0 * from.v.y + scale1 * tol[1];216 res.v.z = scale0 * from.v.z + scale1 * tol[2];217 res.w = scale0 * from.w + scale1 * tol[3];218 */219 201 return Quaternion(Vector(scale0 * from.v.x + scale1 * tol[0], 220 221 202 scale0 * from.v.y + scale1 * tol[1], 203 scale0 * from.v.z + scale1 * tol[2]), 222 204 scale0 * from.w + scale1 * tol[3]); 223 205 } … … 227 209 * convert a rotational 4x4 glMatrix into a Quaternion 228 210 * @param m: a 4x4 matrix in glMatrix order 229 */211 */ 230 212 Quaternion::Quaternion (float m[4][4]) 231 213 { -
trunk/src/lib/math/vector.h
r5419 r5420 1 /* 2 orxonox - the future of 3D-vertical-scrollers 3 4 Copyright (C) 2004 orx 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 ### File Specific: 12 main-programmer: Christian Meyer 13 co-programmer: ... 14 */ 15 1 16 /*! 2 17 * @file vector.h
Note: See TracChangeset
for help on using the changeset viewer.