Changeset 4477 in orxonox.OLD for orxonox/trunk/src/lib/math/vector.cc
- Timestamp:
- Jun 2, 2005, 4:35:22 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/math/vector.cc
r4476 r4477 24 24 using namespace std; 25 25 26 ///////////// 27 /* VECTORS */ 28 ///////////// 26 29 /** 27 30 \brief returns the this-vector normalized to length 1.0 … … 43 46 44 47 /** 48 \brief Vector is looking in the positive direction on all axes after this 49 */ 50 Vector Vector::abs() 51 { 52 Vector v(fabs(x), fabs(y), fabs(z)); 53 return v; 54 } 55 56 57 58 /** 45 59 \brief Outputs the values of the Vector 46 60 */ … … 53 67 } 54 68 55 /** 56 \brief creates a multiplicational identity Quaternion 57 */ 58 //Quaternion::Quaternion () 59 60 61 /** 62 \brief turns a rotation along an axis into a Quaternion 63 \param angle: the amount of radians to rotate 64 \param axis: the axis to rotate around 65 */ 66 //Quaternion::Quaternion (float angle, const Vector& axis) 67 68 69 ///////////////// 70 /* QUATERNIONS */ 71 ///////////////// 69 72 /** 70 73 \brief calculates a lookAt rotation … … 109 112 110 113 /** 111 \brief calculates a rotation from euler angles 112 \param roll: the roll in radians 113 \param pitch: the pitch in radians 114 \param yaw: the yaw in radians 115 116 I DO HONESTLY NOT EXACTLY KNOW WHICH ANGLE REPRESENTS WHICH ROTATION. And I do not know 117 in what order they are applied, I just copy-pasted the code. 114 \brief calculates a rotation from euler angles 115 \param roll: the roll in radians 116 \param pitch: the pitch in radians 117 \param yaw: the yaw in radians 118 118 */ 119 119 Quaternion::Quaternion (float roll, float pitch, float yaw) 120 120 { 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 } 140 141 /** 142 143 144 121 float cr, cp, cy, sr, sp, sy, cpcy, spsy; 122 123 // calculate trig identities 124 cr = cos(roll/2); 125 cp = cos(pitch/2); 126 cy = cos(yaw/2); 127 128 sr = sin(roll/2); 129 sp = sin(pitch/2); 130 sy = sin(yaw/2); 131 132 cpcy = cp * cy; 133 spsy = sp * sy; 134 135 w = cr * cpcy + sr * spsy; 136 v.x = sr * cpcy - cr * spsy; 137 v.y = cr * sp * cy + sr * cp * sy; 138 v.z = cr * cp * sy - sr * sp * cy; 139 } 140 141 /** 142 \brief rotates one Quaternion by another 143 \param q: another Quaternion to rotate this by 144 \return a quaternion that represents the first one rotated by the second one (WARUNING: this operation is not commutative! e.g. (A*B) != (B*A)) 145 145 */ 146 146 Quaternion Quaternion::operator*(const Quaternion& q) const … … 165 165 return r; 166 166 } 167 168 /**169 \brief add two Quaternions170 \param q: another Quaternion171 \return the sum of both Quaternions172 */173 /*174 Quaternion Quaternion::operator+(const Quaternion& q) const175 {176 Quaternion r(*this);177 r.w = r.w + q.w;178 r.v = r.v + q.v;179 return r;180 }181 */182 183 /**184 \brief subtract two Quaternions185 \param q: another Quaternion186 \return the difference of both Quaternions187 */188 /*189 Quaternion Quaternion::operator- (const Quaternion& q) const190 {191 Quaternion r(*this);192 r.w = r.w - q.w;193 r.v = r.v - q.v;194 return r;195 }196 */197 167 198 168 /**
Note: See TracChangeset
for help on using the changeset viewer.