[14312] | 1 | Index: ../trunk-jpl/src/android/ISSM/jni/Main.cpp
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/android/ISSM/jni/Main.cpp (revision 14187)
|
---|
| 4 | +++ ../trunk-jpl/src/android/ISSM/jni/Main.cpp (revision 14188)
|
---|
| 5 | @@ -137,13 +137,13 @@
|
---|
| 6 | }
|
---|
| 7 | }
|
---|
| 8 |
|
---|
| 9 | - for(i=0;i<148;i++){
|
---|
| 10 | + /*for(i=0;i<148;i++){
|
---|
| 11 | __android_log_print(ANDROID_LOG_INFO, "Native","%g %g %g | %g %g %g | %g %g %g | %g %g %g\n",
|
---|
| 12 | dBuf[12*i+0],dBuf[12*i+1],dBuf[12*i+2],
|
---|
| 13 | dBuf[12*i+3],dBuf[12*i+4],dBuf[12*i+5],
|
---|
| 14 | dBuf[12*i+6],dBuf[12*i+7],dBuf[12*i+8],
|
---|
| 15 | dBuf[12*i+9],dBuf[12*i+10],dBuf[12*i+11]);
|
---|
| 16 | - }
|
---|
| 17 | + }*/
|
---|
| 18 |
|
---|
| 19 | /*delete temporary data:*/
|
---|
| 20 | delete patch;
|
---|
| 21 | Index: ../trunk-jpl/src/android/ISSM/src/com/example/issm/ColorMap.java
|
---|
| 22 | ===================================================================
|
---|
| 23 | --- ../trunk-jpl/src/android/ISSM/src/com/example/issm/ColorMap.java (revision 14187)
|
---|
| 24 | +++ ../trunk-jpl/src/android/ISSM/src/com/example/issm/ColorMap.java (revision 14188)
|
---|
| 25 | @@ -4,13 +4,14 @@
|
---|
| 26 | class ColorMap
|
---|
| 27 | {
|
---|
| 28 | private double[][] d;
|
---|
| 29 | + final int rowNumber = 64;
|
---|
| 30 | //-------------------------------------------------------
|
---|
| 31 | public ColorMap()
|
---|
| 32 | {
|
---|
| 33 | setDefault();
|
---|
| 34 | }
|
---|
| 35 | //-------------------------------------------------------
|
---|
| 36 | - //set default color map => hsv
|
---|
| 37 | + //set default color map => hsv {{{
|
---|
| 38 | public void setDefault()
|
---|
| 39 | {
|
---|
| 40 | d = new double[][]{
|
---|
| 41 | @@ -79,7 +80,8 @@
|
---|
| 42 | { 1.0, 0.0, 0.1875 },
|
---|
| 43 | { 1.0, 0.0, 0.0938 }
|
---|
| 44 | };
|
---|
| 45 | - }
|
---|
| 46 | + }
|
---|
| 47 | + //}}}
|
---|
| 48 | //-------------------------------------------------------
|
---|
| 49 | public void setAutumn()
|
---|
| 50 | {
|
---|
| 51 | @@ -851,11 +853,46 @@
|
---|
| 52 | };
|
---|
| 53 | }
|
---|
| 54 | //-------------------------------------------------------
|
---|
| 55 | - public void getRGB(int index, RGB rgb)
|
---|
| 56 | + public void getRGB(double alpha, RGB rgb)
|
---|
| 57 | {
|
---|
| 58 | - rgb.setR( (float) d[index][0] );
|
---|
| 59 | - rgb.setG( (float) d[index][1] );
|
---|
| 60 | - rgb.setB( (float) d[index][2] );
|
---|
| 61 | +
|
---|
| 62 | + double d1,d2,d3;
|
---|
| 63 | + double d1a,d2a,d3a;
|
---|
| 64 | + double d1b,d2b,d3b;
|
---|
| 65 | + int index1,index2;
|
---|
| 66 | +
|
---|
| 67 | + System.out.println(alpha);
|
---|
| 68 | +
|
---|
| 69 | + if (alpha==0){
|
---|
| 70 | + d1=d[0][0];
|
---|
| 71 | + d2=d[0][1];
|
---|
| 72 | + d3=d[0][2];
|
---|
| 73 | + }
|
---|
| 74 | + else if (alpha==1){
|
---|
| 75 | + d1=d[rowNumber-1][0];
|
---|
| 76 | + d2=d[rowNumber-1][1];
|
---|
| 77 | + d3=d[rowNumber-1][2];
|
---|
| 78 | + }
|
---|
| 79 | + else{
|
---|
| 80 | + index1=(int)(alpha*(rowNumber-1));
|
---|
| 81 | + index2=index1+1;
|
---|
| 82 | +
|
---|
| 83 | + d1a=d[index1][0];
|
---|
| 84 | + d2a=d[index1][1];
|
---|
| 85 | + d3a=d[index1][2];
|
---|
| 86 | +
|
---|
| 87 | + d1b=d[index2][0];
|
---|
| 88 | + d2b=d[index2][1];
|
---|
| 89 | + d3b=d[index2][2];
|
---|
| 90 | +
|
---|
| 91 | + d1=(d1a+d1b)/2;
|
---|
| 92 | + d2=(d2a+d2b)/2;
|
---|
| 93 | + d3=(d3a+d3b)/2;
|
---|
| 94 | + }
|
---|
| 95 | +
|
---|
| 96 | + rgb.setR( (float) d1);
|
---|
| 97 | + rgb.setG( (float) d2);
|
---|
| 98 | + rgb.setB( (float) d3);
|
---|
| 99 | }
|
---|
| 100 | //-------------------------------------------------------
|
---|
| 101 | } // end class colorMap
|
---|
| 102 | @@ -872,4 +909,4 @@
|
---|
| 103 | public float getB() { return B;}
|
---|
| 104 | //-------------------------------------------------------
|
---|
| 105 | } //end class RGB
|
---|
| 106 | -/////////////////////////////////////////////////////////
|
---|
| 107 | \ No newline at end of file
|
---|
| 108 | +/////////////////////////////////////////////////////////
|
---|
| 109 | Index: ../trunk-jpl/src/android/ISSM/src/com/example/issm/MyGLSurfaceView.java
|
---|
| 110 | ===================================================================
|
---|
| 111 | --- ../trunk-jpl/src/android/ISSM/src/com/example/issm/MyGLSurfaceView.java (revision 14187)
|
---|
| 112 | +++ ../trunk-jpl/src/android/ISSM/src/com/example/issm/MyGLSurfaceView.java (revision 14188)
|
---|
| 113 | @@ -13,7 +13,7 @@
|
---|
| 114 | private DoubleBuffer db;
|
---|
| 115 | private int size;
|
---|
| 116 | double vmax = 0, vmin=0;
|
---|
| 117 | - final int rowNumber = 64, firstVelocity = 9;
|
---|
| 118 | + final int firstVelocity = 9;
|
---|
| 119 | ColorMap colorMap;
|
---|
| 120 | public MyGLSurfaceView(Context context, DoubleBuffer db, int size, ColorMap colorMap)
|
---|
| 121 | {
|
---|
| 122 | @@ -32,7 +32,7 @@
|
---|
| 123 | final int MAX_VERTICES = 21;
|
---|
| 124 | float f[][] = new float[size][MAX_VERTICES];
|
---|
| 125 | //indexes prefer to velocity at each vertices of triangles.
|
---|
| 126 | - int index1, index2, index3;
|
---|
| 127 | + double alpha1, alpha2, alpha3;
|
---|
| 128 | final int SCALE_FACTOR = 700000;
|
---|
| 129 | RGB rgb = new RGB();
|
---|
| 130 | for (int i = 0; i < size; i++)
|
---|
| 131 | @@ -51,21 +51,21 @@
|
---|
| 132 | f[i][13] = 1.0f;
|
---|
| 133 | f[i][20] = 1.0f;
|
---|
| 134 |
|
---|
| 135 | - index1 = getRowColor(db.get(12*i+9));
|
---|
| 136 | - index2 = getRowColor(db.get(12*i+10));
|
---|
| 137 | - index3 = getRowColor(db.get(12*i+11));
|
---|
| 138 | + alpha1 = getAlphaColor(db.get(12*i+9));
|
---|
| 139 | + alpha2 = getAlphaColor(db.get(12*i+10));
|
---|
| 140 | + alpha3 = getAlphaColor(db.get(12*i+11));
|
---|
| 141 |
|
---|
| 142 | - colorMap.getRGB(index1, rgb);
|
---|
| 143 | + colorMap.getRGB(alpha1, rgb);
|
---|
| 144 | float r1 = rgb.getR();
|
---|
| 145 | float g1 = rgb.getG();
|
---|
| 146 | float b1 = rgb.getB();
|
---|
| 147 |
|
---|
| 148 | - colorMap.getRGB(index2, rgb);
|
---|
| 149 | + colorMap.getRGB(alpha2, rgb);
|
---|
| 150 | float r2 = rgb.getR();
|
---|
| 151 | float g2 = rgb.getG();
|
---|
| 152 | float b2 = rgb.getB();
|
---|
| 153 |
|
---|
| 154 | - colorMap.getRGB(index3, rgb);
|
---|
| 155 | + colorMap.getRGB(alpha3, rgb);
|
---|
| 156 | float r3 = rgb.getR();
|
---|
| 157 | float g3 = rgb.getG();
|
---|
| 158 | float b3 = rgb.getB();
|
---|
| 159 | @@ -104,11 +104,10 @@
|
---|
| 160 | }
|
---|
| 161 |
|
---|
| 162 | }
|
---|
| 163 | - private int getRowColor(double velocity)
|
---|
| 164 | + private double getAlphaColor(double velocity)
|
---|
| 165 | {
|
---|
| 166 | - double alpha=(vmax-velocity)/(vmax-vmin) ;
|
---|
| 167 | - int row = (int) (alpha * (rowNumber-1));
|
---|
| 168 | - return row;
|
---|
| 169 | + double alpha=(velocity-vmin)/(vmax-vmin) ;
|
---|
| 170 | + return alpha;
|
---|
| 171 | }
|
---|
| 172 |
|
---|
| 173 | private final float TOUCH_SCALE_FACTOR = 180.0f / 320;
|
---|
| 174 | @@ -148,4 +147,4 @@
|
---|
| 175 | mPreviousY = y;
|
---|
| 176 | return true;
|
---|
| 177 | }
|
---|
| 178 | -}
|
---|
| 179 | \ No newline at end of file
|
---|
| 180 | +}
|
---|