aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators
diff options
context:
space:
mode:
authorlbsa712007-10-30 09:05:31 +0000
committerlbsa712007-10-30 09:05:31 +0000
commit67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch)
tree20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators
parent* Deleted .user file (diff)
downloadopensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators')
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs10
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs5
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs77
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs4
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs47
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs35
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs14
7 files changed, 90 insertions, 102 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs
index 3a9b7f7..65badd1 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace libTerrain 31namespace libTerrain
34{ 32{
@@ -60,19 +58,19 @@ namespace libTerrain
60 } 58 }
61 if (val < 512) 59 if (val < 512)
62 { 60 {
63 ret[0] = (val % 256); 61 ret[0] = (val%256);
64 ret[1] = 255; 62 ret[1] = 255;
65 return ret; 63 return ret;
66 } 64 }
67 if (val < 768) 65 if (val < 768)
68 { 66 {
69 ret[0] = 255; 67 ret[0] = 255;
70 ret[1] = 255 - (val % 256); 68 ret[1] = 255 - (val%256);
71 return ret; 69 return ret;
72 } 70 }
73 if (val < 1024) 71 if (val < 1024)
74 { 72 {
75 ret[0] = 255 - (val % 256); 73 ret[0] = 255 - (val%256);
76 ret[1] = 255; 74 ret[1] = 255;
77 return ret; 75 return ret;
78 } 76 }
@@ -100,7 +98,7 @@ namespace libTerrain
100 { 98 {
101 for (int y = 0; y < h; y++) 99 for (int y = 0; y < h; y++)
102 { 100 {
103 double miny = Tools.LinearInterpolate(a[1], b[1], (double)x / (double)w); 101 double miny = Tools.LinearInterpolate(a[1], b[1], (double) x/(double) w);
104 102
105 if (v >= 0.5) 103 if (v >= 0.5)
106 { 104 {
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs
index 8a1b048..b6e2491 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs
@@ -26,15 +26,10 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace libTerrain 29namespace libTerrain
34{ 30{
35 partial class Channel 31 partial class Channel
36 { 32 {
37
38 public void GradientCube() 33 public void GradientCube()
39 { 34 {
40 SetDiff(); 35 SetDiff();
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs
index 7cea800..6806748 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace libTerrain 31namespace libTerrain
34{ 32{
@@ -44,7 +42,8 @@ namespace libTerrain
44 /// <param name="island">Whether to bias hills towards the center of the map</param> 42 /// <param name="island">Whether to bias hills towards the center of the map</param>
45 /// <param name="additive">Whether to add hills together or to pick the largest value</param> 43 /// <param name="additive">Whether to add hills together or to pick the largest value</param>
46 /// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param> 44 /// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param>
47 public void HillsSpheres(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) 45 public void HillsSpheres(int number, double scale_min, double scale_range, bool island, bool additive,
46 bool noisy)
48 { 47 {
49 SetDiff(); 48 SetDiff();
50 49
@@ -55,20 +54,20 @@ namespace libTerrain
55 54
56 for (i = 0; i < number; i++) 55 for (i = 0; i < number; i++)
57 { 56 {
58 double rx = Math.Min(255.0, random.NextDouble() * w); 57 double rx = Math.Min(255.0, random.NextDouble()*w);
59 double ry = Math.Min(255.0, random.NextDouble() * h); 58 double ry = Math.Min(255.0, random.NextDouble()*h);
60 double rand = random.NextDouble(); 59 double rand = random.NextDouble();
61 60
62 if (island) 61 if (island)
63 { 62 {
64 // Move everything towards the center 63 // Move everything towards the center
65 rx -= w / 2; 64 rx -= w/2;
66 rx /= 2; 65 rx /= 2;
67 rx += w / 2; 66 rx += w/2;
68 67
69 ry -= h / 2; 68 ry -= h/2;
70 ry /= 2; 69 ry /= 2;
71 ry += h / 2; 70 ry += h/2;
72 } 71 }
73 72
74 for (x = 0; x < w; x++) 73 for (x = 0; x < w; x++)
@@ -78,9 +77,9 @@ namespace libTerrain
78 if (noisy) 77 if (noisy)
79 rand = random.NextDouble(); 78 rand = random.NextDouble();
80 79
81 double z = (scale_min + (scale_range * rand)); 80 double z = (scale_min + (scale_range*rand));
82 z *= z; 81 z *= z;
83 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); 82 z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry));
84 83
85 if (z < 0) 84 if (z < 0)
86 z = 0; 85 z = 0;
@@ -121,20 +120,20 @@ namespace libTerrain
121 120
122 for (i = 0; i < number; i++) 121 for (i = 0; i < number; i++)
123 { 122 {
124 double rx = Math.Min(255.0, random.NextDouble() * w); 123 double rx = Math.Min(255.0, random.NextDouble()*w);
125 double ry = Math.Min(255.0, random.NextDouble() * h); 124 double ry = Math.Min(255.0, random.NextDouble()*h);
126 double rand = random.NextDouble(); 125 double rand = random.NextDouble();
127 126
128 if (island) 127 if (island)
129 { 128 {
130 // Move everything towards the center 129 // Move everything towards the center
131 rx -= w / 2; 130 rx -= w/2;
132 rx /= 2; 131 rx /= 2;
133 rx += w / 2; 132 rx += w/2;
134 133
135 ry -= h / 2; 134 ry -= h/2;
136 ry /= 2; 135 ry /= 2;
137 ry += h / 2; 136 ry += h/2;
138 } 137 }
139 138
140 for (x = 0; x < w; x++) 139 for (x = 0; x < w; x++)
@@ -144,8 +143,8 @@ namespace libTerrain
144 if (noisy) 143 if (noisy)
145 rand = random.NextDouble(); 144 rand = random.NextDouble();
146 145
147 double z = (scale_min + (scale_range * rand)); 146 double z = (scale_min + (scale_range*rand));
148 z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry))); 147 z -= Math.Sqrt(((x - rx)*(x - rx)) + ((y - ry)*(y - ry)));
149 148
150 if (z < 0) 149 if (z < 0)
151 z = 0; 150 z = 0;
@@ -176,20 +175,20 @@ namespace libTerrain
176 175
177 for (i = 0; i < number; i++) 176 for (i = 0; i < number; i++)
178 { 177 {
179 double rx = Math.Min(255.0, random.NextDouble() * w); 178 double rx = Math.Min(255.0, random.NextDouble()*w);
180 double ry = Math.Min(255.0, random.NextDouble() * h); 179 double ry = Math.Min(255.0, random.NextDouble()*h);
181 double rand = random.NextDouble(); 180 double rand = random.NextDouble();
182 181
183 if (island) 182 if (island)
184 { 183 {
185 // Move everything towards the center 184 // Move everything towards the center
186 rx -= w / 2; 185 rx -= w/2;
187 rx /= 2; 186 rx /= 2;
188 rx += w / 2; 187 rx += w/2;
189 188
190 ry -= h / 2; 189 ry -= h/2;
191 ry /= 2; 190 ry /= 2;
192 ry += h / 2; 191 ry += h/2;
193 } 192 }
194 193
195 for (x = 0; x < w; x++) 194 for (x = 0; x < w; x++)
@@ -199,8 +198,8 @@ namespace libTerrain
199 if (noisy) 198 if (noisy)
200 rand = random.NextDouble(); 199 rand = random.NextDouble();
201 200
202 double z = (scale_min + (scale_range * rand)); 201 double z = (scale_min + (scale_range*rand));
203 z -= Math.Abs(x-rx) + Math.Abs(y-ry); 202 z -= Math.Abs(x - rx) + Math.Abs(y - ry);
204 //z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry))); 203 //z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry)));
205 204
206 if (z < 0) 205 if (z < 0)
@@ -221,7 +220,8 @@ namespace libTerrain
221 Normalise(); 220 Normalise();
222 } 221 }
223 222
224 public void HillsSquared(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) 223 public void HillsSquared(int number, double scale_min, double scale_range, bool island, bool additive,
224 bool noisy)
225 { 225 {
226 SetDiff(); 226 SetDiff();
227 227
@@ -232,20 +232,20 @@ namespace libTerrain
232 232
233 for (i = 0; i < number; i++) 233 for (i = 0; i < number; i++)
234 { 234 {
235 double rx = Math.Min(255.0, random.NextDouble() * w); 235 double rx = Math.Min(255.0, random.NextDouble()*w);
236 double ry = Math.Min(255.0, random.NextDouble() * h); 236 double ry = Math.Min(255.0, random.NextDouble()*h);
237 double rand = random.NextDouble(); 237 double rand = random.NextDouble();
238 238
239 if (island) 239 if (island)
240 { 240 {
241 // Move everything towards the center 241 // Move everything towards the center
242 rx -= w / 2; 242 rx -= w/2;
243 rx /= 2; 243 rx /= 2;
244 rx += w / 2; 244 rx += w/2;
245 245
246 ry -= h / 2; 246 ry -= h/2;
247 ry /= 2; 247 ry /= 2;
248 ry += h / 2; 248 ry += h/2;
249 } 249 }
250 250
251 for (x = 0; x < w; x++) 251 for (x = 0; x < w; x++)
@@ -255,11 +255,11 @@ namespace libTerrain
255 if (noisy) 255 if (noisy)
256 rand = random.NextDouble(); 256 rand = random.NextDouble();
257 257
258 double z = (scale_min + (scale_range * rand)); 258 double z = (scale_min + (scale_range*rand));
259 z *= z * z * z; 259 z *= z*z*z;
260 double dx = Math.Abs(x - rx); 260 double dx = Math.Abs(x - rx);
261 double dy = Math.Abs(y - ry); 261 double dy = Math.Abs(y - ry);
262 z -= (dx * dx * dx * dx) + (dy * dy * dy * dy); 262 z -= (dx*dx*dx*dx) + (dy*dy*dy*dy);
263 263
264 if (z < 0) 264 if (z < 0)
265 z = 0; 265 z = 0;
@@ -278,6 +278,5 @@ namespace libTerrain
278 278
279 Normalise(); 279 Normalise();
280 } 280 }
281
282 } 281 }
283} 282} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs
index 43ae37a..5d39cd5 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace libTerrain 31namespace libTerrain
34{ 32{
@@ -53,4 +51,4 @@ namespace libTerrain
53 } 51 }
54 } 52 }
55 } 53 }
56} 54} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs
index d7e0dcd..10eaf71 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs
@@ -28,7 +28,6 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32 31
33namespace libTerrain 32namespace libTerrain
34{ 33{
@@ -36,10 +35,10 @@ namespace libTerrain
36 { 35 {
37 private double[] CoordinatesToPolar(int x, int y) 36 private double[] CoordinatesToPolar(int x, int y)
38 { 37 {
39 double theta = Math.Atan2(x - (w / 2), y - (h / 2)); 38 double theta = Math.Atan2(x - (w/2), y - (h/2));
40 double rx = (double)x - ((double)w / 2); 39 double rx = (double) x - ((double) w/2);
41 double ry = (double)y - ((double)h / 2); 40 double ry = (double) y - ((double) h/2);
42 double r = Math.Sqrt((rx * rx) + (ry * ry)); 41 double r = Math.Sqrt((rx*rx) + (ry*ry));
43 42
44 double[] coords = new double[2]; 43 double[] coords = new double[2];
45 coords[0] = r; 44 coords[0] = r;
@@ -47,15 +46,16 @@ namespace libTerrain
47 return coords; 46 return coords;
48 } 47 }
49 48
50 public int[] PolarToCoordinates(double r, double theta) { 49 public int[] PolarToCoordinates(double r, double theta)
50 {
51 double nx; 51 double nx;
52 double ny; 52 double ny;
53 53
54 nx = (double)r * Math.Cos(theta); 54 nx = (double) r*Math.Cos(theta);
55 ny = (double)r * Math.Sin(theta); 55 ny = (double) r*Math.Sin(theta);
56 56
57 nx += w / 2; 57 nx += w/2;
58 ny += h / 2; 58 ny += h/2;
59 59
60 if (nx >= w) 60 if (nx >= w)
61 nx = w - 1; 61 nx = w - 1;
@@ -70,8 +70,8 @@ namespace libTerrain
70 ny = 0; 70 ny = 0;
71 71
72 int[] coords = new int[2]; 72 int[] coords = new int[2];
73 coords[0] = (int)nx; 73 coords[0] = (int) nx;
74 coords[1] = (int)ny; 74 coords[1] = (int) ny;
75 return coords; 75 return coords;
76 } 76 }
77 77
@@ -79,19 +79,19 @@ namespace libTerrain
79 { 79 {
80 SetDiff(); 80 SetDiff();
81 81
82 Channel n = this.Copy(); 82 Channel n = Copy();
83 83
84 int x, y; 84 int x, y;
85 for (x = 0; x < w; x++) 85 for (x = 0; x < w; x++)
86 { 86 {
87 for (y = 0; y < h; y++) 87 for (y = 0; y < h; y++)
88 { 88 {
89 double[] coords = CoordinatesToPolar(x,y); 89 double[] coords = CoordinatesToPolar(x, y);
90 90
91 coords[0] += w / 2.0; 91 coords[0] += w/2.0;
92 coords[1] += h / 2.0; 92 coords[1] += h/2.0;
93 93
94 map[x, y] = n.map[(int)coords[0] % n.w, (int)coords[1] % n.h]; 94 map[x, y] = n.map[(int) coords[0]%n.w, (int) coords[1]%n.h];
95 } 95 }
96 } 96 }
97 } 97 }
@@ -108,12 +108,13 @@ namespace libTerrain
108 r += incRadius; 108 r += incRadius;
109 theta += incAngle; 109 theta += incAngle;
110 110
111 int[] coords = PolarToCoordinates(r,theta); 111 int[] coords = PolarToCoordinates(r, theta);
112 Raise(coords[0], coords[1], 20, 1); 112 Raise(coords[0], coords[1], 20, 1);
113 } 113 }
114 } 114 }
115 115
116 public void SpiralCells(int steps, double incAngle, double incRadius, double offsetRadius, double offsetAngle, double[] c) 116 public void SpiralCells(int steps, double incAngle, double incRadius, double offsetRadius, double offsetAngle,
117 double[] c)
117 { 118 {
118 SetDiff(); 119 SetDiff();
119 120
@@ -128,7 +129,7 @@ namespace libTerrain
128 theta += incAngle; 129 theta += incAngle;
129 130
130 int[] coords = PolarToCoordinates(r, theta); 131 int[] coords = PolarToCoordinates(r, theta);
131 points.Add(new Point2D(coords[0],coords[1])); 132 points.Add(new Point2D(coords[0], coords[1]));
132 } 133 }
133 134
134 VoronoiDiagram(points, c); 135 VoronoiDiagram(points, c);
@@ -145,9 +146,9 @@ namespace libTerrain
145 for (y = 0; y < h; y++) 146 for (y = 0; y < h; y++)
146 { 147 {
147 z++; 148 z++;
148 double dx = Math.Abs((w / 2) - x); 149 double dx = Math.Abs((w/2) - x);
149 double dy = Math.Abs((h / 2) - y); 150 double dy = Math.Abs((h/2) - y);
150 map[x, y] += Math.Sin(dx / wid) + Math.Cos(dy / hig); 151 map[x, y] += Math.Sin(dx/wid) + Math.Cos(dy/hig);
151 } 152 }
152 } 153 }
153 Normalise(); 154 Normalise();
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs
index e2f9560..0159b87 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs
@@ -28,7 +28,6 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32 31
33namespace libTerrain 32namespace libTerrain
34{ 33{
@@ -57,8 +56,8 @@ namespace libTerrain
57 { 56 {
58 for (i = 0; i < pointsPerBlock; i++) 57 for (i = 0; i < pointsPerBlock; i++)
59 { 58 {
60 double pX = x + (generator.NextDouble() * (double)blockSize); 59 double pX = x + (generator.NextDouble()*(double) blockSize);
61 double pY = y + (generator.NextDouble() * (double)blockSize); 60 double pY = y + (generator.NextDouble()*(double) blockSize);
62 61
63 points.Add(new Point2D(pX, pY)); 62 points.Add(new Point2D(pX, pY));
64 } 63 }
@@ -75,10 +74,10 @@ namespace libTerrain
75 for (i = 0; i < points.Count; i++) 74 for (i = 0; i < points.Count; i++)
76 { 75 {
77 double dx, dy; 76 double dx, dy;
78 dx = Math.Abs((double)x - points[i].x); 77 dx = Math.Abs((double) x - points[i].x);
79 dy = Math.Abs((double)y - points[i].y); 78 dy = Math.Abs((double) y - points[i].y);
80 79
81 distances[i] = (dx * dx + dy * dy); 80 distances[i] = (dx*dx + dy*dy);
82 } 81 }
83 82
84 Array.Sort(distances); 83 Array.Sort(distances);
@@ -92,7 +91,7 @@ namespace libTerrain
92 if (i >= points.Count) 91 if (i >= points.Count)
93 break; 92 break;
94 93
95 f += c[i] * distances[i]; 94 f += c[i]*distances[i];
96 } 95 }
97 96
98 map[x, y] = f; 97 map[x, y] = f;
@@ -119,10 +118,10 @@ namespace libTerrain
119 for (i = 0; i < points.Count; i++) 118 for (i = 0; i < points.Count; i++)
120 { 119 {
121 double dx, dy; 120 double dx, dy;
122 dx = Math.Abs((double)x - points[i].x); 121 dx = Math.Abs((double) x - points[i].x);
123 dy = Math.Abs((double)y - points[i].y); 122 dy = Math.Abs((double) y - points[i].y);
124 123
125 distances[i] = (dx * dx + dy * dy); 124 distances[i] = (dx*dx + dy*dy);
126 } 125 }
127 126
128 Array.Sort(distances); 127 Array.Sort(distances);
@@ -136,7 +135,7 @@ namespace libTerrain
136 if (i >= points.Count) 135 if (i >= points.Count)
137 break; 136 break;
138 137
139 f += c[i] * distances[i]; 138 f += c[i]*distances[i];
140 } 139 }
141 140
142 map[x, y] = f; 141 map[x, y] = f;
@@ -162,8 +161,8 @@ namespace libTerrain
162 { 161 {
163 for (i = 0; i < pointsPerBlock; i++) 162 for (i = 0; i < pointsPerBlock; i++)
164 { 163 {
165 double pX = x + (generator.NextDouble() * (double)blockSize); 164 double pX = x + (generator.NextDouble()*(double) blockSize);
166 double pY = y + (generator.NextDouble() * (double)blockSize); 165 double pY = y + (generator.NextDouble()*(double) blockSize);
167 166
168 points.Add(new Point2D(pX, pY)); 167 points.Add(new Point2D(pX, pY));
169 } 168 }
@@ -180,10 +179,10 @@ namespace libTerrain
180 for (i = 0; i < points.Count; i++) 179 for (i = 0; i < points.Count; i++)
181 { 180 {
182 double dx, dy; 181 double dx, dy;
183 dx = Math.Abs((double)x - points[i].x); 182 dx = Math.Abs((double) x - points[i].x);
184 dy = Math.Abs((double)y - points[i].y); 183 dy = Math.Abs((double) y - points[i].y);
185 184
186 distances[i] = (dx * dx + dy * dy); 185 distances[i] = (dx*dx + dy*dy);
187 } 186 }
188 187
189 //Array.Sort(distances); 188 //Array.Sort(distances);
@@ -191,7 +190,7 @@ namespace libTerrain
191 double f = 0.0; 190 double f = 0.0;
192 191
193 double min = double.MaxValue; 192 double min = double.MaxValue;
194 for (int j = 0; j < distances.Length;j++ ) 193 for (int j = 0; j < distances.Length; j++)
195 { 194 {
196 if (distances[j] < min) 195 if (distances[j] < min)
197 { 196 {
@@ -211,4 +210,4 @@ namespace libTerrain
211 Normalise(); 210 Normalise();
212 } 211 }
213 } 212 }
214} 213} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs
index 788134d..deb2e0e 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace libTerrain 31namespace libTerrain
34{ 32{
@@ -54,18 +52,18 @@ namespace libTerrain
54 double rx, ry; 52 double rx, ry;
55 if (centerspawn) 53 if (centerspawn)
56 { 54 {
57 rx = w / 2.0; 55 rx = w/2.0;
58 ry = h / 2.0; 56 ry = h/2.0;
59 } 57 }
60 else 58 else
61 { 59 {
62 rx = random.NextDouble() * (w - 1); 60 rx = random.NextDouble()*(w - 1);
63 ry = random.NextDouble() * (h - 1); 61 ry = random.NextDouble()*(h - 1);
64 } 62 }
65 for (j = 0; j < rounds; j++) 63 for (j = 0; j < rounds; j++)
66 { 64 {
67 rx += (random.NextDouble() * movement) - (movement / 2.0); 65 rx += (random.NextDouble()*movement) - (movement/2.0);
68 ry += (random.NextDouble() * movement) - (movement / 2.0); 66 ry += (random.NextDouble()*movement) - (movement/2.0);
69 Raise(rx, ry, size, 1.0); 67 Raise(rx, ry, size, 1.0);
70 } 68 }
71 } 69 }