public class S2Point extends Object implements Point<Sphere2D>
We use the mathematical convention to use the azimuthal angle
Instances of this class are guaranteed to be immutable.
Modifier and Type | Field and Description |
---|---|
static S2Point |
MINUS_I
-I (coordinates:
|
static S2Point |
MINUS_J
-J (coordinates:
|
static S2Point |
MINUS_K
-K (coordinates:
|
static S2Point |
NaN
A vector with all coordinates set to NaN.
|
static S2Point |
PLUS_I
+I (coordinates:
|
static S2Point |
PLUS_J
+J (coordinates:
|
static S2Point |
PLUS_K
+K (coordinates:
|
Constructor and Description |
---|
S2Point(double theta,
double phi)
Simple constructor.
|
S2Point(Vector3D vector)
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
distance(Point<Sphere2D> point)
Compute the distance between the instance and another point.
|
static double |
distance(S2Point p1,
S2Point p2)
Compute the distance (angular separation) between two points.
|
boolean |
equals(Object other)
Test for the equality of two points on the 2-sphere.
|
double |
getPhi()
Get the polar angle
|
Space |
getSpace()
Get the space to which the point belongs.
|
double |
getTheta()
Get the azimuthal angle
|
Vector3D |
getVector()
Get the corresponding normalized vector in the 3D euclidean space.
|
int |
hashCode()
Get a hashCode for the 2D vector.
|
boolean |
isNaN()
Returns true if any coordinate of this point is NaN; false otherwise
|
S2Point |
negate()
Get the opposite of the instance.
|
public S2Point(double theta, double phi) throws OutOfRangeException
theta
- azimuthal angle phi
- polar angle OutOfRangeException
- if getTheta()
,
getPhi()
public S2Point(Vector3D vector) throws MathArithmeticException
vector
- 3D vectorMathArithmeticException
- if vector norm is zeropublic double getTheta()
S2Point(double, double)
public double getPhi()
S2Point(double, double)
public Vector3D getVector()
public boolean isNaN()
public S2Point negate()
public double distance(Point<Sphere2D> point)
public static double distance(S2Point p1, S2Point p2)
p1
- first vectorp2
- second vectorpublic boolean equals(Object other)
If all coordinates of two points are exactly the same, and none are
Double.NaN
, the two points are considered to be equal.
NaN
coordinates are considered to affect globally the vector
and be equals to each other - i.e, if either (or all) coordinates of the
2D vector are equal to Double.NaN
, the 2D vector is equal to
NaN
.
Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.