/** * Computes the value for the given interpolant. * * @param interpolant the interpolant to use for interpolating * @param start the lower end of the interpolated range. * @param end the upper end of the interpolated range. * @return the interpolated value. */ protected double nextDouble(double interpolant, double start, double end) { double elevation = AnimationSupport.mixDouble( interpolant, start, end); // Check the altitude mode. If the altitude mode depends on the surface elevation we will reevaluate the // end position altitude. When the animation starts we may not have accurate elevation data available for // the end position, so recalculating the elevation as we go ensures that the animation will end at the // correct altitude. double endElevation = 0.0; bool overrideEndElevation = false; if (this.globe != null && this.altitudeMode == WorldWind.CLAMP_TO_GROUND) { overrideEndElevation = true; endElevation = this.globe.getElevation(endLatLon.getLatitude(), endLatLon.getLongitude()); } else if (this.globe != null && this.altitudeMode == WorldWind.RELATIVE_TO_GROUND) { overrideEndElevation = true; endElevation = this.globe.getElevation(endLatLon.getLatitude(), endLatLon.getLongitude()) + end; } if (overrideEndElevation) { elevation = (1 - interpolant) * start + interpolant * endElevation; } return(elevation); }
protected static double computeMidZoom( Globe globe, LatLon beginLatLon, LatLon endLatLon, double beginZoom, double endZoom) { // Scale factor is angular distance over 180 degrees. Angle sphericalDistance = LatLon.greatCircleDistance(beginLatLon, endLatLon); double scaleFactor = AnimationSupport.angularRatio(sphericalDistance, Angle.POS180); // Mid-point zoom is interpolated value between minimum and maximum zoom. double MIN_ZOOM = Math.Min(beginZoom, endZoom); double MAX_ZOOM = 3.0 * globe.getRadius(); return(AnimationSupport.mixDouble(scaleFactor, MIN_ZOOM, MAX_ZOOM)); }