We use the mathematical convention to use the azimuthal angle \( \theta \) in the x-y plane as the first coordinate, and the polar angle \( \varphi \) as the second coordinate (see Spherical Coordinates in MathWorld).
Instances of this class are guaranteed to be immutable.
| Modifier and Type | Field and Description |
|---|---|
| public static final S2Point | MINUS_I
-I (coordinates: \( \theta = \pi, \varphi = \pi/2 \)). |
| public static final S2Point | MINUS_J
-J (coordinates: \( \theta = 3\pi/2, \varphi = \pi/2 \)). |
| public static final S2Point | MINUS_K
-K (coordinates: \( \theta = any angle, \varphi = \pi \)). |
| public static final S2Point | NaN
A vector with all coordinates set to NaN. |
| private final double | phi
Polar angle \( \varphi \). |
| public static final S2Point | PLUS_I
+I (coordinates: \( \theta = 0, \varphi = \pi/2 \)). |
| public static final S2Point | PLUS_J
+J (coordinates: \( \theta = \pi/2, \varphi = \pi/2 \))). |
| public static final S2Point | PLUS_K
+K (coordinates: \( \theta = any angle, \varphi = 0 \)). |
| private static final long | serialVersionUID
Serializable UID. |
| private final double | theta
Azimuthal angle \( \theta \) in the x-y plane. |
| private final Vector3D | vector
Corresponding 3D normalized vector. |
| Access | Constructor and Description |
|---|---|
| public | S2Point(final double
azimuthal angle \( \theta \) in the x-y plane theta, final double polar angle \( \varphi \) phi)Simple constructor. |
| public | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| public double | distance(final Point<Sphere2D>
second point point)Implements org. Compute the distance between the instance and another point. |
| public static double | |
| public boolean | Returns: true if two points on the 2-sphere objects are equal, false if object is null, not an instance of S2Point, or not equal to this S2Point instanceObject to test for equality to this other)Overrides java. Test for the equality of two points on the 2-sphere. |
| public double | |
| public Space | getSpace()
Implements org. Get the space to which the point belongs. |
| public double | Returns: azimuthal angle \( \theta \) in the x-y planeGet the azimuthal angle \( \theta \) in the x-y plane. |
| public Vector3D | Returns: normalized vectorGet the corresponding normalized vector in the 3D euclidean space. |
| public int | Returns: a hash code value for this objectOverrides java. Get a hashCode for the 2D vector. |
| public boolean | isNaN()
Implements org. Returns true if any coordinate of this point is NaN; false otherwise |
| public S2Point | |
| private static Vector3D | Returns: normalized vectorazimuthal angle \( \theta \) in the x-y plane theta, final double polar angle \( \varphi \) phi)Build the normalized vector corresponding to spherical coordinates. |
| MINUS_I | back to summary |
|---|---|
| public static final S2Point MINUS_I -I (coordinates: \( \theta = \pi, \varphi = \pi/2 \)). | |
| MINUS_J | back to summary |
|---|---|
| public static final S2Point MINUS_J -J (coordinates: \( \theta = 3\pi/2, \varphi = \pi/2 \)). | |
| MINUS_K | back to summary |
|---|---|
| public static final S2Point MINUS_K -K (coordinates: \( \theta = any angle, \varphi = \pi \)). | |
| NaN | back to summary |
|---|---|
| public static final S2Point NaN A vector with all coordinates set to NaN. | |
| phi | back to summary |
|---|---|
| private final double phi Polar angle \( \varphi \). | |
| PLUS_I | back to summary |
|---|---|
| public static final S2Point PLUS_I +I (coordinates: \( \theta = 0, \varphi = \pi/2 \)). | |
| PLUS_J | back to summary |
|---|---|
| public static final S2Point PLUS_J +J (coordinates: \( \theta = \pi/2, \varphi = \pi/2 \))). | |
| PLUS_K | back to summary |
|---|---|
| public static final S2Point PLUS_K +K (coordinates: \( \theta = any angle, \varphi = 0 \)). | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serializable UID. | |
| theta | back to summary |
|---|---|
| private final double theta Azimuthal angle \( \theta \) in the x-y plane. | |
| vector | back to summary |
|---|---|
| private final Vector3D vector Corresponding 3D normalized vector. | |
| S2Point | back to summary |
|---|---|
| public S2Point(final double theta, final double phi) throws OutOfRangeException Simple constructor. Build a vector from its spherical coordinates
| |
| S2Point | back to summary |
|---|---|
| public S2Point(final Vector3D vector) throws MathArithmeticException Simple constructor. Build a vector from its underlying 3D vector
| |
| S2Point | back to summary |
|---|---|
| private S2Point(final double theta, final double phi, final Vector3D vector) Build a point from its internal components.
| |
| distance | back to summary |
|---|---|
| public double distance(final Point<Sphere2D> point) Implements org. Doc from org. Compute the distance between the instance and another point. | |
| distance | back to summary |
|---|---|
| public static double distance(S2Point p1, S2Point p2) Compute the distance (angular separation) between two points. | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Test for the equality of two points on the 2-sphere.
If all coordinates of two points are exactly the same, and none are
| |
| getPhi | back to summary |
|---|---|
| public double getPhi() Get the polar angle \( \varphi \).
| |
| getSpace | back to summary |
|---|---|
| public Space getSpace() Implements org. Doc from org. Get the space to which the point belongs.
| |
| getTheta | back to summary |
|---|---|
| public double getTheta() Get the azimuthal angle \( \theta \) in the x-y plane.
| |
| getVector | back to summary |
|---|---|
| public Vector3D getVector() Get the corresponding normalized vector in the 3D euclidean space.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Get a hashCode for the 2D vector. All NaN values have the same hash code.
| |
| isNaN | back to summary |
|---|---|
| public boolean isNaN() Implements org. Doc from org. Returns true if any coordinate of this point is NaN; false otherwise
| |
| negate | back to summary |
|---|---|
| public S2Point negate() Get the opposite of the instance.
| |
| vector | back to summary |
|---|---|
| private static Vector3D vector(final double theta, final double phi) throws OutOfRangeException Build the normalized vector corresponding to spherical coordinates.
| |