Class CenteredMercatorProjection

java.lang.Object
net.buildtheearth.terraminusminus.projection.mercator.CenteredMercatorProjection
All Implemented Interfaces:
GeographicProjection

public class CenteredMercatorProjection extends Object implements GeographicProjection
Implementation of the Mercator projection, normalized between -1 and 1.
See Also:
  • Constructor Details

    • CenteredMercatorProjection

      public CenteredMercatorProjection()
  • Method Details

    • toGeo

      public double[] toGeo(double x, double y) throws OutOfProjectionBoundsException
      Description copied from interface: GeographicProjection
      Converts map coordinates to geographic coordinates
      Specified by:
      toGeo in interface GeographicProjection
      Parameters:
      x - - x map coordinate
      y - - y map coordinate
      Returns:
      {longitude, latitude} in degrees
      Throws:
      OutOfProjectionBoundsException - if the specified point on the projected space cannot be mapped to a point of the geographic space
    • fromGeo

      public double[] fromGeo(double longitude, double latitude) throws OutOfProjectionBoundsException
      Description copied from interface: GeographicProjection
      Converts geographic coordinates to map coordinates
      Specified by:
      fromGeo in interface GeographicProjection
      Parameters:
      longitude - - longitude, in degrees
      latitude - - latitude, in degrees
      Returns:
      {x, y} map coordinates
      Throws:
      OutOfProjectionBoundsException - if the specified point on the geographic space cannot be mapped to a point of the projected space
    • bounds

      public double[] bounds()
      Description copied from interface: GeographicProjection
      Indicates the minimum and maximum X and Y coordinates on the projected space.
      Specified by:
      bounds in interface GeographicProjection
      Returns:
      {minimum X, minimum Y, maximum X, maximum Y}
    • metersPerUnit

      public double metersPerUnit()
      Description copied from interface: GeographicProjection
      Gives an estimation of the scale of this projection. This is just an estimation, as distortion is inevitable when projecting a sphere onto a flat surface, so this value varies from places to places in reality.
      Specified by:
      metersPerUnit in interface GeographicProjection
      Returns:
      an estimation of the scale of this projection
    • upright

      public boolean upright()
      Description copied from interface: GeographicProjection
      Indicates whether or not the north pole is projected to the north of the south pole on the projected space, assuming Minecraft's coordinate system cardinal directions for the projected space (north is negative Z).
      Specified by:
      upright in interface GeographicProjection
      Returns:
      north pole Z <= south pole Z
    • toString

      public String toString()
      Overrides:
      toString in class Object