Changeset 9877 for code/branches/radarDreiD/src/libraries/util/Math.cc
- Timestamp:
- Dec 9, 2013, 2:06:55 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/radarDreiD/src/libraries/util/Math.cc
r9792 r9877 208 208 { 209 209 // Orxonox Vectors: x_direction you are looking, y_direction points up, z_direction points to the right 210 orxonox::Vector3 distance = otherposition - myposition; 210 orxonox::Vector3 distance = otherposition - myposition; // get vector from Ship to object 211 211 212 212 // new coordinate system: x_axsis: mydirection (points front) … … 214 214 // z_axsis: myside (points right) 215 215 216 orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get vector from Ship to object216 orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get 3. base vector 217 217 218 218 distance = 4*distance / detectionlimit; // shrink vector on map … … 263 263 else 264 264 return false; 265 } 266 267 /** 268 @brief A value between 0 and 10, in order how other object is in front or in back 269 @param myposition My position 270 @param mydirection My viewing direction 271 @param myorthonormal My orthonormalvector (pointing upwards through my head) 272 @param otherposition The position of the other object 273 @param detectionlimit The limit in which objects are shown on the map 274 @return value between 0 and 100 275 */ 276 int determineMap3DZOrder(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float detectionlimit) 277 { 278 orxonox::Vector3 distance = otherposition - myposition; // get vector from Ship to object 279 orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get vector to the side 280 281 distance = 4*distance / detectionlimit; // shrink vector on map 282 if(distance.length() > 1.0f) // if object would wander outside of the map 283 { 284 distance = distance / distance.length(); 285 } 286 287 // perform a coordinate transformation to get distance in relation of the position of the ship 288 orxonox::Vector3 distanceShip = getTransformedVector(distance, mydirection, myorthonormal, myside); 289 290 return (int) 50 - 100*distanceShip.x; 265 291 } 266 292
Note: See TracChangeset
for help on using the changeset viewer.