List of usage examples for org.apache.commons.math.util FastMath acos
public static double acos(double x)
From source file:org.esa.nest.gpf.ALOSDeskewingOp.java
private boolean getLook(final stateVector v, final double slant, final double yaw, final double[] plook) { final GeoCoding geoCoding = sourceProduct.getGeoCoding(); if (geoCoding == null) { throw new OperatorException("GeoCoding is null"); }/*w w w.j a va 2 s.c o m*/ final GeoPos geoPos = geoCoding.getGeoPos(new PixelPos(0, 0), null); final double earthRadius = computeEarthRadius(geoPos); final double ht = Math.sqrt(v.xPos * v.xPos + v.yPos * v.yPos + v.zPos * v.zPos); double look = FastMath.acos((ht * ht + slant * slant - earthRadius * earthRadius) / (2.0 * slant * ht)); for (int iter = 0; iter < 100; iter++) { double delta_range = slant - calcRange(v, look, yaw); if (Math.abs(delta_range) < 0.1) { plook[0] = look; return true; } else { double sininc = (ht / earthRadius) * FastMath.sin(look); double taninc = sininc / Math.sqrt(1 - sininc * sininc); look += delta_range / (slant * taninc); } } return false; }
From source file:org.esa.nest.gpf.SARSimulationOp.java
/** * Compute elevation angle (in degree)./* www .j a va 2s.co m*/ * @param slantRange The slant range. * @param earthPoint The coordinate for target on earth surface. * @param sensorPos The coordinate for satellite position. * @return The elevation angle in degree. */ private static double computeElevationAngle(final double slantRange, final double[] earthPoint, final double[] sensorPos) { final double H2 = sensorPos[0] * sensorPos[0] + sensorPos[1] * sensorPos[1] + sensorPos[2] * sensorPos[2]; final double R2 = earthPoint[0] * earthPoint[0] + earthPoint[1] * earthPoint[1] + earthPoint[2] * earthPoint[2]; return FastMath.acos((slantRange * slantRange + H2 - R2) / (2 * slantRange * Math.sqrt(H2))) * org.esa.beam.util.math.MathUtils.RTOD; }