예제 #1
0
        public void Lowest2(clsHeightmap SourceA, clsHeightmap SourceB)
        {
            var    Y        = 0;
            var    X        = 0;
            double dblTempA = 0;
            double dblTempB = 0;
            var    dblTempC = SourceA.HeightScale / HeightScale;
            var    dblTempD = SourceB.HeightScale / HeightScale;

            if (!SourceA.IsSizeSame(SourceB))
            {
                Debugger.Break();
            }
            SizeCopy(SourceA);
            for (Y = 0; Y <= HeightData.SizeY - 1; Y++)
            {
                for (X = 0; X <= HeightData.SizeX - 1; X++)
                {
                    dblTempA = Convert.ToDouble(SourceA.HeightData.Height[Y, X] * dblTempC);
                    dblTempB = Convert.ToDouble(SourceB.HeightData.Height[Y, X] * dblTempD);
                    if (dblTempA <= dblTempB)
                    {
                        HeightData.Height[Y, X] = dblTempA.ToLong();
                    }
                    else
                    {
                        HeightData.Height[Y, X] = dblTempB.ToLong();
                    }
                }
            }
        }
예제 #2
0
        public void Swap3(clsHeightmap SourceA, clsHeightmap SourceB, clsHeightmap Swapper)
        {
            var    Y     = 0;
            var    X     = 0;
            double Ratio = 0;

            if (!(Swapper.IsSizeSame(SourceA) && Swapper.IsSizeSame(SourceB)))
            {
                Debugger.Break();
            }
            SizeCopy(Swapper);
            for (Y = 0; Y <= HeightData.SizeY - 1; Y++)
            {
                for (X = 0; X <= HeightData.SizeX - 1; X++)
                {
                    Ratio = Convert.ToDouble(Swapper.HeightData.Height[Y, X] * Swapper.HeightScale);
                    HeightData.Height[Y, X] =
                        Convert.ToInt32(
                            Convert.ToDouble(Convert.ToDouble(SourceA.HeightData.Height[Y, X] * SourceA.HeightScale) * (1.0D - Ratio) +
                                             Convert.ToDouble(SourceB.HeightData.Height[Y, X] * Ratio * SourceB.HeightScale)) / HeightScale);
                }
            }
        }
예제 #3
0
        public void Divide2(clsHeightmap SourceA, clsHeightmap SourceB)
        {
            var Y       = 0;
            var X       = 0;
            var dblTemp = SourceA.HeightScale / (SourceB.HeightScale * HeightScale);

            if (!SourceA.IsSizeSame(SourceB))
            {
                Debugger.Break();
            }
            SizeCopy(SourceA);
            for (Y = 0; Y <= HeightData.SizeY - 1; Y++)
            {
                for (X = 0; X <= HeightData.SizeX - 1; X++)
                {
                    HeightData.Height[Y, X] =
                        Convert.ToInt32(Convert.ToDouble(SourceA.HeightData.Height[Y, X] / SourceB.HeightData.Height[Y, X]) * dblTemp);
                }
            }
        }
예제 #4
0
        public void Subtract2(clsHeightmap SourceA, clsHeightmap SourceB)
        {
            var Y        = 0;
            var X        = 0;
            var dblTempA = SourceA.HeightScale / HeightScale;
            var dblTempB = SourceB.HeightScale / HeightScale;

            if (!SourceA.IsSizeSame(SourceB))
            {
                Debugger.Break();
            }
            SizeCopy(SourceA);
            for (Y = 0; Y <= HeightData.SizeY - 1; Y++)
            {
                for (X = 0; X <= HeightData.SizeX - 1; X++)
                {
                    HeightData.Height[Y, X] =
                        Convert.ToInt32(Convert.ToDouble(SourceA.HeightData.Height[Y, X] * dblTempA) -
                                        Convert.ToDouble(SourceB.HeightData.Height[Y, X] * dblTempB));
                }
            }
        }
예제 #5
0
        public void Multiply2(clsHeightmap SourceA, clsHeightmap SourceB)
        {
            var Y = 0;
            var X = 0;

            if (!SourceA.IsSizeSame(SourceB))
            {
                Debugger.Break();
            }
            SizeCopy(SourceA);
            for (Y = 0; Y <= HeightData.SizeY - 1; Y++)
            {
                for (X = 0; X <= HeightData.SizeX - 1; X++)
                {
                    HeightData.Height[Y, X] =
                        Convert.ToInt32(
                            Convert.ToInt32(
                                Convert.ToDouble(Convert.ToDouble(SourceA.HeightData.Height[Y, X] * SourceA.HeightScale) *
                                                 SourceB.HeightData.Height[Y, X]) * SourceB.HeightScale) / HeightScale);
                }
            }
        }