SharpMath.float4x4.CoFactor C# (CSharp) 메소드

CoFactor() 공개 메소드

public CoFactor ( int _dwRow, int _dwCol ) : float
_dwRow int
_dwCol int
리턴 float
        public float CoFactor( int _dwRow, int _dwCol )
        {
            int		row1 = (_dwRow+1) & 3;
            int		row2 = (_dwRow+2) & 3;
            int		row3 = (_dwRow+3) & 3;
            int		col1 = (_dwCol+1) & 3;
            int		col2 = (_dwCol+2) & 3;
            int		col3 = (_dwCol+3) & 3;

            return	((	m[row1, col1]*m[row2, col2]*m[row3, col3] +
                        m[row1, col2]*m[row2, col3]*m[row3, col1] +
                        m[row1, col3]*m[row2, col1]*m[row3, col2] )

                    -(	m[row3, col1]*m[row2, col2]*m[row1, col3] +
                        m[row3, col2]*m[row2, col3]*m[row1, col1] +
                        m[row3, col3]*m[row2, col1]*m[row1, col2] ))
                    * (((_dwRow + _dwCol) & 1) == 1 ? -1.0f : +1.0f);
        }

Usage Example

예제 #1
0
파일: Form1.cs 프로젝트: Patapom/GodComplex
        static void TestFloat4x4()
        {
            if ( System.Runtime.InteropServices.Marshal.SizeOf(typeof(float4x4)) != 64 )
            throw new Exception( "Not the appropriate size!" );

            float4x4	test1 = new float4x4( new float[16] { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 } );
            float4x4	test2 = new float4x4( new float4( 1, 0, 0, 0 ), new float4( 0, 1, 0, 0 ), new float4( 0, 0, 1, 0 ), new float4( 0, 0, 0, 1 ) );
            float4x4	test3 = new float4x4( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 );
            float4x4	test0;
                test0 = test3;
            test2.Scale( new float3( 2, 2, 2 ) );
            float3x3	cast = (float3x3) test3;
            float4x4	mul0 = test1 * test2;
            float4x4	mul1 = 3.0f * test2;
            float4		mul2 = new float4( 1, 1, 1, 1 ) * test3;
            float4		access0 = test3[2];
            test3[1] = new float4( 12, 13, 14, 15 );
            float		access1 = test3[1,2];
            test3[1,2] = 18;
            float		coFactor = test3.CoFactor( 0, 2 );
            float		det = test3.Determinant;
            float4x4	inv = test2.Inverse;
            float4x4	id = float4x4.Identity;

            test3.BuildRotLeftHanded( float3.UnitZ, float3.Zero, float3.UnitY );
            test3.BuildRotRightHanded( float3.UnitZ, float3.Zero, float3.UnitY );
            test3.BuildProjectionPerspective( 1.2f, 2.0f, 0.01f, 10.0f );
            test3.BuildRotationX( 0.5f );
            test3.BuildRotationY( 0.5f );
            test3.BuildRotationZ( 0.5f );
            test3.BuildFromAngleAxis( 0.5f, float3.UnitY );
        }