Changeset 11099 for code/trunk/src/libraries/util
- Timestamp:
- Jan 27, 2016, 6:50:51 PM (9 years ago)
- Location:
- code/trunk/src/libraries/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/util/Clock.h
r11071 r11099 54 54 caveat because it will only capture the time on the same CPU core. 55 55 Confining the main thread to one process could speed up the game. 56 See \ref cmdargspage "Ccommandline Argument" 'limitToCPU' (only on Windows)57 56 */ 58 57 class _UtilExport Clock -
code/trunk/src/libraries/util/Math.cc
r11071 r11099 291 291 /** 292 292 @brief Gets the new vector after a coordinate transformation 293 @param distanceVector which will be transformed294 @param mydirectionNew x basevector295 @param myorthonormalNew y basevector296 @param otherpositionNew z basevector297 @return directionin the new coordinates293 @param totransform Vector which will be transformed 294 @param newx New x basevector 295 @param newy New y basevector 296 @param newz New z basevector 297 @return Vector in the new coordinates 298 298 299 299 x is vector in old coordinates … … 307 307 y = T^(-1)*x 308 308 */ 309 orxonox::Vector3 getTransformedVector(const orxonox::Vector3& distance, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& myside)309 orxonox::Vector3 getTransformedVector(const orxonox::Vector3& totransform, const orxonox::Vector3& newx, const orxonox::Vector3& newy, const orxonox::Vector3& newz) 310 310 { 311 311 // inverse of the transform matrix 312 float determinant = + mydirection.x * (myorthonormal.y*myside.z - myside.y*myorthonormal.z)313 - mydirection.y * (myorthonormal.x*myside.z - myorthonormal.z*myside.x)314 + mydirection.z * (myorthonormal.x*myside.y - myorthonormal.y*myside.x);312 float determinant = +newx.x * (newy.y*newz.z - newz.y*newy.z) 313 -newx.y * (newy.x*newz.z - newy.z*newz.x) 314 +newx.z * (newy.x*newz.y - newy.y*newz.x); 315 315 float invdet = 1/determinant; 316 316 … … 320 320 orxonox::Vector3 zinvtransform; 321 321 322 xinvtransform.x = ( myorthonormal.y * myside.z - myside.y * myorthonormal.z)*invdet;323 xinvtransform.y = ( mydirection.z * myside.y - mydirection.y * myside.z )*invdet;324 xinvtransform.z = ( mydirection.y * myorthonormal.z - mydirection.z * myorthonormal.y)*invdet;325 yinvtransform.x = ( myorthonormal.z * myside.x - myorthonormal.x * myside.z )*invdet;326 yinvtransform.y = ( mydirection.x * myside.z - mydirection.z * myside.x )*invdet;327 yinvtransform.z = ( myorthonormal.x * mydirection.z - mydirection.x * myorthonormal.z)*invdet;328 zinvtransform.x = ( myorthonormal.x * myside.y - myside.x * myorthonormal.y)*invdet;329 zinvtransform.y = ( myside.x * mydirection.y - mydirection.x * myside.y )*invdet;330 zinvtransform.z = ( mydirection.x * myorthonormal.y - myorthonormal.x * mydirection.y )*invdet;322 xinvtransform.x = (newy.y * newz.z - newz.y * newy.z)*invdet; 323 xinvtransform.y = (newx.z * newz.y - newx.y * newz.z )*invdet; 324 xinvtransform.z = (newx.y * newy.z - newx.z * newy.y)*invdet; 325 yinvtransform.x = (newy.z * newz.x - newy.x * newz.z )*invdet; 326 yinvtransform.y = (newx.x * newz.z - newx.z * newz.x )*invdet; 327 yinvtransform.z = (newy.x * newx.z - newx.x * newy.z)*invdet; 328 zinvtransform.x = (newy.x * newz.y - newz.x * newy.y)*invdet; 329 zinvtransform.y = (newz.x * newx.y - newx.x * newz.y )*invdet; 330 zinvtransform.z = (newx.x * newy.y - newy.x * newx.y )*invdet; 331 331 332 332 // coordinate transformation 333 333 orxonox::Vector3 distanceShip; 334 distanceShip.x = xinvtransform.x * distance.x + yinvtransform.x * distance.y + zinvtransform.x * distance.z;335 distanceShip.y = xinvtransform.y * distance.x + yinvtransform.y * distance.y + zinvtransform.y * distance.z;336 distanceShip.z = xinvtransform.z * distance.x + yinvtransform.z * distance.y + zinvtransform.z * distance.z;334 distanceShip.x = xinvtransform.x * totransform.x + yinvtransform.x * totransform.y + zinvtransform.x * totransform.z; 335 distanceShip.y = xinvtransform.y * totransform.x + yinvtransform.y * totransform.y + zinvtransform.y * totransform.z; 336 distanceShip.z = xinvtransform.z * totransform.x + yinvtransform.z * totransform.y + zinvtransform.z * totransform.z; 337 337 338 338 return distanceShip;
Note: See TracChangeset
for help on using the changeset viewer.