Class S1Point
- java.lang.Object
-
- org.apache.commons.math3.geometry.spherical.oned.S1Point
-
public class S1Point extends java.lang.Object implements Point<Sphere1D>
This class represents a point on the 1-sphere.Instances of this class are guaranteed to be immutable.
- Since:
- 3.3
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doubledistance(Point<Sphere1D> point)Compute the distance between the instance and another point.static doubledistance(S1Point p1, S1Point p2)Compute the distance (angular separation) between two points.booleanequals(java.lang.Object other)Test for the equality of two points on the 2-sphere.doublegetAlpha()Get the azimuthal angle \( \alpha \).SpacegetSpace()Get the space to which the point belongs.Vector2DgetVector()Get the corresponding normalized vector in the 2D euclidean space.inthashCode()Get a hashCode for the 2D vector.booleanisNaN()Returns true if any coordinate of this point is NaN; false otherwise
-
-
-
Field Detail
-
NaN
public static final S1Point NaN
A vector with all coordinates set to NaN.
-
serialVersionUID
private static final long serialVersionUID
Serializable UID.- See Also:
- Constant Field Values
-
alpha
private final double alpha
Azimuthal angle \( \alpha \).
-
vector
private final Vector2D vector
Corresponding 2D normalized vector.
-
-
Constructor Detail
-
S1Point
public S1Point(double alpha)
Simple constructor. Build a vector from its coordinates- Parameters:
alpha- azimuthal angle \( \alpha \)- See Also:
getAlpha()
-
S1Point
private S1Point(double alpha, Vector2D vector)Build a point from its internal components.- Parameters:
alpha- azimuthal angle \( \alpha \)vector- corresponding vector
-
-
Method Detail
-
getAlpha
public double getAlpha()
Get the azimuthal angle \( \alpha \).- Returns:
- azimuthal angle \( \alpha \)
- See Also:
S1Point(double)
-
getVector
public Vector2D getVector()
Get the corresponding normalized vector in the 2D euclidean space.- Returns:
- normalized vector
-
getSpace
public Space getSpace()
Get the space to which the point belongs.
-
isNaN
public boolean isNaN()
Returns true if any coordinate of this point is NaN; false otherwise
-
distance
public double distance(Point<Sphere1D> point)
Compute the distance between the instance and another point.
-
distance
public static double distance(S1Point p1, S1Point p2)
Compute the distance (angular separation) between two points.- Parameters:
p1- first vectorp2- second vector- Returns:
- the angular separation between p1 and p2
-
equals
public boolean equals(java.lang.Object other)
Test for the equality of two points on the 2-sphere.If all coordinates of two points are exactly the same, and none are
Double.NaN, the two points are considered to be equal.NaNcoordinates 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 toDouble.NaN, the 2D vector is equal toNaN.- Overrides:
equalsin classjava.lang.Object- Parameters:
other- Object to test for equality to this- 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 instance
-
hashCode
public int hashCode()
Get a hashCode for the 2D vector.All NaN values have the same hash code.
- Overrides:
hashCodein classjava.lang.Object- Returns:
- a hash code value for this object
-
-