Пример #1
0
    public void Test_MortonKeyMul()
    {
        for (int x = 4; x < 6; x++)
        {
            for (int y = 8; y < 10; y++)
            {
                for (int z = 12; z < 16; z++)
                {
                    Vector3 xa = new Vector3(z, y, z);
                    Vector3 ya = new Vector3(x, x, y);

                    MortonKey3 xm = new MortonKey3(xa);
                    MortonKey3 ym = new MortonKey3(ya);

                    MortonKey3 sum     = xm * ym;
                    Vector3    testInc = xa;

                    testInc.x *= ya.x;
                    testInc.y *= ya.y;
                    testInc.z *= ya.z;

                    Vector3 decode = sum.Value;


                    Debug.Assert(testInc == decode,
                                 "Expected Test(" + testInc + ") to be Equal to Key(" + decode + ")");
                }
            }
        }
    }
Пример #2
0
    public void Test_MortonKeyAdd()
    {
        for (int x = 4; x < 9; x++)
        {
            for (int y = 3; y < 10; y++)
            {
                for (int z = 2; z < 11; z++)
                {
                    Vector3 xa = new Vector3(z, y, x);
                    Vector3 ya = new Vector3(x, z, y);

                    MortonKey3 xm = new MortonKey3(xa);
                    MortonKey3 ym = new MortonKey3(ya);

                    MortonKey3 sum     = xm + ym;
                    Vector3    testInc = xa + ya;
                    Vector3    decode  = sum.Value;


                    Debug.Assert(testInc == decode,
                                 "Expected Test(" + testInc + ") to be Equal to Key(" + decode + ")");
                }
            }
        }
    }
Пример #3
0
    public static void Test_MortonKeyEncodeZero()
    {
        Vector3    test      = new Vector3(0, 0, 0);
        MortonKey3 mortonKey = new MortonKey3(test);

        Debug.Assert(mortonKey.key == 0, "Expected Test(" + test + ") to be Equal to Key(" + mortonKey.key + ")");
    }
Пример #4
0
    public static void Test_MortonKeyEncodeDecode()
    {
        for (int x = 4; x < 9; x++)
        {
            for (int y = 3; y < 10; y++)
            {
                for (int z = 2; z < 11; z++)
                {
                    Vector3    test      = new Vector3(x, y, z);
                    MortonKey3 mortonKey = new MortonKey3(test);
                    Vector3    decode    = mortonKey.Value;

                    Debug.Assert(test == decode, "Expected Test(" + test + ") to be Equal to Key(" + decode + ")");
                }
            }
        }
    }
Пример #5
0
    public static void Test_MortonKeyEncodeDecodeDecXYZ()
    {
        for (int x = 4; x < 9; x++)
        {
            for (int y = 3; y < 10; y++)
            {
                for (int z = 2; z < 11; z++)
                {
                    Vector3 test    = new Vector3(x, y, z);
                    Vector3 testInc = new Vector3(x - 1, y - 1, z - 1);

                    MortonKey3 mortonKey = new MortonKey3(test);
                    MortonKey3 testKey   = mortonKey.DecXYZ();
                    Vector3    decode    = testKey.Value;

                    Debug.Assert(testInc == decode, "Expected Test(" + testInc + ") to be Equal to Key(" + decode + ") via Original(" + test + ")");
                }
            }
        }
    }
Пример #6
0
    public static void Test_MortonKeyMulVal()
    {
        for (int x = 4; x < 6; x++)
        {
            for (int y = 8; y < 10; y++)
            {
                for (int z = 12; z < 16; z++)
                {
                    Vector3 xa = new Vector3(z, y, z);

                    MortonKey3 xm = new MortonKey3(xa);

                    MortonKey3 sum     = xm * 5;
                    Vector3    testInc = xa * 5;

                    Vector3 decode = sum.Value;

                    Debug.Assert(testInc == decode, "Expected Test(" + testInc + ") to be Equal to Key(" + decode + ")");
                }
            }
        }
    }