Changeset 9719 for code/branches/radarDreiD/src/libraries
- Timestamp:
- Oct 28, 2013, 3:58:20 PM (11 years ago)
- Location:
- code/branches/radarDreiD/src/libraries/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/radarDreiD/src/libraries/util/Math.cc
r8400 r9719 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Wolfgang Roenninger 26 26 * 27 27 */ … … 147 147 148 148 /** 149 @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).149 @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). 150 150 @param myposition My position 151 151 @param mydirection My viewing direction … … 190 190 return orxonox::Vector2( -sin_value * radius, cos_value * radius); 191 191 } 192 193 194 /** 195 @brief Gets the 2D project vector for the 3D Radar . 196 @param myposition My position 197 @param mydirection My viewing direction 198 @param otherposition The position of the other object 199 @param mapangle The angle you look on the 3Dmap 200 @param detectionlimit The limit in which objects are shown on the map 201 @return The viewing direction 202 203 Examples: 204 - 205 */ 206 orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit) 207 { 208 // 209 orxonox::Vector3 distance = otherposition - myposition; 210 211 // project difference vector on our plane 212 orxonox::Vector3 projection = Ogre::Plane(mydirection, myposition).projectVector(distance); 213 214 //float projectionlength = projection.length(); 215 216 // project vector for the rotated 3DMap 217 float xcoordinate = projection.y/(2*detectionlimit); 218 float ycoordinate = (projection.x*sin(mapangle)+projection.z*cos(mapangle))/(2*detectionlimit); 219 return orxonox::Vector2(xcoordinate , ycoordinate); 220 } 221 192 222 193 223 /** -
code/branches/radarDreiD/src/libraries/util/Math.h
r9550 r9719 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Wolfgang Roenninger 26 26 * 27 27 */ … … 92 92 _UtilExport orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition); 93 93 _UtilExport orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition); 94 _UtilExport orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit); 94 95 _UtilExport orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity); 95 96
Note: See TracChangeset
for help on using the changeset viewer.