Class ProjectionTools

java.lang.Object
squidpony.squidgrid.mapping.ProjectionTools

public class ProjectionTools
extends Object
Added to SquidLib by Tommy Ettinger on 7/4/2018, using MIT-licensed work by Justin Kunimune from his Map-Projections repo.
Author:
jkunimune, Tommy Ettinger
  • Constructor Summary

    Constructors 
    Constructor Description
    ProjectionTools()  
  • Method Summary

    Modifier and Type Method Description
    static double 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.
    static double 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.
    static double[] simpsonODESolveHyperellipse​(double T, double[] 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • simpsonIntegrateHyperellipse

      public static double 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 region
      b - 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 double[] simpsonODESolveHyperellipse​(double T, double[] 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.
      Parameters:
      T - 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 greater
      h - The internal step size (must be positive)
      alpha - part of the hyperelliptical projection's parameters
      kappa - part of the hyperelliptical projection's parameters
      epsilon - calculated beforehand using simpsonIntegrateHyperellipse(double, double, double, double)
      Returns:
      y, after modifications
    • hyperellipse

      public static double 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.0
      kappa - one of the Tobler parameters
      Returns:
      I'm guessing the actual y used after hyperelliptical distortion; not sure