Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/math/AreaInterpolation.java @ 501:70adafe2b9d5
Speed up the "Horizontalschnitte"
gnv-artifacts/trunk@584 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 20 Jan 2010 14:47:30 +0000 |
parents | 4080b57dcb52 |
children | d9d933e06875 |
comparison
equal
deleted
inserted
replaced
500:ca5162aa644d | 501:70adafe2b9d5 |
---|---|
75 if (gridEnvelope.contains(points.get(i))) { | 75 if (gridEnvelope.contains(points.get(i))) { |
76 relevantPoints.add(points.get(i)); | 76 relevantPoints.add(points.get(i)); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 double [] buffer = Interpolation2D.calculateBuffer(relevantPoints); | 80 double [] buffer = Interpolation2D |
81 .calculateBufferRemoveOutlier(relevantPoints); | |
81 double dxMax = buffer[0]; | 82 double dxMax = buffer[0]; |
82 double dyMax = buffer[1]; | 83 double dyMax = buffer[1]; |
83 | 84 |
84 Quadtree spatialIndex = new Quadtree(); | 85 Quadtree spatialIndex = new Quadtree(); |
85 | 86 |
108 double [] raster = new double[W*H]; | 109 double [] raster = new double[W*H]; |
109 Arrays.fill(raster, Double.NaN); | 110 Arrays.fill(raster, Double.NaN); |
110 | 111 |
111 double minX = boundingBox.getMinX(); | 112 double minX = boundingBox.getMinX(); |
112 double minY = boundingBox.getMinY(); | 113 double minY = boundingBox.getMinY(); |
114 | |
115 long startTime = System.currentTimeMillis(); | |
113 | 116 |
114 int row = 0; | 117 int row = 0; |
115 for (int j = 0; j < H; ++j, row += W) { | 118 for (int j = 0; j < H; ++j, row += W) { |
116 double y = j*cellHeight + 0.5d*cellHeight + minY; | 119 double y = j*cellHeight + 0.5d*cellHeight + minY; |
117 double x = 0.5d*cellWidth + minX; | 120 double x = 0.5d*cellWidth + minX; |
175 center.y); | 178 center.y); |
176 } | 179 } |
177 } | 180 } |
178 } | 181 } |
179 | 182 |
183 long stopTime = System.currentTimeMillis(); | |
184 | |
185 if (debug) { | |
186 log.debug("interpolation took: " + (stopTime - startTime)/1000f + " secs"); | |
187 } | |
188 | |
180 this.raster = raster; | 189 this.raster = raster; |
181 this.width = W; | 190 this.width = W; |
182 this.height = H; | 191 this.height = H; |
183 | 192 |
184 return true; | 193 return true; |