Example #1
0
    private boolean detectHit(float[] mc) {

      if ((mc[0] < 0 && coords[0] < 0)
          || (mc[0] > 0 && coords[0] > 0) && (mc[1] < 0 && coords[1] < 0)
          || (mc[1] > 0 && coords[1] > 0) && (mc[2] < 0 && coords[2] < 0)
          || (mc[2] > 0 && coords[2] > 0)) {

        double dx = Math.pow((mc[0] + 100) - (coords[0] + 100), 2);
        double dy = Math.pow((mc[1] + 100) - (coords[1] + 100), 2);
        double dz = Math.pow((mc[2] + 100) - (coords[2] + 100), 2);
        double vLength = Math.sqrt(dx + dy + dz);

        if ((vLength) < (size + 0.05)) {
          return true;
        }
      }

      return false;
    }
Example #2
0
 /*
  * Bezier : Computes Bernstain
  *
  * @param {Integer} i - the i-th index
  *
  * @param {Integer} n - the total number of points
  *
  * @param {Number} t - the value of parameter t , between 0 and 1
  */
 private float B(int i, int n, float t) {
   return (float) (fact(n) / (fact(i) * fact(n - i)) * Math.pow(t, i) * Math.pow(1 - t, n - i));
 }
Example #3
0
 public void resize(float[] mc) {
   double dx = Math.pow((mc[0] + 100) - (coords[0] + 100), 2);
   double dy = Math.pow((mc[1] + 100) - (coords[1] + 100), 2);
   double dz = Math.pow((mc[2] + 100) - (coords[2] + 100), 2);
   size = Math.sqrt(dx + dy + dz);
 }