source:
issm/oecreview/Archive/14064-14311/ISSM-14187-14188.diff@
14312
Last change on this file since 14312 was 14312, checked in by , 12 years ago | |
---|---|
File size: 5.2 KB |
-
../trunk-jpl/src/android/ISSM/jni/Main.cpp
137 137 } 138 138 } 139 139 140 for(i=0;i<148;i++){140 /*for(i=0;i<148;i++){ 141 141 __android_log_print(ANDROID_LOG_INFO, "Native","%g %g %g | %g %g %g | %g %g %g | %g %g %g\n", 142 142 dBuf[12*i+0],dBuf[12*i+1],dBuf[12*i+2], 143 143 dBuf[12*i+3],dBuf[12*i+4],dBuf[12*i+5], 144 144 dBuf[12*i+6],dBuf[12*i+7],dBuf[12*i+8], 145 145 dBuf[12*i+9],dBuf[12*i+10],dBuf[12*i+11]); 146 } 146 }*/ 147 147 148 148 /*delete temporary data:*/ 149 149 delete patch; -
../trunk-jpl/src/android/ISSM/src/com/example/issm/ColorMap.java
4 4 class ColorMap 5 5 { 6 6 private double[][] d; 7 final int rowNumber = 64; 7 8 //------------------------------------------------------- 8 9 public ColorMap() 9 10 { 10 11 setDefault(); 11 12 } 12 13 //------------------------------------------------------- 13 //set default color map => hsv 14 //set default color map => hsv {{{ 14 15 public void setDefault() 15 16 { 16 17 d = new double[][]{ … … 79 80 { 1.0, 0.0, 0.1875 }, 80 81 { 1.0, 0.0, 0.0938 } 81 82 }; 82 } 83 } 84 //}}} 83 85 //------------------------------------------------------- 84 86 public void setAutumn() 85 87 { … … 851 853 }; 852 854 } 853 855 //------------------------------------------------------- 854 public void getRGB( int index, RGB rgb)856 public void getRGB(double alpha, RGB rgb) 855 857 { 856 rgb.setR( (float) d[index][0] ); 857 rgb.setG( (float) d[index][1] ); 858 rgb.setB( (float) d[index][2] ); 858 859 double d1,d2,d3; 860 double d1a,d2a,d3a; 861 double d1b,d2b,d3b; 862 int index1,index2; 863 864 System.out.println(alpha); 865 866 if (alpha==0){ 867 d1=d[0][0]; 868 d2=d[0][1]; 869 d3=d[0][2]; 870 } 871 else if (alpha==1){ 872 d1=d[rowNumber-1][0]; 873 d2=d[rowNumber-1][1]; 874 d3=d[rowNumber-1][2]; 875 } 876 else{ 877 index1=(int)(alpha*(rowNumber-1)); 878 index2=index1+1; 879 880 d1a=d[index1][0]; 881 d2a=d[index1][1]; 882 d3a=d[index1][2]; 883 884 d1b=d[index2][0]; 885 d2b=d[index2][1]; 886 d3b=d[index2][2]; 887 888 d1=(d1a+d1b)/2; 889 d2=(d2a+d2b)/2; 890 d3=(d3a+d3b)/2; 891 } 892 893 rgb.setR( (float) d1); 894 rgb.setG( (float) d2); 895 rgb.setB( (float) d3); 859 896 } 860 897 //------------------------------------------------------- 861 898 } // end class colorMap … … 872 909 public float getB() { return B;} 873 910 //------------------------------------------------------- 874 911 } //end class RGB 875 ///////////////////////////////////////////////////////// 876 No newline at end of file 912 ///////////////////////////////////////////////////////// -
../trunk-jpl/src/android/ISSM/src/com/example/issm/MyGLSurfaceView.java
13 13 private DoubleBuffer db; 14 14 private int size; 15 15 double vmax = 0, vmin=0; 16 final int rowNumber = 64, firstVelocity = 9;16 final int firstVelocity = 9; 17 17 ColorMap colorMap; 18 18 public MyGLSurfaceView(Context context, DoubleBuffer db, int size, ColorMap colorMap) 19 19 { … … 32 32 final int MAX_VERTICES = 21; 33 33 float f[][] = new float[size][MAX_VERTICES]; 34 34 //indexes prefer to velocity at each vertices of triangles. 35 int index1, index2, index3;35 double alpha1, alpha2, alpha3; 36 36 final int SCALE_FACTOR = 700000; 37 37 RGB rgb = new RGB(); 38 38 for (int i = 0; i < size; i++) … … 51 51 f[i][13] = 1.0f; 52 52 f[i][20] = 1.0f; 53 53 54 index1 = getRowColor(db.get(12*i+9));55 index2 = getRowColor(db.get(12*i+10));56 index3 = getRowColor(db.get(12*i+11));54 alpha1 = getAlphaColor(db.get(12*i+9)); 55 alpha2 = getAlphaColor(db.get(12*i+10)); 56 alpha3 = getAlphaColor(db.get(12*i+11)); 57 57 58 colorMap.getRGB( index1, rgb);58 colorMap.getRGB(alpha1, rgb); 59 59 float r1 = rgb.getR(); 60 60 float g1 = rgb.getG(); 61 61 float b1 = rgb.getB(); 62 62 63 colorMap.getRGB( index2, rgb);63 colorMap.getRGB(alpha2, rgb); 64 64 float r2 = rgb.getR(); 65 65 float g2 = rgb.getG(); 66 66 float b2 = rgb.getB(); 67 67 68 colorMap.getRGB( index3, rgb);68 colorMap.getRGB(alpha3, rgb); 69 69 float r3 = rgb.getR(); 70 70 float g3 = rgb.getG(); 71 71 float b3 = rgb.getB(); … … 104 104 } 105 105 106 106 } 107 private int getRowColor(double velocity)107 private double getAlphaColor(double velocity) 108 108 { 109 double alpha=(vmax-velocity)/(vmax-vmin) ; 110 int row = (int) (alpha * (rowNumber-1)); 111 return row; 109 double alpha=(velocity-vmin)/(vmax-vmin) ; 110 return alpha; 112 111 } 113 112 114 113 private final float TOUCH_SCALE_FACTOR = 180.0f / 320; … … 148 147 mPreviousY = y; 149 148 return true; 150 149 } 151 } 152 No newline at end of file 150 }
Note:
See TracBrowser
for help on using the repository browser.