@Test public void testEllipsoid() throws FactoryException { final DefaultEllipsoid e = DefaultEllipsoid.WGS84; final double hm = 0.5 / 60; assertEquals( "Nautical mile at equator", 1842.78, e.orthodromicDistance(0, 00 - hm, 0, 00 + hm), 0.2); assertEquals( "Nautical mile at North pole", 1861.67, e.orthodromicDistance(0, 90 - 2 * hm, 0, 90), 0.2); assertEquals( "Nautical mile at South pole", 1861.67, e.orthodromicDistance(0, 2 * hm - 90, 0, -90), 0.2); assertEquals( "International nautical mile", 1852.00, e.orthodromicDistance(0, 45 - hm, 0, 45 + hm), 0.2); for (double i = 0.01; i < 180; i += 1) { final double base = 180 * random.nextDouble() - 90; assertEquals( i + "° rotation", e.getSemiMajorAxis() * Math.toRadians(i), e.orthodromicDistance(base, 0, base + i, 0), 0.2); } final double radius = e.getSemiMajorAxis(); final double circumference = (radius * 1.00000001) * (2 * Math.PI); final DefaultEllipsoid s = DefaultEllipsoid.createEllipsoid("Sphere", radius, radius, e.getAxisUnit()); assertTrue("Spheroid class", !DefaultEllipsoid.class.equals(s.getClass())); for (double i = 0; i <= 180; i += 1) { final double base = 360 * random.nextDouble() - 180; assertEquals( i + "° rotation", s.getSemiMajorAxis() * Math.toRadians(i), s.orthodromicDistance(base, 0, base + i, 0), 0.001); } for (double i = -90; i <= +90; i += 1) { final double meridian = 360 * random.nextDouble() - 180; assertEquals( i + "° rotation", s.getSemiMajorAxis() * Math.toRadians(Math.abs(i)), s.orthodromicDistance(meridian, 0, meridian, i), 0.001); } for (int i = 0; i < 100; i++) { final double y1 = -90 + 180 * random.nextDouble(); final double y2 = -90 + 180 * random.nextDouble(); final double x1 = -180 + 360 * random.nextDouble(); final double x2 = -180 + 360 * random.nextDouble(); final double distance = s.orthodromicDistance(x1, y1, x2, y2); assertTrue("Range of legal values", distance >= 0 && distance <= circumference); } }
@Override public boolean equals(final Object object) { if (object == this) { return true; } if (super.equals(object)) { final GeocentricTransform that = (GeocentricTransform) object; return Double.doubleToLongBits(this.a) == Double.doubleToLongBits(that.a) && Double.doubleToLongBits(this.b) == Double.doubleToLongBits(that.b) && Double.doubleToLongBits(this.a2) == Double.doubleToLongBits(that.a2) && Double.doubleToLongBits(this.b2) == Double.doubleToLongBits(that.b2) && Double.doubleToLongBits(this.e2) == Double.doubleToLongBits(that.e2) && Double.doubleToLongBits(this.ep2) == Double.doubleToLongBits(that.ep2) && this.hasHeight == that.hasHeight; } return false; }
GeocentricTransform extends AbstractMathTransform implements Serializable { @Override public boolean equals(final Object object) { if (object == this) { return true; } if (super.equals(object)) { final GeocentricTransform that = (GeocentricTransform) object; return Double.doubleToLongBits(this.a) == Double.doubleToLongBits(that.a) && Double.doubleToLongBits(this.b) == Double.doubleToLongBits(that.b) && Double.doubleToLongBits(this.a2) == Double.doubleToLongBits(that.a2) && Double.doubleToLongBits(this.b2) == Double.doubleToLongBits(that.b2) && Double.doubleToLongBits(this.e2) == Double.doubleToLongBits(that.e2) && Double.doubleToLongBits(this.ep2) == Double.doubleToLongBits(that.ep2) && this.hasHeight == that.hasHeight; } return false; } }
GeocentricTransform extends AbstractMathTransform implements Serializable { @Override public boolean equals(final Object object) { if (object == this) { return true; } if (super.equals(object)) { final GeocentricTransform that = (GeocentricTransform) object; return Double.doubleToLongBits(this.a) == Double.doubleToLongBits(that.a) && Double.doubleToLongBits(this.b) == Double.doubleToLongBits(that.b) && Double.doubleToLongBits(this.a2) == Double.doubleToLongBits(that.a2) && Double.doubleToLongBits(this.b2) == Double.doubleToLongBits(that.b2) && Double.doubleToLongBits(this.e2) == Double.doubleToLongBits(that.e2) && Double.doubleToLongBits(this.ep2) == Double.doubleToLongBits(that.ep2) && this.hasHeight == that.hasHeight; } return false; } GeocentricTransform(final Ellipsoid ellipsoid, final boolean hasHeight);  GeocentricTransform(
            final double semiMajor,
            final double semiMinor,
            final Unit<Length> units,
            final boolean hasHeight); }
GeocentricTransform extends AbstractMathTransform implements Serializable { @Override public boolean equals(final Object object) { if (object == this) { return true; } if (super.equals(object)) { final GeocentricTransform that = (GeocentricTransform) object; return Double.doubleToLongBits(this.a) == Double.doubleToLongBits(that.a) && Double.doubleToLongBits(this.b) == Double.doubleToLongBits(that.b) && Double.doubleToLongBits(this.a2) == Double.doubleToLongBits(that.a2) && Double.doubleToLongBits(this.b2) == Double.doubleToLongBits(that.b2) && Double.doubleToLongBits(this.e2) == Double.doubleToLongBits(that.e2) && Double.doubleToLongBits(this.ep2) == Double.doubleToLongBits(that.ep2) && this.hasHeight == that.hasHeight; } return false; } GeocentricTransform(final Ellipsoid ellipsoid, final boolean hasHeight);  GeocentricTransform(
            final double semiMajor,
            final double semiMinor,
            final Unit<Length> units,
            final boolean hasHeight); @Override ParameterDescriptorGroup getParameterDescriptors(); @Override ParameterValueGroup getParameterValues(); int getSourceDimensions(); final int getTargetDimensions(); void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts); @Override void transform(
            float[] srcPts, int srcOff, final float[] dstPts, int dstOff, int numPts); void inverseTransform(
            double[] srcPts, int srcOff, final double[] dstPts, int dstOff, final int numPts); void inverseTransform(
            float[] srcPts, int srcOff, final float[] dstPts, int dstOff, final int numPts); @Override synchronized MathTransform inverse(); @Override int hashCode(); @Override boolean equals(final Object object); }
GeocentricTransform extends AbstractMathTransform implements Serializable { @Override public boolean equals(final Object object) { if (object == this) { return true; } if (super.equals(object)) { final GeocentricTransform that = (GeocentricTransform) object; return Double.doubleToLongBits(this.a) == Double.doubleToLongBits(that.a) && Double.doubleToLongBits(this.b) == Double.doubleToLongBits(that.b) && Double.doubleToLongBits(this.a2) == Double.doubleToLongBits(that.a2) && Double.doubleToLongBits(this.b2) == Double.doubleToLongBits(that.b2) && Double.doubleToLongBits(this.e2) == Double.doubleToLongBits(that.e2) && Double.doubleToLongBits(this.ep2) == Double.doubleToLongBits(that.ep2) && this.hasHeight == that.hasHeight; } return false; } GeocentricTransform(final Ellipsoid ellipsoid, final boolean hasHeight);  GeocentricTransform(
            final double semiMajor,
            final double semiMinor,
            final Unit<Length> units,
            final boolean hasHeight); @Override ParameterDescriptorGroup getParameterDescriptors(); @Override ParameterValueGroup getParameterValues(); int getSourceDimensions(); final int getTargetDimensions(); void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts); @Override void transform(
            float[] srcPts, int srcOff, final float[] dstPts, int dstOff, int numPts); void inverseTransform(
            double[] srcPts, int srcOff, final double[] dstPts, int dstOff, final int numPts); void inverseTransform(
            float[] srcPts, int srcOff, final float[] dstPts, int dstOff, final int numPts); @Override synchronized MathTransform inverse(); @Override int hashCode(); @Override boolean equals(final Object object);  }