Changeset 1791 for code/trunk/src/util/Math.cc
- Timestamp:
- Sep 16, 2008, 3:46:25 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/util/Math.cc
r1625 r1791 27 27 */ 28 28 29 /** 30 @file Math.cc 31 @brief Implementation of several math-functions. 32 */ 33 29 34 #include <OgrePlane.h> 30 35 … … 33 38 34 39 /** 35 @brief Function for writing to a stream.40 @brief Function for writing a Radian to a stream. 36 41 */ 37 42 std::ostream& operator<<(std::ostream& out, const orxonox::Radian& radian) … … 42 47 43 48 /** 44 @brief Function for reading from a stream.49 @brief Function for reading a Radian from a stream. 45 50 */ 46 51 std::istream& operator>>(std::istream& in, orxonox::Radian& radian) … … 53 58 54 59 /** 55 @brief Function for writing to a stream.60 @brief Function for writing a Degree to a stream. 56 61 */ 57 62 std::ostream& operator<<(std::ostream& out, const orxonox::Degree& degree) … … 62 67 63 68 /** 64 @brief Function for reading from a stream.69 @brief Function for reading a Degree from a stream. 65 70 */ 66 71 std::istream& operator>>(std::istream& in, orxonox::Degree& degree) … … 73 78 74 79 80 /** 81 @brief Gets the angle between my viewing direction and the direction to the position of the other object. 82 @param myposition My position 83 @param mydirection My viewing direction 84 @param otherposition The position of the other object 85 @return The angle 86 87 @example 88 If the other object is exactly in front of me, the function returns 0. 89 If the other object is exactly behind me, the function returns pi. 90 If the other object is exactly right/left to me (or above/below), the function returns pi/2. 91 */ 75 92 float getAngle(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition) 76 93 { … … 83 100 } 84 101 102 /** 103 @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object. 104 @param myposition My position 105 @param mydirection My viewing direction 106 @param myorthonormal My orthonormalvector (pointing upwards through my head) 107 @param otherposition The position of the other object 108 @return The viewing direction 109 110 @example 111 If the other object is exactly in front of me, the function returns Vector2(0, 0). 112 If the other object is exactly at my left, the function returns Vector2(-1, 0). 113 If the other object is exactly at my right, the function returns Vector2(1, 0). 114 If the other object is only a bit at my right, the function still returns Vector2(1, 0). 115 If the other object is exactly above me, the function returns Vector2(0, 1). 116 */ 85 117 orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition) 86 118 { … … 100 132 } 101 133 134 /** 135 @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0° = 0, 180° = 1). 136 @param myposition My position 137 @param mydirection My viewing direction 138 @param myorthonormal My orthonormalvector (pointing upwards through my head) 139 @param otherposition The position of the other object 140 @return The viewing direction 141 142 @example 143 If the other object is exactly in front of me, the function returns Vector2(0, 0). 144 If the other object is exactly at my left, the function returns Vector2(-0.5, 0). 145 If the other object is exactly at my right, the function returns Vector2(0.5, 0). 146 If the other object is only a bit at my right, the function still returns Vector2(0.01, 0). 147 If the other object is exactly above me, the function returns Vector2(0, 0.5). 148 */ 102 149 orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition) 103 150 { … … 121 168 } 122 169 170 /** 171 @brief Returns the predicted position I have to aim at, if I want to hit a moving target with a moving projectile. 172 @param myposition My position 173 @param projectilespeed The speed of my projectile 174 @param targetposition The position of my target 175 @param targetvelocity The velocity of my target 176 @return The predicted position 177 178 The function predicts the position based on a linear velocity of the target. If the target changes speed or direction, the projectile will miss. 179 */ 123 180 orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity) 124 181 {
Note: See TracChangeset
for help on using the changeset viewer.