source: issm/oecreview/Archive/14064-14311/ISSM-14187-14188.diff

Last change on this file was 14312, checked in by Mathieu Morlighem, 12 years ago

Added 14064-14311

File size: 5.2 KB
  • ../trunk-jpl/src/android/ISSM/jni/Main.cpp

     
    137137                        }
    138138                }
    139139
    140                 for(i=0;i<148;i++){
     140                /*for(i=0;i<148;i++){
    141141                __android_log_print(ANDROID_LOG_INFO, "Native","%g %g %g | %g %g %g | %g %g %g | %g %g %g\n",
    142142                                dBuf[12*i+0],dBuf[12*i+1],dBuf[12*i+2],
    143143                                dBuf[12*i+3],dBuf[12*i+4],dBuf[12*i+5],
    144144                                dBuf[12*i+6],dBuf[12*i+7],dBuf[12*i+8],
    145145                                dBuf[12*i+9],dBuf[12*i+10],dBuf[12*i+11]);
    146                 }
     146                }*/
    147147
    148148                /*delete temporary data:*/
    149149                delete patch;
  • ../trunk-jpl/src/android/ISSM/src/com/example/issm/ColorMap.java

     
    44class ColorMap
    55{
    66        private double[][] d;
     7        final int rowNumber = 64;
    78//-------------------------------------------------------
    89        public ColorMap()
    910        {
    1011                setDefault();
    1112        }
    1213//-------------------------------------------------------
    13         //set default color map => hsv
     14        //set default color map => hsv {{{
    1415        public void setDefault()
    1516        {
    1617                d = new double[][]{     
     
    7980                                { 1.0,  0.0,    0.1875 },
    8081                                { 1.0,  0.0,    0.0938 }
    8182                        };
    82         }
     83        }
     84        //}}}
    8385//-------------------------------------------------------
    8486        public void setAutumn()
    8587        {
     
    851853                        };
    852854        }       
    853855//-------------------------------------------------------
    854         public void getRGB(int index, RGB rgb)
     856        public void getRGB(double alpha, RGB rgb)
    855857        {
    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);
    859896        }       
    860897//-------------------------------------------------------
    861898} // end class colorMap
     
    872909        public float getB() { return B;}
    873910//-------------------------------------------------------
    874911} //end class RGB       
    875 /////////////////////////////////////////////////////////
    876  No newline at end of file
     912/////////////////////////////////////////////////////////
  • ../trunk-jpl/src/android/ISSM/src/com/example/issm/MyGLSurfaceView.java

     
    1313        private DoubleBuffer db;
    1414        private int size;
    1515        double vmax = 0, vmin=0;
    16         final int rowNumber = 64, firstVelocity = 9;
     16        final int firstVelocity = 9;
    1717        ColorMap colorMap;
    1818    public MyGLSurfaceView(Context context, DoubleBuffer db, int size, ColorMap colorMap)
    1919    {
     
    3232        final int MAX_VERTICES = 21;
    3333        float f[][] = new float[size][MAX_VERTICES];
    3434        //indexes prefer to velocity at each vertices of triangles.
    35         int index1, index2, index3;
     35        double alpha1, alpha2, alpha3;
    3636        final int SCALE_FACTOR = 700000;
    3737        RGB rgb = new RGB();
    3838                for (int i = 0; i < size; i++)
     
    5151                                f[i][13] = 1.0f;
    5252                                f[i][20] = 1.0f;
    5353                               
    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));
    5757                               
    58                                 colorMap.getRGB(index1, rgb);
     58                                colorMap.getRGB(alpha1, rgb);
    5959                                float r1 = rgb.getR();
    6060                                float g1 = rgb.getG();
    6161                                float b1 = rgb.getB();
    6262                               
    63                                 colorMap.getRGB(index2, rgb);
     63                                colorMap.getRGB(alpha2, rgb);
    6464                                float r2 = rgb.getR();
    6565                                float g2 = rgb.getG();
    6666                                float b2 = rgb.getB();
    6767                               
    68                                 colorMap.getRGB(index3, rgb);
     68                                colorMap.getRGB(alpha3, rgb);
    6969                                float r3 = rgb.getR();
    7070                                float g3 = rgb.getG();
    7171                                float b3 = rgb.getB();
     
    104104        }
    105105       
    106106    } 
    107     private int getRowColor(double velocity)
     107    private double getAlphaColor(double velocity)
    108108    {
    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;
    112111    }
    113112   
    114113    private final float TOUCH_SCALE_FACTOR = 180.0f / 320;
     
    148147        mPreviousY = y;
    149148        return true;
    150149    }
    151 }
    152  No newline at end of file
     150}
Note: See TracBrowser for help on using the repository browser.