Esempio n. 1
0
        public void ProcessElevationInformationForSubGrid_DefinedBaseWithNullTopHeights()
        {
            const double cellSize = SubGridTreeConsts.DefaultCellSize;
            const double cellArea = cellSize * cellSize;

            var state       = new ProgressiveVolumeAggregationState(cellSize);
            var baseHeights = NullHeights();
            var topHeights  = NullHeights();

            TRex.SubGridTrees.Core.Utilities.SubGridUtilities.SubGridDimensionalIterator((x, y) => baseHeights[x, y] = 0.0f);

            state.ProcessElevationInformationForSubGrid(SubGridTreeConsts.DefaultIndexOriginOffset, SubGridTreeConsts.DefaultIndexOriginOffset,
                                                        baseHeights, topHeights);

            state.Finalise();

            state.CutFillVolume.CutVolume.Should().Be(0.0);
            state.CutFillVolume.FillVolume.Should().Be(0.0);

            state.CoverageArea.Should().Be(0.0 * cellArea);
            state.CutArea.Should().Be(0.0 * cellArea);
            state.FillArea.Should().Be(0.0 * cellArea);
            state.TotalArea.Should().Be(SubGridTreeConsts.CellsPerSubGrid * cellArea);
            state.BoundingExtents.Should().BeEquivalentTo(BoundingWorldExtent3D.Inverted());
        }
Esempio n. 2
0
        public void AggregateWith()
        {
            const double cellSize = SubGridTreeConsts.DefaultCellSize;
            const double cellArea = cellSize * cellSize;

            var state1      = new ProgressiveVolumeAggregationState(cellSize);
            var state2      = new ProgressiveVolumeAggregationState(cellSize);
            var baseHeights = NullHeights();
            var topHeights  = NullHeights();

            TRex.SubGridTrees.Core.Utilities.SubGridUtilities.SubGridDimensionalIterator((x, y) => baseHeights[x, y] = 0.0f);
            TRex.SubGridTrees.Core.Utilities.SubGridUtilities.SubGridDimensionalIterator((x, y) => topHeights[x, y]  = (x % 2 == 0 ? 1.0f : -1.0f));

            state1.ProcessElevationInformationForSubGrid(SubGridTreeConsts.DefaultIndexOriginOffset, SubGridTreeConsts.DefaultIndexOriginOffset, baseHeights, topHeights);
            state2.ProcessElevationInformationForSubGrid(SubGridTreeConsts.DefaultIndexOriginOffset + SubGridTreeConsts.SubGridTreeDimension, SubGridTreeConsts.DefaultIndexOriginOffset, baseHeights, topHeights);

            state1.AggregateWith(state2);
            state1.Finalise();

            state1.CoverageArea.Should().Be(2 * SubGridTreeConsts.CellsPerSubGrid * cellArea);
            state1.CutArea.Should().Be(SubGridTreeConsts.CellsPerSubGrid * cellArea);
            state1.FillArea.Should().Be(SubGridTreeConsts.CellsPerSubGrid * cellArea);
            state1.TotalArea.Should().Be(2 * SubGridTreeConsts.CellsPerSubGrid * cellArea);
            state1.BoundingExtents.Should().BeEquivalentTo(new BoundingWorldExtent3D(0, 0, SubGridTreeConsts.SubGridTreeDimension * cellSize, SubGridTreeConsts.SubGridTreeDimension * cellSize));
        }
Esempio n. 3
0
        public void ProcessElevationInformationForSubGrid_DefinedTopAndBaseHeights()
        {
            const double cellSize = SubGridTreeConsts.DefaultCellSize;
            const double cellArea = cellSize * cellSize;

            var state       = new ProgressiveVolumeAggregationState(cellSize);
            var baseHeights = NullHeights();
            var topHeights  = NullHeights();

            TRex.SubGridTrees.Core.Utilities.SubGridUtilities.SubGridDimensionalIterator((x, y) => baseHeights[x, y] = 0.0f);
            TRex.SubGridTrees.Core.Utilities.SubGridUtilities.SubGridDimensionalIterator((x, y) => topHeights[x, y]  = (x % 2 == 0 ? 1.0f : -1.0f));

            state.ProcessElevationInformationForSubGrid(SubGridTreeConsts.DefaultIndexOriginOffset, SubGridTreeConsts.DefaultIndexOriginOffset,
                                                        baseHeights, topHeights);

            state.Finalise();

            state.CutFillVolume.CutVolume.Should().BeApproximately((SubGridTreeConsts.CellsPerSubGrid / 2) * cellArea, 0.0001);
            state.CutFillVolume.FillVolume.Should().BeApproximately((SubGridTreeConsts.CellsPerSubGrid / 2) * cellArea, 0.0001);

            state.CoverageArea.Should().Be(SubGridTreeConsts.CellsPerSubGrid * cellArea);
            state.CutArea.Should().Be((SubGridTreeConsts.CellsPerSubGrid / 2) * cellArea);
            state.FillArea.Should().Be((SubGridTreeConsts.CellsPerSubGrid / 2) * cellArea);
            state.TotalArea.Should().Be(SubGridTreeConsts.CellsPerSubGrid * cellArea);
            state.BoundingExtents.Should().BeEquivalentTo(new BoundingWorldExtent3D(0, 0, SubGridTreeConsts.SubGridTreeDimension * cellSize, SubGridTreeConsts.SubGridTreeDimension * cellSize));
        }
Esempio n. 4
0
        public void ProcessElevationInformationForSubGrid_NullBaseAndTopHeights()
        {
            const double cellSize = SubGridTreeConsts.DefaultCellSize;
            const double cellArea = cellSize * cellSize;

            var state = new ProgressiveVolumeAggregationState(cellSize);

            state.ProcessElevationInformationForSubGrid(SubGridTreeConsts.DefaultIndexOriginOffset, SubGridTreeConsts.DefaultIndexOriginOffset,
                                                        NullHeights(), NullHeights());

            state.Finalise();

            state.CutFillVolume.CutVolume.Should().Be(0.0);
            state.CutFillVolume.FillVolume.Should().Be(0.0);

            state.CoverageArea.Should().Be(0.0 * cellArea);
            state.CutArea.Should().Be(0.0 * cellArea);
            state.FillArea.Should().Be(0.0 * cellArea);
            state.TotalArea.Should().Be(SubGridTreeConsts.CellsPerSubGrid * cellArea);
            state.BoundingExtents.Should().BeEquivalentTo(BoundingWorldExtent3D.Inverted());
        }