/** * Transforms the specified (<var>x</var>,<var>y</var>) coordinates and stores the result in * {@code ptDst} using equations for a sphere. */ @Override protected Point2D inverseTransformNormalized(double x, double y, Point2D ptDst) throws ProjectionException { // Computes using ellipsoidal formulas, for comparaison later. assert (ptDst = super.inverseTransformNormalized(x, y, ptDst)) != null; y = PI / 2 - 2.0 * atan(exp(-y)); assert checkInverseTransform(x, y, ptDst); if (ptDst != null) { ptDst.setLocation(x, y); return ptDst; } return new Point2D.Double(x, y); } }
/** * Transforms the specified (<var>λ</var>,<var>φ</var>) coordinates (units in * radians) and stores the result in {@code ptDst} (linear distance on a unit sphere). */ @Override protected Point2D transformNormalized(double x, double y, Point2D ptDst) throws ProjectionException { if (abs(y) > (PI / 2 - EPSILON)) { throw new ProjectionException(y); } // Compute using ellipsoidal formulas, for comparaison later. assert (ptDst = super.transformNormalized(x, y, ptDst)) != null; y = log(tan(PI / 4 + 0.5 * y)); assert checkTransform(x, y, ptDst); if (ptDst != null) { ptDst.setLocation(x, y); return ptDst; } return new Point2D.Double(x, y); }
/** * Constructs a new map projection from the suplied parameters. * * @param parameters The parameter values in standard units. * @throws ParameterNotFoundException if a mandatory parameter is missing. */ protected Spherical(final ParameterValueGroup parameters) throws ParameterNotFoundException { super(parameters); ensureSpherical(); }