Class DymaxionProjection
java.lang.Object
net.buildtheearth.terraminusminus.projection.dymaxion.DymaxionProjection
- All Implemented Interfaces:
GeographicProjection
- Direct Known Subclasses:
ConformalDynmaxionProjection
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
FieldsModifier and TypeFieldDescriptionprotected static final doubleprotected static final double[][]protected static final double[][]This contains the Cartesian coordinates the centroid of each face of the icosahedron.protected static final doubleprotected static final doubleprotected static final doubleprotected static final int[]protected static final boolean[]Indicates for each face if it needs to be flipped after projectingprotected 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 doubleprotected 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 -
Method Summary
Modifier and TypeMethodDescriptiondouble[]bounds()Indicates the minimum and maximum X and Y coordinates on the projected space.protected intfindTriangle(double[] vector) Finds the face of the icosahedron on which to project a point.protected static intfindTriangleGrid(double x, double y) double[]fromGeo(double longitude, double latitude) Converts geographic coordinates to map coordinatesprotected double[]inverseTriangleTransform(double x, double y) protected double[]inverseTriangleTransformNewton(double xpp, double ypp) doubleGives an estimation of the scale of this projection.double[]toGeo(double x, double y) Converts map coordinates to geographic coordinatestoString()protected double[]triangleTransform(double[] vec) booleanupright()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, waitMethods 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[][] VERTICESThis 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[][] ISOIndicates the vertices forming each face of the icosahedron. Each entry refers to the index of a vertex inVERTICES -
CENTER_MAP
protected static final double[][] CENTER_MAP -
FLIP_TRIANGLE
protected static final boolean[] FLIP_TRIANGLEIndicates for each face if it needs to be flipped after projecting -
CENTROIDS
protected static final double[][] CENTROIDSThis contains the Cartesian coordinates the centroid of each face of the icosahedron. -
ROTATION_MATRICES
protected static final double[][][] ROTATION_MATRICESRotation 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_MATRICESRotation 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
Description copied from interface:GeographicProjectionConverts geographic coordinates to map coordinates- Specified by:
fromGeoin interfaceGeographicProjection- Parameters:
longitude- - longitude, in degreeslatitude- - 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
Description copied from interface:GeographicProjectionConverts map coordinates to geographic coordinates- Specified by:
toGeoin interfaceGeographicProjection- Parameters:
x- - x map coordinatey- - 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:GeographicProjectionIndicates the minimum and maximum X and Y coordinates on the projected space.- Specified by:
boundsin interfaceGeographicProjection- Returns:
- {minimum X, minimum Y, maximum X, maximum Y}
-
upright
public boolean upright()Description copied from interface:GeographicProjectionIndicates 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:
uprightin interfaceGeographicProjection- Returns:
- north pole Z <= south pole Z
-
metersPerUnit
public double metersPerUnit()Description copied from interface:GeographicProjectionGives 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:
metersPerUnitin interfaceGeographicProjection- Returns:
- an estimation of the scale of this projection
-
toString
-