private void calculateColors(int pointCount,FloatBuffer pointCloudBuffer){
  float[] points=new float[pointCount * 3];
  pointCloudBuffer.rewind();
  pointCloudBuffer.get(points);
  pointCloudBuffer.rewind();
  int color;
  int colorIndex;
  float z;
  for (int i=0; i < pointCount; i++) {
    z=points[i * 3 + 2];
    colorIndex=(int)Math.min(z / CLOUD_MAX_Z * mPalette.length,mPalette.length - 1);
    colorIndex=Math.max(colorIndex,0);
    color=mPalette[colorIndex];
    mColorArray[i * 4]=Color.red(color) / 255f;
    mColorArray[i * 4 + 1]=Color.green(color) / 255f;
    mColorArray[i * 4 + 2]=Color.blue(color) / 255f;
    mColorArray[i * 4 + 3]=Color.alpha(color) / 255f;
  }
}

private void calculateColors ( int pointCount , FloatBuffer pointCloudBuffer ) { float [ ] points = new float [ pointCount * 3 ] ; pointCloudBuffer . rewind ( ) ; pointCloudBuffer . get ( points ) ; pointCloudBuffer . rewind ( ) ; int color ; int colorIndex ; float z ; for ( int i = 0 ; i < pointCount ; i ++ ) { z = points [ i * 3 + 2 ] ; colorIndex = ( int ) Math . min ( z / CLOUD_MAX_Z * mPalette . length , mPalette . length - 1 ) ; colorIndex = Math . max ( colorIndex , 0 ) ; color = mPalette [ colorIndex ] ; mColorArray [ i * 4 ] = Color . red ( color ) / 255f ; mColorArray [ i * 4 + 1 ] = Color . green ( color ) / 255f ; mColorArray [ i * 4 + 2 ] = Color . blue ( color ) / 255f ; mColorArray [ i * 4 + 3 ] = Color . alpha ( color ) / 255f ; } }
calculate the right color for each point in the point cloud .
