예제 #1
0
 @Override
 public double getRange(double distance, double phi) throws Exception {
   double sc[] = new double[3];
   for (int x_deg = 0; x_deg <= 2; x_deg++) {
     sc[x_deg] = 0;
     double yy = 1;
     for (int y_deg = 0; y_deg <= 2; y_deg++, yy *= distance)
       sc[x_deg] += c[x_deg][y_deg] * distance;
   }
   double R = Double.POSITIVE_INFINITY;
   for (double x : ParabolicSurface.findRoots(sc[2], sc[1] - Math.tan(phi), sc[0]))
     R = Math.min(R, Math.abs(x / Math.cos(phi)));
   return R;
 }