类 MIMath


  • public class MIMath
    extends Object
    MeteoInfo Math class
    作者:
    Yaqiang Wang
    • 构造器详细资料

      • MIMath

        public MIMath()
    • 方法详细资料

      • doubleEquals

        public static boolean doubleEquals​(double a,
                                           double b)
        Determine if two double data equal
        参数:
        a - double a
        b - double b
        返回:
        boolean
      • doubleEquals_Abs

        public static boolean doubleEquals_Abs​(double a,
                                               double b)
        Determine if two double data equal
        参数:
        a - double a
        b - double b
        返回:
        boolean
      • getMinMaxValue

        public static double[] getMinMaxValue​(double[] S,
                                              double unDef)
        Get mininum and maximum values
        参数:
        S - Data array
        unDef - Undefined data
        返回:
        Minimum and Maximum data array
      • getMinMaxValue

        public static double[] getMinMaxValue​(List<Double> S,
                                              double unDef)
        Get mininum and maximum values
        参数:
        S - Data list
        unDef - Undefined data
        返回:
        Minimum and Maximum data array
      • getMinMaxValue

        public static double[] getMinMaxValue​(List S)
        Get mininum and maximum values
        参数:
        S - Data list
        返回:
        Minimum and Maximum data array
      • getMinMaxInt

        public static int[] getMinMaxInt​(List S)
        Get mininum and maximum values
        参数:
        S - Data list
        返回:
        Minimum and Maximum data array
      • isNumeric

        public static boolean isNumeric​(String strNumber)
        Determine if a string is digital
        参数:
        strNumber - the string
        返回:
        Boolean
      • isNaN

        public static boolean isNaN​(Object o)
        Check whether an object is NaN - only valid for double and float object
        参数:
        o - The object
        返回:
        Whether is NaN
      • isNullOrNaN

        public static boolean isNullOrNaN​(Object o)
        Check whether an object is null or NaN - only valid for double and float object
        参数:
        o - The object
        返回:
        Whether is null or NaN
      • getPointFsExtent

        public static Extent getPointFsExtent​(PointF[] PList)
        Get extent from PointF array
        参数:
        PList - PointF array
        返回:
        The extent
      • getPointFsExtent

        public static Extent getPointFsExtent​(List<PointF> PList)
        Get extent from PointF list
        参数:
        PList - PointF list
        返回:
        The extent
      • mean

        public static double mean​(List<Double> aDataList)
        Mean funtion
        参数:
        aDataList - The data list
        返回:
        Mean
      • arrayReverse

        public static void arrayReverse​(PointD[] points)
        Array reverse
        参数:
        points - PointD array
      • arrayReverse

        public static void arrayReverse​(double[] values)
        Array reverse
        参数:
        values - Double array
      • arrayReverse

        public static void arrayReverse​(Object[] values)
        Array reverse
        参数:
        values - Object array
      • arrayMinMax

        public static double[] arrayMinMax​(double[] values)
        Get min, max of an array
        参数:
        values - array
        返回:
        Min, max
      • arrayMinMax

        public static double[] arrayMinMax​(Double[] values)
        Get min, max of an array
        参数:
        values - array
        返回:
        Min, max
      • getCrossPoint

        public static PointF getCrossPoint​(PointF aP1,
                                           PointF aP2,
                                           PointF bP1,
                                           PointF bP2)
        Get cross point of two line segments
        参数:
        aP1 - point 1 of line a
        aP2 - point 2 of line a
        bP1 - point 1 of line b
        bP2 - point 2 of line b
        返回:
        cross point
      • shiftExtentLon

        public static Extent shiftExtentLon​(Extent aET,
                                            double lonShift)
        Shift extent with longitude
        参数:
        aET - Input extent
        lonShift - Longitude shift
        返回:
        Output extent
      • getLagerExtent

        public static Extent getLagerExtent​(Extent aET,
                                            Extent bET)
        Get maximum extent from two extent
        参数:
        aET - Extent a
        bET - Extent b
        返回:
        Maximum extent
      • getSmallerExtent

        public static Extent getSmallerExtent​(Extent aET,
                                              Extent bET)
        Get Minimum extent from two extent
        参数:
        aET - Extent a
        bET - Extent b
        返回:
        Minimum extent
      • isExtentCross

        public static Boolean isExtentCross​(Extent aET,
                                            Extent bET)
        Determine if two extent cross each other
        参数:
        aET - Extent
        bET - Extent
        返回:
        Boolean
      • pointInExtent

        public static boolean pointInExtent​(PointD aP,
                                            Extent aET)
        Determine if a point is in an Extent
        参数:
        aP - The point
        aET - The extent
        返回:
        Boolean
      • pointInExtent

        public static boolean pointInExtent​(PointF aP,
                                            Extent aET)
        Determine if a point is in an Extent
        参数:
        aP - The point
        aET - The extent
        返回:
        Boolean
      • pointInRectangle

        public static boolean pointInRectangle​(PointF aP,
                                               Rectangle aRect)
        Determine if a point is in a rectangel
        参数:
        aP - The point
        aRect - The rectangel
        返回:
        Boolean
      • pointInRectangle

        public static boolean pointInRectangle​(Point aP,
                                               Rectangle aRect)
        Determine if a point is in a rectangel
        参数:
        aP - The point
        aRect - The rectangel
        返回:
        Boolean
      • pointInRectangle

        public static boolean pointInRectangle​(PointD aP,
                                               Rectangle aRect)
        Determine if a point is in a rectangel
        参数:
        aP - The point
        aRect - The rectangel
        返回:
        Boolean
      • isInclude

        public static boolean isInclude​(Rectangle aRect,
                                        Rectangle bRect)
        Judge if a rectangle include another
        参数:
        aRect - a rectangle
        bRect - b rectangle
        返回:
        Boolean
      • calEllipseCoordByAngle

        public static PointF calEllipseCoordByAngle​(double x0,
                                                    double y0,
                                                    double a,
                                                    double b,
                                                    double angle)
        Calculate ellipse coordinate by angle
        参数:
        x0 - Center x
        y0 - Center y
        a - Major semi axis
        b - Minor semi axis
        angle - Angle
        返回:
        Coordinate
      • getDecimalNum

        public static int getDecimalNum​(double aData)
        Get decimal number of a double data for ToString() format
        参数:
        aData - Data
        返回:
        Decimal number
      • getDecimalNum_back

        public static int getDecimalNum_back​(double aData)
        Get decimal number of a double data for ToString() format
        参数:
        aData - Data
        返回:
        Decimal number
      • lonDistance

        public static float lonDistance​(float lon1,
                                        float lon2)
        Longitude distance
        参数:
        lon1 - Longitude 1
        lon2 - Longitude 2
        返回:
        Longitude distance
      • lonAdd

        public static float lonAdd​(float lon1,
                                   float delta)
        Add longitude
        参数:
        lon1 - Longitude 1
        delta - Delta
        返回:
        Longitude
      • getValue

        public static double getValue​(double[] data,
                                      float idx)
        Get value from one dimension double array by index
        参数:
        data - Data
        idx - Index
        返回:
        Value
      • getIntervalValues

        public static double[] getIntervalValues​(double min,
                                                 double max,
                                                 double interval)
        Create values by interval
        参数:
        min - Miminum value
        max - Maximum value
        interval - Interval value
        返回:
        Value array
      • getIntervalValues

        public static double[] getIntervalValues​(double min,
                                                 double max,
                                                 double interval,
                                                 int n)
        Create values by interval
        参数:
        min - Miminum value
        max - Maximum value
        interval - Interval value
        n - Value number
        返回:
        Value array
      • getIntervalValues

        public static double[] getIntervalValues​(double min,
                                                 double max,
                                                 double interval,
                                                 int n,
                                                 boolean isExtend)
        Create values by interval
        参数:
        min - Minimum value
        max - Maximum value
        interval - Interval value
        n - Value number
        isExtend - Extend values or not
        返回:
        Value array
      • getIntervalValues

        public static double[] getIntervalValues​(double min,
                                                 double max,
                                                 int n)
        Get interval values
        参数:
        min - Minimum value
        max - Maximum value
        n - Level number
        返回:
        Values
      • getIntervalValues

        public static double[] getIntervalValues​(double min,
                                                 double max,
                                                 int n,
                                                 boolean isExtend)
        Get interval values
        参数:
        min - Minimum value
        max - Maximum value
        n - Level number
        isExtend - Extend values or not
        返回:
        Values
      • getIntervalValues

        public static double[] getIntervalValues​(double min,
                                                 double max)
        Create contour values by minimum and maximum values
        参数:
        min - Minimum value
        max - Maximum value
        返回:
        Contour values
      • getIntervalValues1

        public static List<Object> getIntervalValues1​(double min,
                                                      double max)
        Create contour values by minimum and maximum values
        参数:
        min - Minimum value
        max - Maximum value
        返回:
        Contour values
      • getIntervalValuesAxis

        public static List<Object> getIntervalValuesAxis​(double min,
                                                         double max)
        Create contour values by minimum and maximum values
        参数:
        min - Minimum value
        max - Maximum value
        返回:
        Contour values
      • getIntervalValuesAxis

        public static List<Object> getIntervalValuesAxis​(double min,
                                                         double max,
                                                         boolean isExtend)
        Create contour values by minimum and maximum values
        参数:
        min - Minimum value
        max - Maximum value
        isExtend - If extend values
        返回:
        Contour values
      • getIntervalValues

        public static List<Object> getIntervalValues​(double min,
                                                     double max,
                                                     boolean isExtend)
        Create contour values by minimum and maximum values
        参数:
        min - Minimum value
        max - Maximum value
        isExtend - If extend values
        返回:
        Contour values
      • getIntervalValues_Log

        public static double[] getIntervalValues_Log​(double min,
                                                     double max)
        Create log interval values by minimum and maximum values
        参数:
        min - Minimum value
        max - Maximum value
        返回:
        Interval values
      • getIntervalValues_Log_bak

        public static double[] getIntervalValues_Log_bak​(double min,
                                                         double max)
        Create log interval values by minimum and maximum values
        参数:
        min - Minimum value
        max - Maximum value
        返回:
        Interval values
      • cartesianToPolar

        public static double[] cartesianToPolar​(double x,
                                                double y)
        Convert cartesian to polar coordinate
        参数:
        x - X
        y - Y
        返回:
        Angle and radius
      • polarToCartesian

        public static double[] polarToCartesian​(double B,
                                                double r)
        Convert poar to cartesian coordinate
        参数:
        r - Radius
        B - Angle in radians
        返回:
        X and y in cartesian coordinate
      • getDSFromUV

        public static double[] getDSFromUV​(double U,
                                           double V)
        Get wind direction/speed from U/V
        参数:
        U - The U value
        V - The V value
        返回:
        Wind direction/speed array
      • getUVFromDS

        public static double[] getUVFromDS​(double windDir,
                                           double windSpeed)
        Get wind U/V from wind direction/speed
        参数:
        windDir - The wind direction
        windSpeed - The wind speed
        返回:
        Wind U/V
      • getEndPoint

        public static double[] getEndPoint​(double x,
                                           double y,
                                           double angle,
                                           double len)
        Get end point by start point, angle and length
        参数:
        x - Start point x
        y - Start point y
        angle - Angle
        len - Length
        返回:
        End point x/y values;
      • uv2ds

        public static double[] uv2ds​(double u,
                                     double v)
        Get wind direction and wind speed from U/V
        参数:
        u - U component
        v - V component
        返回:
        Wind direction and wind speed
      • ds2uv

        public static double[] ds2uv​(double windDir,
                                     double windSpeed)
        Get wind U/V components from wind direction and speed
        参数:
        windDir - Wind direction
        windSpeed - Wind speed
        返回:
        Wind U/V components