 Timestamp:
 08/10/07 11:48:48 (13 years ago)
 Location:
 trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/loci/visbio/data/ArbitrarySlice.java
r3070 r3075 352 352 // generate planar domain samples and corresponding interpolated values 353 353 int res1 = res  1; 354 float[][][] fieldSamples = new float[fields.length][][]; //TEMP355 354 float[][] planeSamples = new float[3][res * res]; 356 355 float[][] planeValues = new float[range.length][res * res]; … … 366 365 float cc = (float) c / res1; 367 366 int ndx = r * res + c; 368 //float xs = planeSamples[0][ndx] = (1  cc) * xmin + cc * xmax;369 367 float xs = planeSamples[0][ndx] = (1  cc) * xmin + cc * xmax; 370 368 float ys = planeSamples[1][ndx] = (1  cc) * ymin + cc * ymax; … … 383 381 int xx = (int) xs, yy = (int) ys, zz = (int) zs; 384 382 float wx = xs  xx, wy = ys  yy, wz = zs  zz; 385 float[][] values0 = null, values1 = null; 386 FlatField field0, field1; 387 if (wz == 0) { 388 // interpolate from a single field (z0 == z1) 389 try { 390 if (fieldSamples[zz] == null) { //TEMP 391 fieldSamples[zz] = fields[zz].getFloats(false); //TEMP 392 } //TEMP 393 values0 = values1 = fieldSamples[zz]; 394 } 395 catch (VisADException exc) { exc.printStackTrace(); } 396 } 397 else { 398 // interpolate between two fields 399 try { 400 if (fieldSamples[zz] == null) { //TEMP 401 fieldSamples[zz] = fields[zz].getFloats(false); //TEMP 402 } //TEMP 403 if (fieldSamples[zz + 1] == null) { //TEMP 404 fieldSamples[zz + 1] = fields[zz + 1].getFloats(false); //TEMP 405 } //TEMP 406 values0 = fieldSamples[zz]; 407 values1 = fieldSamples[zz + 1]; 408 } 409 catch (VisADException exc) { exc.printStackTrace(); } 410 } 383 411 384 int ndx00 = w * yy + xx; 412 385 int ndx10 = w * yy + xx + 1; 413 386 int ndx01 = w * (yy + 1) + xx; 414 387 int ndx11 = w * (yy + 1) + xx + 1; 388 389 FlatField field0, field1; 390 if (wz == 0) { 391 // interpolate from a single field (z0 == z1) 392 field0 = field1 = fields[zz]; 393 } 394 else { 395 // interpolate between two fields 396 field0 = fields[zz]; 397 field1 = fields[zz + 1]; 398 } 399 400 double[] v000 = null, v100 = null, v010 = null, v110 = null; 401 double[] v001 = null, v101 = null, v011 = null, v111 = null; 402 try { 403 v000 = ((RealTuple) field0.getSample(ndx00)).getValues(); 404 v100 = ((RealTuple) field0.getSample(ndx10)).getValues(); 405 v010 = ((RealTuple) field0.getSample(ndx01)).getValues(); 406 v110 = ((RealTuple) field0.getSample(ndx11)).getValues(); 407 v001 = ((RealTuple) field1.getSample(ndx00)).getValues(); 408 v101 = ((RealTuple) field1.getSample(ndx10)).getValues(); 409 v011 = ((RealTuple) field1.getSample(ndx01)).getValues(); 410 v111 = ((RealTuple) field1.getSample(ndx11)).getValues(); 411 } 412 catch (VisADException exc) { exc.printStackTrace(); } 413 catch (RemoteException exc) { exc.printStackTrace(); } 414 415 415 for (int k=0; k<range.length; k++) { 416 416 // trilinear interpolation (x, then y, then z) 417 float v000 = values0[k][ndx00]; 418 float v100 = values0[k][ndx10]; 419 float v010 = values0[k][ndx01]; 420 float v110 = values0[k][ndx11]; 421 float v001 = values1[k][ndx00]; 422 float v101 = values1[k][ndx10]; 423 float v011 = values1[k][ndx01]; 424 float v111 = values1[k][ndx11]; 425 float vx00 = (1  wx) * v000 + wx * v100; 426 float vx10 = (1  wx) * v010 + wx * v110; 427 float vx01 = (1  wx) * v001 + wx * v101; 428 float vx11 = (1  wx) * v011 + wx * v111; 417 float vx00 = (float) ((1  wx) * v000[k] + wx * v100[k]); 418 float vx10 = (float) ((1  wx) * v010[k] + wx * v110[k]); 419 float vx01 = (float) ((1  wx) * v001[k] + wx * v101[k]); 420 float vx11 = (float) ((1  wx) * v011[k] + wx * v111[k]); 429 421 float vxy0 = (1  wy) * vx00 + wy * vx10; 430 422 float vxy1 = (1  wy) * vx01 + wy * vx11;
Note: See TracChangeset
for help on using the changeset viewer.