コード例 #1
0
        /// <summary>
        /// Generate a flat heightmap.
        /// </summary>
        public override HeightMap Generate()
        {
            var map = new HeightMap(Dimensions);

            map.FlattenTo(Height);
            return(map);
        }
コード例 #2
0
        public void FlattenTo_SetsAllMapDataToZero()
        {
            // Arrange
            var value  = 1.5d;
            var source = new double[, ] {
                { 1d, 2d }, { 3d, 4d }
            };
            var expected = new double[, ] {
                { value, value }, { value, value }
            };
            var map = new HeightMap(source);

            // Act
            map.FlattenTo(value);

            // Assert
            Assert.Equal(expected, map.Data);
        }