Changeset 9749 for code/branches/radarDreiD/src/libraries
- Timestamp:
- Nov 4, 2013, 4:32:43 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/radarDreiD/src/libraries/util/Math.cc
r9742 r9749 211 211 212 212 // new coordinate system base y_coordinate 213 orxonox::Vector3 myside = -mydirection.crossProduct(myorthonormal);213 orxonox::Vector3 myside = mydirection.crossProduct(-myorthonormal); 214 214 215 215 // inverse of the transform matrix … … 218 218 +mydirection.z * (myside.x*myorthonormal.y - myside.y*myorthonormal.x); 219 219 float invdet = 1/determinant; 220 221 // transform matrix 220 222 orxonox::Vector3 xinvtransform; 221 223 orxonox::Vector3 yinvtransform; 222 224 orxonox::Vector3 zinvtransform; 223 225 224 xinvtransform.x = (myside.y* myorthonormal.z - myorthonormal.y * myside.z )*invdet;225 yinvtransform.x = -(mydirection.y * myorthonormal.z - mydirection.z * myorthonormal.y)*invdet;226 zinvtransform.x = (mydirection.y* myside.z - mydirection.z * myside.y )*invdet;227 xinvtransform.y = -(myside.x * myorthonormal.z - myside.z * myorthonormal.x)*invdet;228 yinvtransform.y = (mydirection.x* myorthonormal.z - mydirection.z * myorthonormal.x)*invdet;229 zinvtransform.y = -(mydirection.x * myside.z - myside.x * mydirection.z)*invdet;230 xinvtransform.z = (myside.x* myorthonormal.y - myorthonormal.x * myside.y )*invdet;231 yinvtransform.z = -(mydirection.x * myorthonormal.y - myorthonormal.x * mydirection.y)*invdet;232 zinvtransform.z = (mydirection.x * myside.y - myside.x * mydirection.x)*invdet;226 xinvtransform.x = (myside.y * myorthonormal.z - myorthonormal.y * myside.z )*invdet; 227 xinvtransform.y = (mydirection.z * myorthonormal.y - mydirection.y * myorthonormal.z)*invdet; 228 xinvtransform.z = (mydirection.y * myside.z - mydirection.z * myside.y )*invdet; 229 yinvtransform.x = (myside.z * myorthonormal.x - myside.x * myorthonormal.z)*invdet; 230 yinvtransform.y = (mydirection.x * myorthonormal.z - mydirection.z * myorthonormal.x)*invdet; 231 yinvtransform.z = (myside.x * mydirection.z - mydirection.x * myside.z )*invdet; 232 zinvtransform.x = (myside.x * myorthonormal.y - myorthonormal.x * myside.y )*invdet; 233 zinvtransform.y = (myorthonormal.x * mydirection.y - mydirection.x * myorthonormal.y)*invdet; 234 zinvtransform.z = (mydirection.x * myside.y - myside.x * mydirection.y )*invdet; 233 235 234 236 // coordinate transformation … … 238 240 239 241 // cap vector for map 240 distance.x = clamp<float>(distance.x, -detectionlimit/5, detectionlimit/5);241 distance.y = clamp<float>(distance.y, -detectionlimit/5, detectionlimit/5);242 distance.z = clamp<float>(distance.z, -detectionlimit/5, detectionlimit/5);243 float distancelength = distance.length();244 distance = distance / distancelength;242 //distance.x = clamp<float>(distance.x, -detectionlimit/5, detectionlimit/5); 243 //distance.y = clamp<float>(distance.y, -detectionlimit/5, detectionlimit/5); 244 //distance.z = clamp<float>(distance.z, -detectionlimit/5, detectionlimit/5); 245 //float distancelength = distance.length(); 246 distance = 5 * distance / detectionlimit; 245 247 246 248 // project vector for the rotated 3DMap on screen 247 float xcoordinate = distance.y;249 float xcoordinate = -distance.y; // -; cause in room myside points to the left, on screen x to the right 248 250 float ycoordinate = (distance.x*sin(mapangle)+distance.z*cos(mapangle)); 249 251 return orxonox::Vector2(xcoordinate , ycoordinate);
Note: See TracChangeset
for help on using the changeset viewer.