/** * Transforms the specified (<var>x</var>,<var>y</var>) coordinate and stores the result in * {@code ptDst}. */ @Override protected Point2D inverseTransformNormalized(double x, double y, Point2D ptDst) throws ProjectionException { // Compute using ellipsoidal formulas, for comparaison later. assert (ptDst = super.inverseTransformNormalized(x, y, ptDst)) != null; final double rho = hypot(x, y); if (abs(rho) < EPSILON) { y = 0.0; // latitudeOfOrigin x = 0.0; } else { final double c = 2.0 * atan(rho / k0); final double cosc = cos(c); final double sinc = sin(c); y = asin(y * sinc / rho); // (20-14) with phi1=0 final double t = x * sinc; final double ct = rho * cosc; x = (abs(t) < EPSILON && abs(ct) < EPSILON) ? 0.0 : atan2(t, ct); } 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 { // Compute using ellipsoidal formulas, for comparaison later. assert (ptDst = super.transformNormalized(x, y, ptDst)) != null; final double coslat = cos(y); double f = 1.0 + coslat * cos(x); if (f < EPSILON) { throw new ProjectionException(ErrorKeys.VALUE_TEND_TOWARD_INFINITY); } f = k0 / f; // (21-14) x = f * coslat * sin(x); // (21-2) y = f * sin(y); // (21-13) assert checkTransform(x, y, ptDst); if (ptDst != null) { ptDst.setLocation(x, y); return ptDst; } return new Point2D.Double(x, y); }
return new EquatorialStereographic.Spherical(parameters, descriptor); } else { return createMathTransform(parameters, descriptor);
/** * Constructs a spherical equatorial stereographic projection (USGS equations). * * @param parameters The group of parameter values. * @param descriptor The expected parameter descriptor. * @throws ParameterNotFoundException if a required parameter was not found. */ Spherical(final ParameterValueGroup parameters, final ParameterDescriptorGroup descriptor) throws ParameterNotFoundException { super(parameters, descriptor); ensureSpherical(); }