![]() |
|
|||||||
| Development Help Help for building applications or diagnosing problems with WWJ |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Java Developer/Consultant
Join Date: Oct 2007
Location: Austin, Texas
Posts: 118
![]() |
Hi,
I've been looking at the Analytic Surface demo (shown below) and was curious what the motivation was to use 1D arrays for what is essentially a more natural 2D set of data. I imagine it had to do with passing the buffers around in an optimal manner, but I'd be interested to know the full architectural motivation and optimization trade-offs for this for my own edification Thanks! Rob package gov.nasa.worldwind.examples.analytics; class AnalyticSurfaceDemo ... { public static BufferWrapper randomGridValues(int width, int height, double min, double max, int numIterations, double smoothness, BufferFactory factory) { int numValues = width * height; double[] values = new double[numValues]; for (int i = 0; i < numIterations; i++) { double offset = 1d - (i / (double) numIterations); int x1 = (int) Math.round(Math.random() * (width - 1)); int x2 = (int) Math.round(Math.random() * (width - 1)); int y1 = (int) Math.round(Math.random() * (height - 1)); int y2 = (int) Math.round(Math.random() * (height - 1)); int dx1 = x2 - x1; int dy1 = y2 - y1; for (int y = 0; y < height; y++) { int dy2 = y - y1; for (int x = 0; x < width; x++) { int dx2 = x - x1; if ((dx2 * dy1 - dx1 * dy2) >= 0) values[x + y * width] += offset; } } } smoothValues(width, height, values, smoothness); scaleValues(values, numValues, min, max); BufferWrapper buffer = factory.newBuffer(numValues); buffer.putDouble(0, values, 0, numValues); return buffer; } |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Analytic Surface Available | dcollins | Feature Discussion | 0 | 12-01-2009 07:37 PM |
| Rendering Markers on the Surface | jas511 | Development Help | 1 | 11-07-2009 02:51 PM |
| [Solved] Performance problem with the new surface shape | vash | Development Help | 16 | 09-19-2009 08:18 AM |
| Big surface shape problem | Fous31 | Development Help | 3 | 05-19-2009 04:30 PM |
| Snapshot Error | jediwashuu | Bug Reports | 4 | 11-06-2004 03:39 AM |