S2Point implements Point<Sphere2D> { public S2Point(final double theta, final double phi) throws OutOfRangeException { this(theta, phi, vector(theta, phi)); } S2Point(final double theta, final double phi);  S2Point(final Vector3D vector); private  S2Point(final double theta, final double phi, final Vector3D vector); double getTheta(); double getPhi(); Vector3D getVector(); Space getSpace(); boolean isNaN(); S2Point negate(); double distance(final Point<Sphere2D> point); static double distance(S2Point p1, S2Point p2); @Override boolean equals(Object other); @Override int hashCode(); static final S2Point PLUS_I; static final S2Point PLUS_J; static final S2Point PLUS_K; static final S2Point MINUS_I; static final S2Point MINUS_J; static final S2Point MINUS_K; static final S2Point NaN; }
@Test public void testS2Point() { for (int k = -2; k < 3; ++k) { S2Point p = new S2Point(1.0 + k * MathUtils.TWO_PI, 1.4); Assert.assertEquals(1.0 + k * MathUtils.TWO_PI, p.getTheta(), 1.0e-10); Assert.assertEquals(1.4, p.getPhi(), 1.0e-10); Assert.assertEquals(FastMath.cos(1.0) * FastMath.sin(1.4), p.getVector().getX(), 1.0e-10); Assert.assertEquals(FastMath.sin(1.0) * FastMath.sin(1.4), p.getVector().getY(), 1.0e-10); Assert.assertEquals(FastMath.cos(1.4), p.getVector().getZ(), 1.0e-10); Assert.assertFalse(p.isNaN()); } }