Index: ../trunk-jpl/src/android/ISSM/jni/Main.cpp =================================================================== --- ../trunk-jpl/src/android/ISSM/jni/Main.cpp (revision 14187) +++ ../trunk-jpl/src/android/ISSM/jni/Main.cpp (revision 14188) @@ -137,13 +137,13 @@ } } - for(i=0;i<148;i++){ + /*for(i=0;i<148;i++){ __android_log_print(ANDROID_LOG_INFO, "Native","%g %g %g | %g %g %g | %g %g %g | %g %g %g\n", dBuf[12*i+0],dBuf[12*i+1],dBuf[12*i+2], dBuf[12*i+3],dBuf[12*i+4],dBuf[12*i+5], dBuf[12*i+6],dBuf[12*i+7],dBuf[12*i+8], dBuf[12*i+9],dBuf[12*i+10],dBuf[12*i+11]); - } + }*/ /*delete temporary data:*/ delete patch; Index: ../trunk-jpl/src/android/ISSM/src/com/example/issm/ColorMap.java =================================================================== --- ../trunk-jpl/src/android/ISSM/src/com/example/issm/ColorMap.java (revision 14187) +++ ../trunk-jpl/src/android/ISSM/src/com/example/issm/ColorMap.java (revision 14188) @@ -4,13 +4,14 @@ class ColorMap { private double[][] d; + final int rowNumber = 64; //------------------------------------------------------- public ColorMap() { setDefault(); } //------------------------------------------------------- - //set default color map => hsv + //set default color map => hsv {{{ public void setDefault() { d = new double[][]{ @@ -79,7 +80,8 @@ { 1.0, 0.0, 0.1875 }, { 1.0, 0.0, 0.0938 } }; - } + } + //}}} //------------------------------------------------------- public void setAutumn() { @@ -851,11 +853,46 @@ }; } //------------------------------------------------------- - public void getRGB(int index, RGB rgb) + public void getRGB(double alpha, RGB rgb) { - rgb.setR( (float) d[index][0] ); - rgb.setG( (float) d[index][1] ); - rgb.setB( (float) d[index][2] ); + + double d1,d2,d3; + double d1a,d2a,d3a; + double d1b,d2b,d3b; + int index1,index2; + + System.out.println(alpha); + + if (alpha==0){ + d1=d[0][0]; + d2=d[0][1]; + d3=d[0][2]; + } + else if (alpha==1){ + d1=d[rowNumber-1][0]; + d2=d[rowNumber-1][1]; + d3=d[rowNumber-1][2]; + } + else{ + index1=(int)(alpha*(rowNumber-1)); + index2=index1+1; + + d1a=d[index1][0]; + d2a=d[index1][1]; + d3a=d[index1][2]; + + d1b=d[index2][0]; + d2b=d[index2][1]; + d3b=d[index2][2]; + + d1=(d1a+d1b)/2; + d2=(d2a+d2b)/2; + d3=(d3a+d3b)/2; + } + + rgb.setR( (float) d1); + rgb.setG( (float) d2); + rgb.setB( (float) d3); } //------------------------------------------------------- } // end class colorMap @@ -872,4 +909,4 @@ public float getB() { return B;} //------------------------------------------------------- } //end class RGB -///////////////////////////////////////////////////////// \ No newline at end of file +///////////////////////////////////////////////////////// Index: ../trunk-jpl/src/android/ISSM/src/com/example/issm/MyGLSurfaceView.java =================================================================== --- ../trunk-jpl/src/android/ISSM/src/com/example/issm/MyGLSurfaceView.java (revision 14187) +++ ../trunk-jpl/src/android/ISSM/src/com/example/issm/MyGLSurfaceView.java (revision 14188) @@ -13,7 +13,7 @@ private DoubleBuffer db; private int size; double vmax = 0, vmin=0; - final int rowNumber = 64, firstVelocity = 9; + final int firstVelocity = 9; ColorMap colorMap; public MyGLSurfaceView(Context context, DoubleBuffer db, int size, ColorMap colorMap) { @@ -32,7 +32,7 @@ final int MAX_VERTICES = 21; float f[][] = new float[size][MAX_VERTICES]; //indexes prefer to velocity at each vertices of triangles. - int index1, index2, index3; + double alpha1, alpha2, alpha3; final int SCALE_FACTOR = 700000; RGB rgb = new RGB(); for (int i = 0; i < size; i++) @@ -51,21 +51,21 @@ f[i][13] = 1.0f; f[i][20] = 1.0f; - index1 = getRowColor(db.get(12*i+9)); - index2 = getRowColor(db.get(12*i+10)); - index3 = getRowColor(db.get(12*i+11)); + alpha1 = getAlphaColor(db.get(12*i+9)); + alpha2 = getAlphaColor(db.get(12*i+10)); + alpha3 = getAlphaColor(db.get(12*i+11)); - colorMap.getRGB(index1, rgb); + colorMap.getRGB(alpha1, rgb); float r1 = rgb.getR(); float g1 = rgb.getG(); float b1 = rgb.getB(); - colorMap.getRGB(index2, rgb); + colorMap.getRGB(alpha2, rgb); float r2 = rgb.getR(); float g2 = rgb.getG(); float b2 = rgb.getB(); - colorMap.getRGB(index3, rgb); + colorMap.getRGB(alpha3, rgb); float r3 = rgb.getR(); float g3 = rgb.getG(); float b3 = rgb.getB(); @@ -104,11 +104,10 @@ } } - private int getRowColor(double velocity) + private double getAlphaColor(double velocity) { - double alpha=(vmax-velocity)/(vmax-vmin) ; - int row = (int) (alpha * (rowNumber-1)); - return row; + double alpha=(velocity-vmin)/(vmax-vmin) ; + return alpha; } private final float TOUCH_SCALE_FACTOR = 180.0f / 320; @@ -148,4 +147,4 @@ mPreviousY = y; return true; } -} \ No newline at end of file +}