public void IntersectIndexes3DTest()
        {
            var indexesService = new LineSpatialIndexesService(10, new Coordinate(0, 0, 0));

            var line = new List <Coordinate> {
                new Coordinate(4, 8, 7), new Coordinate(16, 14, 14)
            };
            var index = indexesService.GetLineSpatial3DIndexes(line);

            Assert.AreEqual(4, index.Count, "Неверное количество ячеек индекса");
            Assert.IsTrue(index.Any(sp => sp.Row == 0 && sp.Column == 0 && sp.Layer == 0));
            Assert.IsTrue(index.Any(sp => sp.Row == 1 && sp.Column == 0 && sp.Layer == 0));
            Assert.IsTrue(index.Any(sp => sp.Row == 1 && sp.Column == 0 && sp.Layer == 1));
            Assert.IsTrue(index.Any(sp => sp.Row == 1 && sp.Column == 1 && sp.Layer == 1));
        }
        public void SimpleIndexes3DTest()
        {
            var indexesService = new LineSpatialIndexesService(10, new Coordinate(0, 0, 0));

            var line = new List <Coordinate> {
                new Coordinate(5, 5, 5), new Coordinate(15, 18, 25)
            };
            var index = indexesService.GetLineSpatial3DIndexes(line);

            Assert.AreEqual(5, index.Count, "Неверное количество ячеек индекса");
            Assert.IsTrue(index.Any(sp => sp.Row == 0 && sp.Column == 0 && sp.Layer == 0));
            Assert.IsTrue(index.Any(sp => sp.Row == 0 && sp.Column == 0 && sp.Layer == 1));
            Assert.IsTrue(index.Any(sp => sp.Row == 1 && sp.Column == 0 && sp.Layer == 1));
            Assert.IsTrue(index.Any(sp => sp.Row == 1 && sp.Column == 1 && sp.Layer == 1));
            Assert.IsTrue(index.Any(sp => sp.Row == 1 && sp.Column == 1 && sp.Layer == 2));
        }
Example #3
0
        public void NegativeIndexPositiveOriginTest3D()
        {
            var indexesService = new LineSpatialIndexesService(20, new Coordinate(20, 20, 20));
            var line           = new List <Coordinate>
            {
                new Coordinate(-19, -19, -9),
                new Coordinate(89, 59, 79)
            };

            var index = indexesService.GetLineSpatial3DIndexes(line);
            var rows  = index.Select(ind => ind.Layer).Distinct().ToList();

            Assert.AreEqual(5, rows.Count, "Неверное количество слоёв");
            Assert.IsTrue(rows.Any(sp => sp == -2));
            Assert.IsTrue(rows.Any(sp => sp == -1));
            Assert.IsTrue(rows.Any(sp => sp == 0));
            Assert.IsTrue(rows.Any(sp => sp == 1));
            Assert.IsTrue(rows.Any(sp => sp == 2));
        }