Example #1
0
        public void FloorTest()
        {
            const int max = 1000;

            var r = new Random(102);

            for (var i = 0; i < 30; i++)
            {
                var v = new Vector2(r.NextFloat() * max, r.NextFloat() * max);
                var c = v.Floor();
                Assert.AreEqual(Math.Floor(v.X), c.X);
                Assert.AreEqual(Math.Floor(v.Y), c.Y);
            }
        }
Example #2
0
        public Cell this[Vector2 xy]
        {
            get
            {
                xy.Floor();
                if ((xy.X <     0) || (xy.Y <     0) ||
                    (xy.X >= Size) || (xy.Y >= Size))
                    return null;

                return Cells[(int)xy.X, (int)xy.Y];
            }
        }