Changeset 4836 in orxonox.OLD for orxonox/trunk/src/lib/math
- Timestamp:
- Jul 12, 2005, 12:33:16 AM (19 years ago)
- Location:
- orxonox/trunk/src/lib/math
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/math/curve.cc
r4746 r4836 34 34 35 35 /** 36 \briefdefault constructor for a Curve36 * default constructor for a Curve 37 37 */ 38 38 Curve::Curve() … … 48 48 49 49 /** 50 \briefadds a new Node to the bezier Curve51 \param newNode a Vector to the position of the new node50 * adds a new Node to the bezier Curve 51 * @param newNode a Vector to the position of the new node 52 52 */ 53 53 void Curve::addNode(const Vector& newNode) … … 65 65 66 66 /** 67 \briefadds a new Node to the bezier Curve68 \param newNode a Vector to the position of the new node69 \param insertPosition after the n-th node the new node will be inserted67 * adds a new Node to the bezier Curve 68 * @param newNode a Vector to the position of the new node 69 * @param insertPosition after the n-th node the new node will be inserted 70 70 */ 71 71 void Curve::addNode(const Vector& newNode, unsigned int insertPosition) … … 111 111 112 112 /** 113 \briefFinds a Node by its Number, and returns its Position114 \param nodeToFind the n'th node in the List of nodes115 \returns A Vector to the Position of the Node.113 * Finds a Node by its Number, and returns its Position 114 * @param nodeToFind the n'th node in the List of nodes 115 * @returns A Vector to the Position of the Node. 116 116 */ 117 117 Vector Curve::getNode(unsigned int nodeToFind) … … 126 126 127 127 /** 128 \briefOutputs information about the state of this Curve128 * Outputs information about the state of this Curve 129 129 */ 130 130 void Curve::debug() … … 148 148 149 149 /** 150 \briefCreates a new BezierCurve150 * Creates a new BezierCurve 151 151 */ 152 152 BezierCurve::BezierCurve () … … 157 157 158 158 /** 159 \briefCreates a new BezierCurve-Derivation-Curve159 * Creates a new BezierCurve-Derivation-Curve 160 160 */ 161 161 BezierCurve::BezierCurve (int derivation) … … 166 166 167 167 /** 168 \briefDeletes a BezierCurve.168 * Deletes a BezierCurve. 169 169 170 170 It does this by freeing all the space taken over from the nodes … … 185 185 186 186 /** 187 \briefRebuilds a Curve187 * Rebuilds a Curve 188 188 */ 189 189 void BezierCurve::rebuild() … … 225 225 226 226 /** 227 \briefcalculates the Position on the curve228 \param t The position on the Curve (0<=t<=1)229 \return the Position on the Path227 * calculates the Position on the curve 228 * @param t The position on the Curve (0<=t<=1) 229 * @return the Position on the Path 230 230 */ 231 231 Vector BezierCurve::calcPos(float t) … … 257 257 258 258 /** 259 \briefCalulates the direction of the Curve at time t.260 \param t The time at which to evaluate the curve.261 \returns The valuated Vector.259 * Calulates the direction of the Curve at time t. 260 * @param t The time at which to evaluate the curve. 261 * @returns The valuated Vector. 262 262 */ 263 263 Vector BezierCurve::calcDir (float t) … … 267 267 268 268 /** 269 \briefCalulates the acceleration (second derivate) of the Curve at time t.270 \param t The time at which to evaluate the curve.271 \returns The valuated Vector.269 * Calulates the acceleration (second derivate) of the Curve at time t. 270 * @param t The time at which to evaluate the curve. 271 * @returns The valuated Vector. 272 272 */ 273 273 Vector BezierCurve::calcAcc (float t) … … 277 277 278 278 /** 279 \briefCalculates the Quaternion needed for our rotations280 \param t The time at which to evaluate the cuve.281 \returns The evaluated Quaternion.279 * Calculates the Quaternion needed for our rotations 280 * @param t The time at which to evaluate the cuve. 281 * @returns The evaluated Quaternion. 282 282 */ 283 283 Quaternion BezierCurve::calcQuat (float t) -
orxonox/trunk/src/lib/math/curve.h
r4746 r4836 2 2 /*! 3 3 \file curve.h 4 \briefA basic 3D curve framework4 * A basic 3D curve framework 5 5 6 6 Contains classes to handle curves … … 36 36 void addNode(const Vector& newNode, unsigned int insertPosition); 37 37 Vector getNode(unsigned int nodeToFind); 38 /** \returns the count of nodes in this curve */38 /** @returns the count of nodes in this curve */ 39 39 inline int getNodeCount() const { return this->nodeCount; }; 40 /** \returns the directional Curve */40 /** @returns the directional Curve */ 41 41 Curve* getDirCurve() const { return this->dirCurve; }; 42 42 43 /** \param t the value on the curve [0-1] \returns Vector to the position */43 /** @param t the value on the curve [0-1] @returns Vector to the position */ 44 44 virtual Vector calcPos(float t) = 0; 45 /** \param t the value on the curve [0-1] \returns the direction */45 /** @param t the value on the curve [0-1] @returns the direction */ 46 46 virtual Vector calcDir(float t) = 0; 47 /** \param t the value on the curve [0-1] \returns the acceleration */47 /** @param t the value on the curve [0-1] @returns the acceleration */ 48 48 virtual Vector calcAcc(float t) = 0; 49 /** \param t the value on the curve [0-1] \returns quaternion of the rotation */49 /** @param t the value on the curve [0-1] @returns quaternion of the rotation */ 50 50 virtual Quaternion calcQuat(float t) = 0; 51 51 -
orxonox/trunk/src/lib/math/vector.cc
r4746 r4836 28 28 ///////////// 29 29 /** 30 \briefreturns the this-vector normalized to length 1.030 * returns the this-vector normalized to length 1.0 31 31 */ 32 32 Vector Vector::getNormalized() const … … 46 46 47 47 /** 48 \briefVector is looking in the positive direction on all axes after this48 * Vector is looking in the positive direction on all axes after this 49 49 */ 50 50 Vector Vector::abs() … … 57 57 58 58 /** 59 \briefOutputs the values of the Vector59 * Outputs the values of the Vector 60 60 */ 61 61 void Vector::debug() const … … 71 71 ///////////////// 72 72 /** 73 \briefcalculates a lookAt rotation74 \param dir: the direction you want to look75 \param up: specify what direction up should be73 * calculates a lookAt rotation 74 * @param dir: the direction you want to look 75 * @param up: specify what direction up should be 76 76 77 77 Mathematically this determines the rotation a (0,0,1)-Vector has to undergo to point … … 112 112 113 113 /** 114 \briefcalculates a rotation from euler angles115 \param roll: the roll in radians116 \param pitch: the pitch in radians117 \param yaw: the yaw in radians114 * 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) … … 140 140 141 141 /** 142 \briefrotates one Quaternion by another143 \param q: another Quaternion to rotate this by144 \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))142 * 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 … … 167 167 168 168 /** 169 \briefrotate a Vector by a Quaternion170 \param v: the Vector171 \return a new Vector representing v rotated by the Quaternion169 * rotate a Vector by a Quaternion 170 * @param v: the Vector 171 * @return a new Vector representing v rotated by the Quaternion 172 172 */ 173 173 … … 183 183 184 184 /** 185 \briefmultiply a Quaternion with a real value186 \param f: a real value187 \return a new Quaternion containing the product185 * multiply a Quaternion with a real value 186 * @param f: a real value 187 * @return a new Quaternion containing the product 188 188 */ 189 189 Quaternion Quaternion::operator*(const float& f) const … … 196 196 197 197 /** 198 \briefdivide a Quaternion by a real value199 \param f: a real value200 \return a new Quaternion containing the quotient198 * divide a Quaternion by a real value 199 * @param f: a real value 200 * @return a new Quaternion containing the quotient 201 201 */ 202 202 Quaternion Quaternion::operator/(const float& f) const … … 210 210 211 211 /** 212 \briefcalculate the conjugate value of the Quaternion213 \return the conjugate Quaternion212 * calculate the conjugate value of the Quaternion 213 * @return the conjugate Quaternion 214 214 */ 215 215 /* … … 223 223 224 224 /** 225 \briefcalculate the norm of the Quaternion226 \return the norm of The Quaternion225 * calculate the norm of the Quaternion 226 * @return the norm of The Quaternion 227 227 */ 228 228 float Quaternion::norm() const … … 232 232 233 233 /** 234 \briefcalculate the inverse value of the Quaternion235 \return the inverse Quaternion234 * calculate the inverse value of the Quaternion 235 * @return the inverse Quaternion 236 236 237 237 Note that this is equal to conjugate() if the Quaternion's norm is 1 … … 248 248 249 249 /** 250 \briefconvert the Quaternion to a 4x4 rotational glMatrix251 \param m: a buffer to store the Matrix in250 * convert the Quaternion to a 4x4 rotational glMatrix 251 * @param m: a buffer to store the Matrix in 252 252 */ 253 253 void Quaternion::matrix (float m[4][4]) const … … 277 277 278 278 /** 279 \briefperforms a smooth move.280 \param from where281 \param to where282 \param t the time this transformation should take value [0..1]283 284 \returns the Result of the smooth move279 * performs a smooth move. 280 * @param from where 281 * @param to where 282 * @param t the time this transformation should take value [0..1] 283 284 * @returns the Result of the smooth move 285 285 */ 286 286 Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t) … … 339 339 340 340 /** 341 \briefconvert a rotational 4x4 glMatrix into a Quaternion342 \param m: a 4x4 matrix in glMatrix order341 * convert a rotational 4x4 glMatrix into a Quaternion 342 * @param m: a 4x4 matrix in glMatrix order 343 343 */ 344 344 Quaternion::Quaternion (float m[4][4]) … … 389 389 390 390 /** 391 \briefoutputs some nice formated debug information about this quaternion391 * outputs some nice formated debug information about this quaternion 392 392 */ 393 393 void Quaternion::debug() … … 398 398 399 399 /** 400 \briefcreate a rotation from a vector401 \param v: a vector400 * create a rotation from a vector 401 * @param v: a vector 402 402 */ 403 403 Rotation::Rotation (const Vector& v) … … 421 421 422 422 /** 423 \briefcreates a rotation from an axis and an angle (radians!)424 \param axis: the rotational axis425 \param angle: the angle in radians423 * creates a rotation from an axis and an angle (radians!) 424 * @param axis: the rotational axis 425 * @param angle: the angle in radians 426 426 */ 427 427 Rotation::Rotation (const Vector& axis, float angle) … … 442 442 443 443 /** 444 \briefcreates a rotation from euler angles (pitch/yaw/roll)445 \param pitch: rotation around z (in radians)446 \param yaw: rotation around y (in radians)447 \param roll: rotation around x (in radians)444 * creates a rotation from euler angles (pitch/yaw/roll) 445 * @param pitch: rotation around z (in radians) 446 * @param yaw: rotation around y (in radians) 447 * @param roll: rotation around x (in radians) 448 448 */ 449 449 Rotation::Rotation ( float pitch, float yaw, float roll) … … 468 468 469 469 /** 470 \briefcreates a nullrotation (an identity rotation)470 * creates a nullrotation (an identity rotation) 471 471 */ 472 472 Rotation::Rotation () … … 484 484 485 485 /** 486 \brieffills the specified buffer with a 4x4 glmatrix487 \param buffer: Pointer to an array of 16 floats486 * fills the specified buffer with a 4x4 glmatrix 487 * @param buffer: Pointer to an array of 16 floats 488 488 489 489 Use this to get the rotation in a gl-compatible format … … 510 510 511 511 /** 512 \briefmultiplies two rotational matrices513 \param r: another Rotation514 \return the matrix product of the Rotations512 * multiplies two rotational matrices 513 * @param r: another Rotation 514 * @return the matrix product of the Rotations 515 515 516 516 Use this to rotate one rotation by another … … 537 537 538 538 /** 539 \briefrotates the vector by the given rotation540 \param v: a vector541 \param r: a rotation542 \return the rotated vector539 * rotates the vector by the given rotation 540 * @param v: a vector 541 * @param r: a rotation 542 * @return the rotated vector 543 543 */ 544 544 Vector rotateVector( const Vector& v, const Rotation& r) … … 554 554 555 555 /** 556 \briefcalculate the distance between two lines557 \param l: the other line558 \return the distance between the lines556 * calculate the distance between two lines 557 * @param l: the other line 558 * @return the distance between the lines 559 559 */ 560 560 float Line::distance (const Line& l) const … … 569 569 570 570 /** 571 \briefcalculate the distance between a line and a point572 \param v: the point573 \return the distance between the Line and the point571 * calculate the distance between a line and a point 572 * @param v: the point 573 * @return the distance between the Line and the point 574 574 */ 575 575 float Line::distancePoint (const Vector& v) const … … 581 581 582 582 /** 583 \briefcalculate the distance between a line and a point584 \param v: the point585 \return the distance between the Line and the point583 * calculate the distance between a line and a point 584 * @param v: the point 585 * @return the distance between the Line and the point 586 586 */ 587 587 float Line::distancePoint (const sVec3D& v) const … … 594 594 595 595 /** 596 \briefcalculate the two points of minimal distance of two lines597 \param l: the other line598 \return a Vector[2] (!has to be deleted after use!) containing the two points of minimal distance596 * calculate the two points of minimal distance of two lines 597 * @param l: the other line 598 * @return a Vector[2] (!has to be deleted after use!) containing the two points of minimal distance 599 599 */ 600 600 Vector* Line::footpoints (const Line& l) const … … 618 618 619 619 /** 620 \briefrotate the line by given rotation621 \param rot: a rotation620 * rotate the line by given rotation 621 * @param rot: a rotation 622 622 */ 623 623 void Line::rotate (const Rotation& rot) … … 630 630 631 631 /** 632 \briefcreate a plane from three points633 \param a: first point634 \param b: second point635 \param c: third point632 * create a plane from three points 633 * @param a: first point 634 * @param b: second point 635 * @param c: third point 636 636 */ 637 637 Plane::Plane (Vector a, Vector b, Vector c) … … 642 642 643 643 /** 644 \briefcreate a plane from anchor point and normal645 \param norm: normal vector646 \param p: anchor point644 * create a plane from anchor point and normal 645 * @param norm: normal vector 646 * @param p: anchor point 647 647 */ 648 648 Plane::Plane (Vector norm, Vector p) … … 654 654 655 655 /** 656 \briefcreate a plane from anchor point and normal657 \param norm: normal vector658 \param p: anchor point656 * create a plane from anchor point and normal 657 * @param norm: normal vector 658 * @param p: anchor point 659 659 */ 660 660 Plane::Plane (Vector norm, sVec3D g) … … 667 667 668 668 /** 669 \briefreturns the intersection point between the plane and a line670 \param l: a line669 * returns the intersection point between the plane and a line 670 * @param l: a line 671 671 */ 672 672 Vector Plane::intersectLine (const Line& l) const … … 678 678 679 679 /** 680 \briefreturns the distance between the plane and a point681 \param p: a Point682 \return the distance between the plane and the point (can be negative)680 * returns the distance between the plane and a point 681 * @param p: a Point 682 * @return the distance between the plane and the point (can be negative) 683 683 */ 684 684 float Plane::distancePoint (const Vector& p) const … … 691 691 692 692 /** 693 \briefreturns the distance between the plane and a point694 \param p: a Point695 \return the distance between the plane and the point (can be negative)693 * returns the distance between the plane and a point 694 * @param p: a Point 695 * @return the distance between the plane and the point (can be negative) 696 696 */ 697 697 float Plane::distancePoint (const sVec3D& p) const … … 705 705 706 706 /** 707 \briefreturns the side a point is located relative to a Plane708 \param p: a Point709 \return 0 if the point is contained within the Plane, positive(negative) if the point is in the positive(negative) semi-space of the Plane707 * returns the side a point is located relative to a Plane 708 * @param p: a Point 709 * @return 0 if the point is contained within the Plane, positive(negative) if the point is in the positive(negative) semi-space of the Plane 710 710 */ 711 711 float Plane::locatePoint (const Vector& p) const -
orxonox/trunk/src/lib/math/vector.h
r4611 r4836 1 1 /*! 2 2 \file vector.h 3 \briefA basic 3D math framework3 * A basic 3D math framework 4 4 5 5 Contains classes to handle vectors, lines, rotations and planes … … 27 27 ~Vector () {} 28 28 29 /** \param index The index of the "array" \returns the x/y/z coordinate */29 /** @param index The index of the "array" @returns the x/y/z coordinate */ 30 30 inline float operator[] (float index) const {if( index == 0) return this->x; if( index == 1) return this->y; if( index == 2) return this->z; } 31 /** \param v The vector to add \returns the addition between two vectors (this + v) */31 /*** @param v The vector to add @returns the addition between two vectors (this + v) */ 32 32 inline Vector operator+ (const Vector& v) const { return Vector(x + v.x, y + v.y, z + v.z); }; 33 /** \param v The vector to add \returns the addition between two vectors (this + v) */33 /*** @param v The vector to add @returns the addition between two vectors (this + v) */ 34 34 inline Vector operator+ (const sVec3D& v) const { return Vector(x + v[0], y + v[1], z + v[2]); }; 35 /** \param v The vector to add \returns the addition between two vectors (this += v) */35 /** @param v The vector to add @returns the addition between two vectors (this += v) */ 36 36 inline const Vector& operator+= (const Vector& v) { this->x += v.x; this->y += v.y; this->z += v.z; return *this; }; 37 /** \param v The vector to substract \returns the substraction between two vectors (this - v) */37 /** @param v The vector to substract @returns the substraction between two vectors (this - v) */ 38 38 inline const Vector& operator+= (const sVec3D& v) { this->x += v[0]; this->y += v[1]; this->z += v[2]; return *this; }; 39 /** \param v The vector to substract \returns the substraction between two vectors (this - v) */39 /** @param v The vector to substract @returns the substraction between two vectors (this - v) */ 40 40 inline Vector operator- (const Vector& v) const { return Vector(x - v.x, y - v.y, z - v.z); } 41 /** \param v The vector to substract \returns the substraction between two vectors (this - v) */41 /** @param v The vector to substract @returns the substraction between two vectors (this - v) */ 42 42 inline Vector operator- (const sVec3D& v) const { return Vector(x - v[0], y - v[1], z - v[2]); } 43 /** \param v The vector to substract \returns the substraction between two vectors (this -= v) */43 /** @param v The vector to substract @returns the substraction between two vectors (this -= v) */ 44 44 inline const Vector& operator-= (const Vector& v) { this->x -= v.x; this->y -= v.y; this->z -= v.z; return *this; }; 45 /** \param v The vector to substract \returns the substraction between two vectors (this -= v) */45 /** @param v The vector to substract @returns the substraction between two vectors (this -= v) */ 46 46 inline const Vector& operator-= (const sVec3D& v) { this->x -= v[0]; this->y -= v[1]; this->z -= v[2]; return *this; }; 47 /** \param v the second vector \returns The dotProduct between two vector (this (dot) v) */47 /** @param v the second vector @returns The dotProduct between two vector (this (dot) v) */ 48 48 inline float operator* (const Vector& v) const { return x * v.x + y * v.y + z * v.z; }; 49 /** \todo strange */49 /** @todo strange */ 50 50 inline const Vector& operator*= (const Vector& v) { this->x *= v.x; this->y *= v.y; this->z *= v.z; return *this; }; 51 /** \param f a factor to multiply the vector with \returns the vector multiplied by f (this * f) */51 /** @param f a factor to multiply the vector with @returns the vector multiplied by f (this * f) */ 52 52 inline Vector operator* (float f) const { return Vector(x * f, y * f, z * f); }; 53 /** \param f a factor to multiply the vector with \returns the vector multiplied by f (this *= f) */53 /** @param f a factor to multiply the vector with @returns the vector multiplied by f (this *= f) */ 54 54 inline const Vector& operator*= (float f) { this->x *= f; this->y *= f; this->z *= f; return *this; }; 55 /** \param f a factor to divide the vector with \returns the vector divided by f (this / f) */55 /** @param f a factor to divide the vector with @returns the vector divided by f (this / f) */ 56 56 inline Vector operator/ (float f) const {if (unlikely(f == 0.0)) return Vector(0,0,0); else return Vector(this->x / f, this->y / f, this->z / f); }; 57 /** \param f a factor to divide the vector with \returns the vector divided by f (this /= f) */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; }; 59 /** \brief copy constructor \todo (i do not know it this is faster) \param v the vector to assign to this vector. \returns the vector v */59 /** \brief copy constructor @todo (i do not know it this is faster) @param v the vector to assign to this vector. @returns the vector v */ 60 60 inline const Vector& operator= (const Vector& v) { this->x = v.x; this->y = v.y; this->z = v.z; return *this; }; 61 /** \brief copy constructor \param v the sVec3D to assign to this vector. \returns the vector v */61 /** \brief copy constructor* @param v the sVec3D to assign to this vector. @returns the vector v */ 62 62 inline const Vector& operator= (const sVec3D& v) { this->x = v[0]; this->y = v[1]; this->z = v[2]; } 63 /** \param v: the other vector \return the dot product of the vectors */63 /** @param v: the other vector \return the dot product of the vectors */ 64 64 float dot (const Vector& v) const { return x*v.x+y*v.y+z*v.z; }; 65 /** \param v: the corss-product partner \returns the cross-product between this and v (this (x) v) */65 /** @param v: the corss-product partner @returns the cross-product between this and v (this (x) v) */ 66 66 inline Vector cross (const Vector& v) const { return Vector(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x ); } 67 /** \brief scales the this vector with v \param v the vector to scale this with */67 /** \brief scales the this vector with v* @param v the vector to scale this with */ 68 68 void scale(const Vector& v) { x *= v.x; y *= v.y; z *= v.z; }; 69 /** \returns the length of the vector */69 /** @returns the length of the vector */ 70 70 inline float len() const { return sqrt (x*x+y*y+z*z); } 71 71 /** \brief normalizes the vector */ … … 93 93 94 94 /** 95 \briefcalculate the angle between two vectors in radiances96 \param v1: a vector97 \param v2: another vector98 \return the angle between the vectors in radians95 * calculate the angle between two vectors in radiances 96 * @param v1: a vector 97 * @param v2: another vector 98 * @return the angle between the vectors in radians 99 99 */ 100 100 inline float angleDeg (const Vector& v1, const Vector& v2) { return acos( v1 * v2 / (v1.len() * v2.len())); }; 101 101 /** 102 \briefcalculate the angle between two vectors in degrees103 \param v1: a vector104 \param v2: another vector105 \return the angle between the vectors in degrees102 * calculate the angle between two vectors in degrees 103 * @param v1: a vector 104 * @param v2: another vector 105 * @return the angle between the vectors in degrees 106 106 */ 107 107 inline float angleRad (const Vector& v1, const Vector& v2) { return acos( v1 * v2 / (v1.len() * v2.len())) * 180/M_PI; }; … … 117 117 /** \brief creates a Default quaternion (multiplicational identity Quaternion)*/ 118 118 inline Quaternion () { w = 1; v = Vector(0,0,0); } 119 /** \brief creates a Quaternion looking into the direction v \param v: the direction \param f: the value */119 /** \brief creates a Quaternion looking into the direction v @param v: the direction @param f: the value */ 120 120 inline Quaternion (const Vector& v, float f) { this->w = f; this->v = v; } 121 121 Quaternion (float m[4][4]); 122 /** \brief turns a rotation along an axis into a Quaternion \param angle: the amount of radians to rotate \param axis: the axis to rotate around */122 /** \brief turns a rotation along an axis into a Quaternion @param angle: the amount of radians to rotate @param axis: the axis to rotate around */ 123 123 inline Quaternion (float angle, const Vector& axis) { w = cos(angle/2); v = axis * sin(angle/2); } 124 124 Quaternion (const Vector& dir, const Vector& up); 125 125 Quaternion (float roll, float pitch, float yaw); 126 126 Quaternion operator/ (const float& f) const; 127 /** \param f: the value to divide by \returns the quaternion devided by f (this /= f) */127 /** @param f: the value to divide by @returns the quaternion devided by f (this /= f) */ 128 128 inline const Quaternion& operator/= (const float& f) {*this = *this / f; return *this;} 129 129 Quaternion operator* (const float& f) const; 130 /** \param f: the value to multiply by \returns the quaternion multiplied by f (this *= f) */130 /** @param f: the value to multiply by @returns the quaternion multiplied by f (this *= f) */ 131 131 inline const Quaternion& operator*= (const float& f) {*this = *this * f; return *this;} 132 132 Quaternion operator* (const Quaternion& q) const; 133 /** \param q: the Quaternion to multiply by \returns the quaternion multiplied by q (this *= q) */133 /** @param q: the Quaternion to multiply by @returns the quaternion multiplied by q (this *= q) */ 134 134 inline const Quaternion operator*= (const Quaternion& q) {*this = *this * q; return *this; }; 135 /** \param q the Quaternion to add to this \returns the quaternion added with q (this + q) */135 /** @param q the Quaternion to add to this @returns the quaternion added with q (this + q) */ 136 136 inline Quaternion operator+ (const Quaternion& q) const { return Quaternion(q.v + v, q.w + w); }; 137 /** \param q the Quaternion to add to this \returns the quaternion added with q (this += q) */137 /** @param q the Quaternion to add to this @returns the quaternion added with q (this += q) */ 138 138 inline const Quaternion& operator+= (const Quaternion& q) { this->v += q.v; this->w += q.w; return *this; }; 139 /** \param q the Quaternion to substrace from this \returns the quaternion substracted by q (this - q) */139 /** @param q the Quaternion to substrace from this @returns the quaternion substracted by q (this - q) */ 140 140 inline Quaternion operator- (const Quaternion& q) const { return Quaternion(q.v - v, q.w - w); } 141 /** \param q the Quaternion to substrace from this \returns the quaternion substracted by q (this -= q) */141 /** @param q the Quaternion to substrace from this @returns the quaternion substracted by q (this -= q) */ 142 142 inline const Quaternion& operator-= (const Quaternion& q) { this->v -= q.v; this->w -= q.w; return *this; }; 143 /** \brief copy constructor \param q: the Quaternion to set this to. \returns the Quaternion q (or this) */143 /** \brief copy constructor @param q: the Quaternion to set this to. @returns the Quaternion q (or this) */ 144 144 inline Quaternion operator= (const Quaternion& q) {this->v = q.v; this->w = q.w; return *this;} 145 /** \brief conjugates this Quaternion \returns the conjugate */145 /** \brief conjugates this Quaternion @returns the conjugate */ 146 146 inline Quaternion conjugate () const { Quaternion r(*this); r.v = Vector() - r.v; return r;} 147 147 Quaternion inverse () const;
Note: See TracChangeset
for help on using the changeset viewer.