Class AnimationSupport


  • public class AnimationSupport
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double angularRatio​(Angle x, Angle y)
      Calculate the angular ratio between two angles
      static double basicInterpolant​(double interpolant, double startInterpolant, double stopInterpolant, int maxSmoothing)
      Calculate a normalized, smoothed interpolant
      static double clampDouble​(double value, double min, double max)
      Clamps a value between a minimum and maximum
      static long getScaledTimeMillisecs​(double beginZoom, double endZoom, long minTimeMillisecs, long maxTimeMillisecs)
      Calculate a scaled time based on the ratio of the distance between the beginZoom and endZoom distances over the larger of the beginZoom and endZoom.
      static long getScaledTimeMillisecs​(Angle begin, Angle end, Angle max, long minTimeMillisecs, long maxTimeMillisecs)
      Calculate a scaled tiome based on the ratio of the angular distance between the begin and end angles over the max value.
      static long getScaledTimeMillisecs​(LatLon beginLatLon, LatLon endLatLon, long minTimeMillis, long maxTimeMillis)
      Calcualte a scaled time based on the great circle distance between two points.
      static double interpolantNormalized​(double amount, double startAmount, double stopAmount)
      Normalize an interpolant value
      static double interpolantSmoothed​(double interpolant, int smoothingIterations)
      Smooth an interpolant value using hermite smoothing
      static double mixDouble​(double amount, double value1, double value2)
      Calculate the linear interpolation between two values
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AnimationSupport

        public AnimationSupport()
    • Method Detail

      • getScaledTimeMillisecs

        public static long getScaledTimeMillisecs​(LatLon beginLatLon,
                                                  LatLon endLatLon,
                                                  long minTimeMillis,
                                                  long maxTimeMillis)
        Calcualte a scaled time based on the great circle distance between two points. The time is calulated by interpolating between the minLengthMillis and the maxLengthMillis using the ratio of the spherical distance between the given positions over 180 degrees.
        Parameters:
        beginLatLon - The first geographic position
        endLatLon - The second geographio position
        minTimeMillis - The minimum length of tine
        maxTimeMillis - The maximum length of time
        Returns:
        The scaled time in milliseconds.
      • getScaledTimeMillisecs

        public static long getScaledTimeMillisecs​(Angle begin,
                                                  Angle end,
                                                  Angle max,
                                                  long minTimeMillisecs,
                                                  long maxTimeMillisecs)
        Calculate a scaled tiome based on the ratio of the angular distance between the begin and end angles over the max value.
        Parameters:
        begin - the begin angle
        end - the end angle
        max - the maximun number of degrees
        minTimeMillisecs - the minimum length of time
        maxTimeMillisecs - the maximum length of time
        Returns:
        the scaled time in milliseconds
      • getScaledTimeMillisecs

        public static long getScaledTimeMillisecs​(double beginZoom,
                                                  double endZoom,
                                                  long minTimeMillisecs,
                                                  long maxTimeMillisecs)
        Calculate a scaled time based on the ratio of the distance between the beginZoom and endZoom distances over the larger of the beginZoom and endZoom.
        Parameters:
        beginZoom - the begin zoom value
        endZoom - the end zoom value
        minTimeMillisecs - the minimum length of time
        maxTimeMillisecs - the maximum length of time
        Returns:
        the scaled time in milliseconds
      • angularRatio

        public static double angularRatio​(Angle x,
                                          Angle y)
        Calculate the angular ratio between two angles
        Parameters:
        x - The numerator
        y - The denominator
        Returns:
        The angular ratio of x/y
      • mixDouble

        public static double mixDouble​(double amount,
                                       double value1,
                                       double value2)
        Calculate the linear interpolation between two values
        Parameters:
        amount - The interpolant, a number between 0 and 1.
        value1 - The minimum value of the range
        value2 - The maximum value of the range
        Returns:
        the interpolated value
      • clampDouble

        public static double clampDouble​(double value,
                                         double min,
                                         double max)
        Clamps a value between a minimum and maximum
        Parameters:
        value - the value to clamo
        min - the minimum
        max - the maximum
        Returns:
        the clamped value
      • interpolantNormalized

        public static double interpolantNormalized​(double amount,
                                                   double startAmount,
                                                   double stopAmount)
        Normalize an interpolant value
        Parameters:
        amount - The value to normalize
        startAmount - The lower end of the range
        stopAmount - The upper end of the range
        Returns:
        the normalized interpolant
      • interpolantSmoothed

        public static double interpolantSmoothed​(double interpolant,
                                                 int smoothingIterations)
        Smooth an interpolant value using hermite smoothing
        Parameters:
        interpolant - The interpolant
        smoothingIterations - the number of smoothing iterations
        Returns:
        the smoothed interpolant
      • basicInterpolant

        public static double basicInterpolant​(double interpolant,
                                              double startInterpolant,
                                              double stopInterpolant,
                                              int maxSmoothing)
        Calculate a normalized, smoothed interpolant
        Parameters:
        interpolant - the unsmoothed, unnormalized interpolant
        startInterpolant - the lower end of interpolant range
        stopInterpolant - the higher end of the interpolant range
        maxSmoothing - the numver of iterations to smooth.
        Returns:
        the normalized, smoothed interpolant