Class ProjectionTools
java.lang.Object
com.github.yellowstonegames.world.ProjectionTools
Added to SquidLib by Tommy Ettinger on 7/4/2018, using MIT-licensed work by Justin Kunimune from
his Map-Projections repo.
There have been some small changes made. Copied to SquidSquad with the rest of SquidWorld.
-
Method Summary
Modifier and TypeMethodDescriptionstatic floathyperellipse(double y, double kappa) Part of computing a hyperellipse; takes only a y parameter corresponding to the y on a map and a kappa parameter used by Tobler's hyperelliptical projection to determine shape.static floatsimpsonIntegrateHyperellipse(double a, double b, double h, double kappa) Performs a definite integral using Simpson's rule and a constant step size; hard-coded to integrate a hyperellipse function.static voidsimpsonODESolveHyperellipse(double maximum, float[] y, double h, double alpha, double kappa, double epsilon) Solves a simple ODE using Simpson's rule and a constant step size; hard-coded to solve a hyperelliptical map projection task.
-
Method Details
-
simpsonIntegrateHyperellipse
public static float simpsonIntegrateHyperellipse(double a, double b, double h, double kappa) Performs a definite integral using Simpson's rule and a constant step size; hard-coded to integrate a hyperellipse function.- Parameters:
a- The start of the integration regionb- The end of the integration region (must be greater than a)h- The step size (must be positive)kappa- the kappa value of the hyperellipse- Returns:
- some magic stuff needed for Tobler Hyperelliptical maps
-
simpsonODESolveHyperellipse
public static void simpsonODESolveHyperellipse(double maximum, float[] y, double h, double alpha, double kappa, double epsilon) Solves a simple ODE using Simpson's rule and a constant step size; hard-coded to solve a hyperelliptical map projection task. Modifies the float array parameteryin-place.- Parameters:
maximum- The maximum time value at which to sample (must be positive)y- the double array to fill with samples; must not be null and must have length 1 or greaterh- The internal step size (must be positive)alpha- part of the hyperelliptical projection's parameterskappa- part of the hyperelliptical projection's parametersepsilon- calculated beforehand usingsimpsonIntegrateHyperellipse(double, double, double, double)
-
hyperellipse
public static float hyperellipse(double y, double kappa) Part of computing a hyperellipse; takes only a y parameter corresponding to the y on a map and a kappa parameter used by Tobler's hyperelliptical projection to determine shape.- Parameters:
y- y on a map, usually -1.0 to 1.0kappa- one of the Tobler parameters- Returns:
- I'm guessing the actual y used after hyperelliptical distortion; not sure
-