xsi_math.h
Go to the documentation of this file.

    00001 //*****************************************************************************
    00011 //*****************************************************************************
    00012
    00013 #if (_MSC_VER > 1000) || defined(SGI_COMPILER)
    00014 #pragma once
    00015 #endif
    00016
    00017 #ifndef __XSIMATH_H__
    00018 #define __XSIMATH_H__
    00019
    00020 #include "sicppsdk.h"
    00021 #include "xsi_vector3.h"
    00022 #include "xsi_vector4.h"
    00023 #include "xsi_matrix3.h"
    00024 #include "xsi_matrix4.h"
    00025 #include "xsi_transformation.h"
    00026 #include "xsi_quaternion.h"
    00027 #include "xsi_rotation.h"
    00028
    00029 namespace XSI {
    00030
    00050 namespace MATH {
    00051
    00052     class CMatrix3f;
    00053     class CVector3f;
    00054     class CQuaternionf;
    00055
    00071     static const double PI(3.14159265358979323846);
    00072
    00078     static const float PI2((float)PI*2.0f);
    00079
    00085     static const float Invert2PI(0.5f/(float)PI);
    00086
    00092     static const float MilliEPS(1.0e-03f);
    00093
    00099     static const float MicroEPS(1.0e-06f);
    00100
    00106     static const float NanoEPS(1.0e-09f);
    00107
    00113     static const float PicoEPS(1.0e-012f);
    00114
    00119     inline double DegreesToRadians (double in_dDegrees)
    00120     { return (in_dDegrees * (PI/180.0));}
    00121
    00126     inline double RadiansToDegrees (double in_dRadians)
    00127     { return (in_dRadians * (180.0/PI));}
    00128
    00184     SICPPSDKDECL CTransformation MapObjectPoseToWorldSpace
    00185     (
    00186         const CTransformation&  in_transfoObjectSpace,
    00187         const CTransformation&  in_transfoPose
    00188     );
    00189
    00190
    00233     SICPPSDKDECL CVector3 MapObjectOrientationToWorldSpace
    00234     (
    00235         const CTransformation&  in_transfoObjectSpace,
    00236         const CVector3&             in_vector3Orientation
    00237     );
    00238
    00239
    00280     SICPPSDKDECL CVector3 MapObjectPositionToWorldSpace
    00281     (
    00282         const CTransformation&  in_transfoObjectSpace,
    00283         const CVector3&         in_vector3Position
    00284     );
    00285
    00291     SICPPSDKDECL CTransformation MapWorldPoseToObjectSpace
    00292     (
    00293         const CTransformation&  in_transfoObjectSpace,
    00294         const CTransformation&  in_transfoPose
    00295     );
    00296
    00302     SICPPSDKDECL CVector3 MapWorldOrientationToObjectSpace
    00303     (
    00304         const CTransformation&  in_transfoObjectSpace,
    00305         const CVector3&         in_vector3Orientation
    00306     );
    00307
    00343     SICPPSDKDECL CVector3 MapWorldPositionToObjectSpace
    00344     (
    00345         const CTransformation&  in_transfoObjectSpace,
    00346         const CVector3&         in_vector3Position
    00347     );
    00348
    00412     SICPPSDKDECL CTransformation MapObjectPoseToObjectSpace
    00413     (
    00414         const CTransformation&  in_transfoObjectSpace,
    00415         const CTransformation&  in_transfoSpace,
    00416         const CTransformation&  in_transfoPose
    00417     );
    00418
    00479     SICPPSDKDECL CVector3 MapObjectOrientationToObjectSpace
    00480     (
    00481         const CTransformation&  in_transfoObjectSpace,
    00482         const CTransformation&  in_transfoSpace,
    00483         const CVector3&         in_vector3Orientation
    00484     );
    00485
    00486
    00565     SICPPSDKDECL CVector3 MapObjectPositionToObjectSpace
    00566     (
    00567         const CTransformation&  in_transfoObjectSpace,
    00568         const CTransformation&  in_transfoSpace,
    00569         const CVector3&         in_vector3Position
    00570     );
    00571
    00572     SICPPSDK_INLINE void LimitValue( float& io_fVal, float in_fMin, float in_fMax );
    00573     SICPPSDKDECL void MatToEuler( const CMatrix3f& in_mat, CVector3f& io_vct, const short in_order );
    00574     SICPPSDKDECL void EulerToMat( const CVector3f& in_vct, CMatrix3f& out_mat, const short in_order );
    00575     SICPPSDKDECL void EulerToQuat( const CVector3f& in_vct, CQuaternionf& out_quat, const short in_order);
    00576 };
    00577
    00578 };
    00579
    00580 SICPPSDK_INLINE void XSI::MATH::LimitValue( float& io_fVal, float in_fMin, float in_fMax )
    00581 {
    00582    if( io_fVal < in_fMin )
    00583       io_fVal = in_fMin;
    00584    else if( io_fVal > in_fMax )
    00585       io_fVal = in_fMax;
    00586 }
    00587
    00588 #endif // __XSIMATH_H__