Changeset 14188
- Timestamp:
- 12/18/12 10:41:07 (12 years ago)
- Location:
- issm/trunk-jpl/src/android/ISSM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/android/ISSM/jni/Main.cpp
r14109 r14188 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], … … 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:*/ -
issm/trunk-jpl/src/android/ISSM/src/com/example/issm/ColorMap.java
r14168 r14188 5 5 { 6 6 private double[][] d; 7 final int rowNumber = 64; 7 8 //------------------------------------------------------- 8 9 public ColorMap() … … 11 12 } 12 13 //------------------------------------------------------- 13 //set default color map => hsv 14 //set default color map => hsv {{{ 14 15 public void setDefault() 15 16 { … … 80 81 { 1.0, 0.0, 0.0938 } 81 82 }; 82 } 83 } 84 //}}} 83 85 //------------------------------------------------------- 84 86 public void setAutumn() … … 852 854 } 853 855 //------------------------------------------------------- 854 public void getRGB(int index, RGB rgb) 855 { 856 rgb.setR( (float) d[index][0] ); 857 rgb.setG( (float) d[index][1] ); 858 rgb.setB( (float) d[index][2] ); 856 public void getRGB(double alpha, RGB rgb) 857 { 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 //------------------------------------------------------- -
issm/trunk-jpl/src/android/ISSM/src/com/example/issm/MyGLSurfaceView.java
r14168 r14188 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) … … 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(); … … 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(); … … 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
Note:
See TracChangeset
for help on using the changeset viewer.