Esempio n. 1
0
        public void Add2(clsHeightmap SourceA, clsHeightmap SourceB)
        {
            int Y = 0;
            int X = 0;
            double dblTempA = SourceA.HeightScale / HeightScale;
            double 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));
                }
            }
        }
Esempio n. 2
0
        public void Swap3(clsHeightmap SourceA, clsHeightmap SourceB, clsHeightmap Swapper)
        {
            int Y = 0;
            int 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);
                }
            }
        }
Esempio n. 3
0
        public void Multiply2(clsHeightmap SourceA, clsHeightmap SourceB)
        {
            int Y = 0;
            int 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);
                }
            }
        }
Esempio n. 4
0
        public void Lowest2(clsHeightmap SourceA, clsHeightmap SourceB)
        {
            int Y = 0;
            int X = 0;
            double dblTempA = 0;
            double dblTempB = 0;
            double dblTempC = SourceA.HeightScale / HeightScale;
            double 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] = (int)dblTempA;
                    }
                    else
                    {
                        HeightData.Height[Y, X] = (int)dblTempB;
                    }
                }
            }
        }
Esempio n. 5
0
        public void Divide2(clsHeightmap SourceA, clsHeightmap SourceB)
        {
            int Y = 0;
            int X = 0;
            double 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);
                }
            }
        }