Procedurality.Channel.getMaxDelta C# (CSharp) Method

getMaxDelta() public method

Returns the maximum land height changes.
public getMaxDelta ( ) : float
return float
		public float getMaxDelta()
		{
			float mD=0.0f;
			int x,y;
			for(x=0;x<Width-1;x++)
			{
				for(y=0;y<Height-1;y++)
				{
					float ch = getPixel(x,y);
					// Check neighbors.
					
					// North neighbor
					float nD = ch-getPixel(x,y+1);
					// East neighbor
					float eD = ch-getPixel(x+1,y);
					mD=Math.Max(mD,Math.Max(nD,eD));
				}
			}
			for(x=1;x<Width;x++)
			{
				for(y=1;y<Height;y++)
				{
					float ch = getPixel(x,y);
					// Check neighbors.
					
					// South neighbor
					float sD = ch-getPixel(x,y-1);
					// West neighbor
					float wD = ch-getPixel(x-1,y);
					
					mD=Math.Max(mD,Math.Max(sD,wD));
				}
			}
			return mD;
		}
		// By Rob "N3X15" Nelson, for river stuff