From 23e0ef34929ca09ec01afe75077895a2809bd281 Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Fri, 8 Feb 2008 18:18:34 +0000
Subject: * Made some terrain functions faster computationally.

---
 .../libTerrainBSD/Channel/Editing/Flatten.cs           |  6 ++----
 .../libTerrainBSD/Channel/Editing/Raise.cs             | 18 ++++++------------
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs
index df34eeb..0946c6a 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs
@@ -109,10 +109,8 @@ namespace libTerrain
                     z *= z;
                     z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry));
 
-                    if (z < 0)
-                        z = 0;
-
-                    Set(x, y, Tools.LinearInterpolate(map[x, y], height, z));
+                    if (z > 0.0)
+                        Set(x, y, Tools.LinearInterpolate(map[x, y], height, z));
                 }
             }
         }
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs
index 9a8b8f5..0173400 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs
@@ -63,10 +63,8 @@ namespace libTerrain
                     z *= z;
                     z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry));
 
-                    if (z < 0)
-                        z = 0;
-
-                    Set(x, y, map[x, y] + (z*amount));
+                    if (z > 0.0)
+                        Set(x, y, map[x, y] + (z * amount));
                 }
             }
         }
@@ -88,10 +86,8 @@ namespace libTerrain
                     double z = size;
                     z -= Math.Sqrt(((x - rx)*(x - rx)) + ((y - ry)*(y - ry)));
 
-                    if (z < 0)
-                        z = 0;
-
-                    Set(x, y, map[x, y] + (z*amount));
+                    if (z > 0.0)
+                        Set(x, y, map[x, y] + (z * amount));
                 }
             }
         }
@@ -126,10 +122,8 @@ namespace libTerrain
                     z *= z;
                     z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry));
 
-                    if (z < 0)
-                        z = 0;
-
-                    Set(x, y, map[x, y] - (z*amount));
+                    if (z > 0.0)
+                        Set(x, y, map[x, y] + (z * amount));
                 }
             }
         }
-- 
cgit v1.1