Class DymaxionProjection

java.lang.Object
net.buildtheearth.terraminusminus.projection.dymaxion.DymaxionProjection
All Implemented Interfaces:
GeographicProjection
Direct Known Subclasses:
ConformalDynmaxionProjection

public class DymaxionProjection extends Object implements GeographicProjection
Implementation of the Dynmaxion projection. Also known as Airocean or Fuller projection.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.buildtheearth.terraminusminus.projection.GeographicProjection

    GeographicProjection.Deserializer, GeographicProjection.Serializer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final double
     
    protected static final double[][]
     
    protected static final double[][]
    This contains the Cartesian coordinates the centroid of each face of the icosahedron.
    protected static final double
     
    protected static final double
     
    protected static final double
     
    protected static final int[]
     
    protected static final boolean[]
    Indicates for each face if it needs to be flipped after projecting
    protected static final double[][][]
    Rotation matrices to move the triangles from the reference coordinates to their original positions.
    protected static final int[][]
    Indicates the vertices forming each face of the icosahedron.
    protected static final double
     
    protected static final double[][][]
    Rotation matrices to move the triangles to the reference coordinates from the original positions.
    protected static final double[][]
    This contains the vertices of the icosahedron, identified by their geographic longitude and latitude in degrees.
    protected static final double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double[]
    Indicates the minimum and maximum X and Y coordinates on the projected space.
    protected int
    findTriangle(double[] vector)
    Finds the face of the icosahedron on which to project a point.
    protected static int
    findTriangleGrid(double x, double y)
     
    double[]
    fromGeo(double longitude, double latitude)
    Converts geographic coordinates to map coordinates
    protected double[]
    inverseTriangleTransform(double x, double y)
     
    protected double[]
    inverseTriangleTransformNewton(double xpp, double ypp)
     
    double
    Gives an estimation of the scale of this projection.
    double[]
    toGeo(double x, double y)
    Converts map coordinates to geographic coordinates
     
    protected double[]
    triangleTransform(double[] vec)
     
    boolean
    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).
    protected static double[]
    yRot(double[] spherical, double rot)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.buildtheearth.terraminusminus.projection.GeographicProjection

    azimuth, azimuth, properties, tissot, tissot, vector
  • Field Details

    • ARC

      protected static final double ARC
    • Z

      protected static final double Z
    • EL

      protected static final double EL
    • EL6

      protected static final double EL6
    • DVE

      protected static final double DVE
    • R

      protected static final double R
    • VERTICES

      protected static final double[][] VERTICES
      This contains the vertices of the icosahedron, identified by their geographic longitude and latitude in degrees. When the class is loaded, a static block below converts all these coordinates to the equivalent spherical coordinates (longitude and colatitude), in radians.
      See Also:
    • ISO

      protected static final int[][] ISO
      Indicates the vertices forming each face of the icosahedron. Each entry refers to the index of a vertex in VERTICES
    • CENTER_MAP

      protected static final double[][] CENTER_MAP
    • FLIP_TRIANGLE

      protected static final boolean[] FLIP_TRIANGLE
      Indicates for each face if it needs to be flipped after projecting
    • CENTROIDS

      protected static final double[][] CENTROIDS
      This contains the Cartesian coordinates the centroid of each face of the icosahedron.
    • ROTATION_MATRICES

      protected static final double[][][] ROTATION_MATRICES
      Rotation matrices to move the triangles to the reference coordinates from the original positions. Indexed by the face's indices.
    • INVERSE_ROTATION_MATRICES

      protected static final double[][][] INVERSE_ROTATION_MATRICES
      Rotation matrices to move the triangles from the reference coordinates to their original positions. Indexed by the face's indices.
    • FACE_ON_GRID

      protected static final int[] FACE_ON_GRID
  • Constructor Details

    • DymaxionProjection

      public DymaxionProjection()
  • Method Details

    • findTriangleGrid

      protected static int findTriangleGrid(double x, double y)
    • yRot

      protected static double[] yRot(double[] spherical, double rot)
    • findTriangle

      protected int findTriangle(double[] vector)
      Finds the face of the icosahedron on which to project a point. In practice, it works by finding the face with the closest centroid to the point.
      Parameters:
      vector - - position vector as double array of length 3, using Cartesian coordinates
      Returns:
      an integer identifying the face on which to project the point
    • triangleTransform

      protected double[] triangleTransform(double[] vec)
    • inverseTriangleTransformNewton

      protected double[] inverseTriangleTransformNewton(double xpp, double ypp)
    • inverseTriangleTransform

      protected double[] inverseTriangleTransform(double x, double y)
    • 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
    • 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
    • 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}
    • 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
    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object