- Timestamp:
- Aug 13, 2005, 3:10:52 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/p_node.cc
r4996 r4997 339 339 { 340 340 if (this->parent) 341 this->relDirection = absDir * parent->getAbsDir().inverse();341 this->relDirection = absDir / parent->getAbsDir(); 342 342 else 343 343 this->relDirection = absDir; … … 489 489 this->setRelCoor(tmpV - parentNode->getAbsCoor()); 490 490 491 this->setRelDir(tmpQ * parentNode->getAbsDir().inverse());491 this->setRelDir(tmpQ / parentNode->getAbsDir()); 492 492 } 493 493 … … 543 543 if (unlikely(this->toDirection != NULL)) 544 544 { 545 Quaternion rotQuat = (*this->toDirection * this->getRelDir().inverse()) *dt*bias; 545 Quaternion rotQuat = (*this->toDirection / this->getRelDir()) *dt*bias; 546 rotQuat.debug(); 546 547 // if (likely(rotQuat.len() >= .001)) 547 548 { -
orxonox/trunk/src/lib/math/vector.cc
r4987 r4997 158 158 159 159 return r; 160 }161 162 /**163 * rotate a Vector by a Quaternion164 * @param v: the Vector165 * @return a new Vector representing v rotated by the Quaternion166 */167 168 Vector Quaternion::apply (const Vector& v) const169 {170 Quaternion q;171 q.v = v;172 q.w = 0;173 q = *this * q * conjugate();174 return q.v;175 }176 177 178 /**179 * multiply a Quaternion with a real value180 * @param f: a real value181 * @return a new Quaternion containing the product182 */183 Quaternion Quaternion::operator*(const float& f) const184 {185 Quaternion r(*this);186 r.w = r.w*f;187 r.v = r.v*f;188 return r;189 }190 191 /**192 * divide a Quaternion by a real value193 * @param f: a real value194 * @return a new Quaternion containing the quotient195 */196 Quaternion Quaternion::operator/(const float& f) const197 {198 if( f == 0) return Quaternion();199 Quaternion r(*this);200 r.w = r.w/f;201 r.v = r.v/f;202 return r;203 }204 205 /**206 * calculate the conjugate value of the Quaternion207 * @return the conjugate Quaternion208 */209 /*210 Quaternion Quaternion::conjugate() const211 {212 Quaternion r(*this);213 r.v = Vector() - r.v;214 return r;215 }216 */217 218 /**219 * calculate the norm of the Quaternion220 * @return the norm of The Quaternion221 */222 float Quaternion::norm() const223 {224 return w*w + v.x*v.x + v.y*v.y + v.z*v.z;225 }226 227 /**228 * calculate the inverse value of the Quaternion229 * @return the inverse Quaternion230 231 Note that this is equal to conjugate() if the Quaternion's norm is 1232 */233 Quaternion Quaternion::inverse() const234 {235 float n = norm();236 if (n != 0)237 {238 return conjugate() / norm();239 }240 else return Quaternion();241 160 } 242 161 -
orxonox/trunk/src/lib/math/vector.h
r4994 r4997 54 54 inline const Vector& operator*= (float f) { this->x *= f; this->y *= f; this->z *= f; return *this; }; 55 55 /** @param f a factor to divide the vector with @returns the vector divided by f (this / f) */ 56 inline Vector operator/ (float f) const { return (unlikely(f == 0.0))?Vector(0,0,0):Vector(this->x / f, this->y / f, this->z / f); };56 inline Vector operator/ (float f) const { return (unlikely(f == 0.0))?Vector(0,0,0):Vector(this->x / f, this->y / f, this->z / f); }; 57 57 /** @param f a factor to divide the vector with @returns the vector divided by f (this /= f) */ 58 58 inline const Vector& operator/= (float f) {if (unlikely(f == 0.0)) {this->x=0;this->y=0;this->z=0;} else {this->x /= f; this->y /= f; this->z /= f;} return *this; }; … … 124 124 Quaternion (const Vector& dir, const Vector& up); 125 125 Quaternion (float roll, float pitch, float yaw); 126 Quaternion operator/ (const float& f) const; 126 /** @param f: a real value @return a Quaternion containing the quotient */ 127 inline Quaternion operator/ (const float& f) const { return (unlikely(f==0.0)) ? Quaternion() : Quaternion(this->v/f, this->w/f); }; 127 128 /** @param f: the value to divide by @returns the quaternion devided by f (this /= f) */ 128 129 inline const Quaternion& operator/= (const float& f) {*this = *this / f; return *this;} 129 Quaternion operator* (const float& f) const; 130 /** @param f: a real value @return a Quaternion containing the product */ 131 inline Quaternion operator* (const float& f) const { return Quaternion(this->v*f, this->w*f); }; 130 132 /** @param f: the value to multiply by @returns the quaternion multiplied by f (this *= f) */ 131 133 inline const Quaternion& operator*= (const float& f) {*this = *this * f; return *this;} 132 134 Quaternion operator* (const Quaternion& q) const; 133 135 /** @param q: the Quaternion to multiply by @returns the quaternion multiplied by q (this *= q) */ 134 inline const Quaternion operator*= (const Quaternion& q) {*this = *this * q; return *this; }; 136 inline const Quaternion& operator*= (const Quaternion& q) {*this = *this * q; return *this; }; 137 /** @param q the Quaternion by which to devide @returns the division from this by q (this / q) */ 138 inline Quaternion operator/ (const Quaternion& q) const { return *this * q.inverse(); }; 139 /** @param q the Quaternion by which to devide @returns the division from this by q (this /= q) */ 140 inline const Quaternion& operator/= (const Quaternion& q) { *this = *this * q.inverse(); return *this; }; 135 141 /** @param q the Quaternion to add to this @returns the quaternion added with q (this + q) */ 136 142 inline Quaternion operator+ (const Quaternion& q) const { return Quaternion(q.v + v, q.w + w); }; … … 144 150 inline Quaternion operator= (const Quaternion& q) {this->v = q.v; this->w = q.w; return *this;} 145 151 /** conjugates this Quaternion @returns the conjugate */ 146 inline Quaternion conjugate () const { Quaternion r(*this); r.v = Vector() - r.v; return r;} 147 Quaternion inverse () const; 148 Vector apply (const Vector& f) const; 149 float norm () const; 152 inline Quaternion conjugate () const { Quaternion r(*this); r.v = Vector() - r.v; return r; }; 153 /** @returns the norm of The Quaternion */ 154 inline float norm () const { return w*w + v.x*v.x + v.y*v.y + v.z*v.z; }; 155 /** @returns the inverted Quaterntion of this */ 156 inline Quaternion inverse () const { return conjugate() / norm(); }; 157 /** @param v: the Vector @return a new Vector representing v rotated by the Quaternion */ 158 inline Vector apply (const Vector& v) const { return (*this * Quaternion(v, 0) * conjugate()).v; }; 150 159 void matrix (float m[4][4]) const; 151 160 … … 270 279 271 280 #endif /* _VECTOR_H */ 281 -
orxonox/trunk/src/world_entities/camera.cc
r4996 r4997 52 52 this->setViewMode(VIEW_NORMAL); 53 53 54 this->setParentMode(PNODE_MOVEMENT);54 //this->setParentMode(PNODE_MOVEMENT); 55 55 } 56 56 … … 257 257 { 258 258 this->setClassID(CL_CAMERA_TARGET, "CameraTarget"); 259 this->setParentMode(PNODE_MOVEMENT);259 // this->setParentMode(PNODE_MOVEMENT); 260 260 } 261 261 -
orxonox/trunk/src/world_entities/player.cc
r4994 r4997 121 121 void Player::init() 122 122 { 123 this->setAbsDir(0,1,0); 124 123 125 this->setClassID(CL_PLAYER, "Player"); 124 126
Note: See TracChangeset
for help on using the changeset viewer.