diff options
author | lbsa71 | 2007-10-30 09:05:31 +0000 |
---|---|---|
committer | lbsa71 | 2007-10-30 09:05:31 +0000 |
commit | 67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch) | |
tree | 20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs | |
parent | * Deleted .user file (diff) | |
download | opensim-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/Voronoi.cs')
-rw-r--r-- | OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs | 35 |
1 files changed, 17 insertions, 18 deletions
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 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | 31 | ||
33 | namespace libTerrain | 32 | namespace 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 |