Ejemplo n.º 1
0
        public void ToArrayTest( )
        {
            Matrix4x4 matrix = new Matrix4x4( );

            matrix.V00 = 1;
            matrix.V01 = 2;
            matrix.V02 = 3;
            matrix.V03 = 4;

            matrix.V10 = 5;
            matrix.V11 = 6;
            matrix.V12 = 7;
            matrix.V13 = 8;

            matrix.V20 = 9;
            matrix.V21 = 10;
            matrix.V22 = 11;
            matrix.V23 = 12;

            matrix.V30 = 13;
            matrix.V31 = 14;
            matrix.V32 = 15;
            matrix.V33 = 16;

            float[] array = matrix.ToArray( );

            for ( int i = 0; i < 16; i++ )
            {
                Assert.AreEqual<float>( array[i], (float) ( i + 1 ) );
            }
        }
Ejemplo n.º 2
0
        public void SetMatrix( Matrix4x4 matrix )
        {
            float[] array = matrix.ToArray( );

            for ( int i = 0, k = 0; i < 4; i++ )
            {
                for ( int j = 0; j < 4; j++, k++ )
                {
                    string textBoxName = string.Format( "i{0}_j{1}_Box", i, j );

                    if ( textBoxes.ContainsKey( textBoxName ) )
                    {
                        textBoxes[textBoxName].Text = FormatFloat( array[k] );
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void CompareMatrixWithArray( Matrix4x4 matrix, float[] array )
        {
            float[] matrixArray = matrix.ToArray( );

            for ( int i = 0; i < 16; i++ )
            {
                Assert.AreEqual<float>( matrixArray[i], array[i] );
            }
        }