Esempio n. 1
0
            static void Index1dTo2d_VS_PointToIndex2d(float2 position, float2 gridWorldSize, int gridWidth, int gridHeight)
            {
                int  Ai  = NativeGrid.PointToIndex(position, gridWorldSize, gridWidth, gridHeight);
                int2 Ai2 = NativeGrid.Index1dTo2d(Ai, gridWidth);
                int2 Bi2 = NativeGrid.PointToIndex2d(position, gridWorldSize, gridWidth, gridHeight);

                Assert.AreEqual(Ai2, Bi2, $"\tNativeGrid.Index1dTo2d(NativeGrid.PointToIndex(params)) returned: {Ai2}\n\tNativeGrid.PointToIndex2d returned: {Bi2}");
            }
Esempio n. 2
0
        [Test] public static void Index1dTo2d()
        {
            RectInt R = new RectInt {
                width = 6, height = 6
            };

            Assert.AreEqual(new int2 {
                x = 1, y = 2
            }, NativeGrid.Index1dTo2d(13, R.width));
        }
 public static int2 Index1dTo2d(INT i, INT width) => NativeGrid.Index1dTo2d(i, width);