Example #1
0
 /**
  * create a random surface
  *
  * @param obj
  * @param x1:surface x begin
  * @param x2:surface x end
  * @param y1:surface y begin
  * @param y2:surface y end
  * @return: the surface mObject
  */
 private mObject createRandomSurface(mObject obj, int x1, int x2, int y1, int y2) {
   int i = 0, j = 0;
   x1 /= 20;
   x2 /= 20;
   y1 /= 20;
   y2 /= 20;
   mPoint3[][] points = new mPoint3[x2 - x1 + 1][y2 - y1 + 1];
   for (i = y1; i <= y2; i++) {
     for (j = x1; j <= x2; j++) {
       points[j - x1][i - y1] =
           new mPoint3(j * 20, i * 20, (float) (Math.random() * 70 * Math.exp(0 - 0.3 * j)));
     }
   }
   return new mSurface(points, x2 - x1 + 1, y2 - y1 + 1);
 }