Package de.fhpotsdam.unfolding.geo

Source Code of de.fhpotsdam.unfolding.geo.MercatorProjection

package de.fhpotsdam.unfolding.geo;

import processing.core.PApplet;
import processing.core.PVector;

public class MercatorProjection extends AbstractProjection {

  public MercatorProjection() {
    super(0);
  }

  public MercatorProjection(float zoom) {
    super(zoom, new Transformation(1, 0, 0, 0, 1, 0));
  }

  public MercatorProjection(float zoom, Transformation transformation) {
    super(zoom, transformation);
 
 
  public PVector rawProject(PVector point) {
    return new PVector(point.x, PApplet.log(PApplet.tan(0.25f * PApplet.PI + 0.5f * point.y)));
  }

  public PVector rawUnproject(PVector point) {
    return new PVector(point.x, 2.0f * PApplet.atan(PApplet.pow((float)Math.E, point.y)) - 0.5f * PApplet.PI);
  }

}
TOP

Related Classes of de.fhpotsdam.unfolding.geo.MercatorProjection

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.