SharpMath.float3x3.GetEuler C# (CSharp) 메소드

GetEuler() 공개 메소드

public GetEuler ( ) : float3
리턴 float3
        public float3 GetEuler()
        {
            float3		Ret = new float3();
            float		fSinY = System.Math.Min( +1.0f, System.Math.Max( -1.0f, m[0, 2] ) ), fCosY = (float) System.Math.Sqrt( 1.0f - fSinY*fSinY );

            if ( m[0, 0] < 0.0 && m[2, 2] < 0.0 )
                fCosY = -fCosY;

            if ( (float) System.Math.Abs( fCosY ) > float.Epsilon )
            {
                Ret.x = (float)  System.Math.Atan2( m[1, 2] / fCosY, m[2, 2] / fCosY );
                Ret.y = (float) -System.Math.Atan2( fSinY, fCosY );
                Ret.z = (float)  System.Math.Atan2( m[0, 1] / fCosY, m[0, 0] / fCosY );
            }
            else
            {
                Ret.x = (float)  System.Math.Atan2( -m[2, 1], m[1, 1] );
                Ret.y = (float) -System.Math.Asin( fSinY );
                Ret.z = 0.0f;
            }

            return	Ret;
        }