Class Rotator


  • public final class Rotator
    extends Object
    Class for rotating geographical positions. The rotator makes the given coordinate the origin (0.0, 0.0) of the coordinate system. If the coordinate which shall become the north pole of the new coordinate system is known the latitude value given into the constructor must be changed. Instead of providing directly the latitude value, it must be 90 - latitude.
    Version:
    $Revision$ $Date$
    • Constructor Summary

      Constructors 
      Constructor Description
      Rotator​(double lon, double lat)
      Constructs a new rotation.
      Rotator​(double lon, double lat, double alpha)
      Constructs a new rotation.
      Rotator​(Point2D point)
      Constructs a new rotation.
      Rotator​(Point2D point, double alpha)
      Constructs a new rotation.
    • Constructor Detail

      • Rotator

        public Rotator​(double lon,
                       double lat)
        Constructs a new rotation. In the rotated system, the point defined by the (lon, lat) parameters is located at the origin, i.e. has the geographical coordinates (0, 0).

        The new rotation is composed of a clockwise rotation about the z-axis (which corresponds to S-N direction) and a counter-clockwise rotation about the y-axis (which corresponds to W-E direction).

        Parameters:
        lon - the geographical longitude of the point becoming the new origin.
        lat - the geographical latitude of the point becoming the new origin.
      • Rotator

        public Rotator​(double lon,
                       double lat,
                       double alpha)
        Constructs a new rotation. In the rotated system, the point defined by the (lon, lat) parameters is located at the origin, i.e. has the geographical coordinates (0, 0).

        The new rotation is composed of a clockwise rotation about the z-axis (which corresponds to S-N direction), a counter-clockwise rotation about the y-axis (which corresponds to W-E direction), and a counter clockwise rotation about the x-axis by the angle alpha.

        Parameters:
        lon - the geographical longitude of the point becoming the new origin.
        lat - the geographical latitude of the point becoming the new origin.
        alpha - the rotation angle (degrees) corresponding to the x-axis.
      • Rotator

        public Rotator​(Point2D point)
        Constructs a new rotation. In the rotated system, the point defined by the (lon, lat) parameters is located at the origin, i.e. has the geographical coordinates (0, 0).

        The new rotation is composed of a clockwise rotation about the z-axis (which corresponds to S-N direction) and a counter-clockwise rotation about the y-axis (which corresponds to W-E direction).

        Parameters:
        point - the point becoming the new origin, the x and y components of which define, respectively, the geographical longitude and latitude.
      • Rotator

        public Rotator​(Point2D point,
                       double alpha)
        Constructs a new rotation. In the rotated system, the point defined by the (lon, lat) parameters is located at the origin, i.e. has the geographical coordinates (0, 0).

        The new rotation is composed of a clockwise rotation about the z-axis (which corresponds to S-N direction), a counter-clockwise rotation about the y-axis (which corresponds to W-E direction), and a counter clockwise rotation about the x-axis by the angle alpha.

        Parameters:
        point - the point becoming the new origin, the x and y components of which define, respectively, the geographical longitude and latitude.
        alpha - the rotation angle (degrees) corresponding to the x-axis.
    • Method Detail

      • getLon

        public double getLon()
        Returns the central longitude of rotation.
        Returns:
        the central longitude of rotation.
      • getLat

        public double getLat()
        Returns the central latitude of rotation.
        Returns:
        the central latitude of rotation.
      • getAlpha

        public double getAlpha()
        Returns the x-axis rotation angle.
        Returns:
        the x-axis rotation angle.
      • calculateCenter

        public static Point2D calculateCenter​(double[][] data,
                                              int lonIndex,
                                              int latIndex)
      • transform

        public void transform​(Point2D point)
        Transforms a given geographical point into the rotated coordinate system.
        Parameters:
        point - the point.
      • transform

        public void transform​(double[] lons,
                              double[] lats)
        Transforms a given set of geographical longitudes and latitudes into the rotated coordinate system.
        Parameters:
        lons - the geographical longitudes.
        lats - the geographical latitudes.
      • transformInversely

        public void transformInversely​(Point2D point)
        Transforms a given geographical point back into the unrotated coordinate system.
        Parameters:
        point - the point.
      • transformInversely

        public void transformInversely​(double[] lons,
                                       double[] lats)
        Transforms a given set of geographical longitudes and latitudes back into the unrotated coordinate system.
        Parameters:
        lons - the geographical longitudes.
        lats - the geographical latitudes.