Class S1Point
- All Implemented Interfaces:
Serializable
,Point<Sphere1D,
S1Point>
Instances of this class are guaranteed to be immutable.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
Compute the distance between the instance and another point.static double
Compute the distance (angular separation) between two points.boolean
Test for the equality of two points on the 1-sphere.boolean
equalsIeee754
(Object other) Test for the equality of two points on the 1-sphere.double
getAlpha()
Get the azimuthal angle .getSpace()
Get the space to which the point belongs.Get the corresponding normalized vector in the 2D euclidean space.int
hashCode()
Get a hashCode for the point.boolean
isNaN()
Returns true if any coordinate of this point is NaN; false otherwisemoveTowards
(S1Point other, double ratio) Move towards another point.
-
Field Details
-
Constructor Details
-
Method Details
-
getAlpha
public double getAlpha()Get the azimuthal angle .- Returns:
- azimuthal angle
- See Also:
-
getVector
Get the corresponding normalized vector in the 2D euclidean space.- Returns:
- normalized vector
-
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
Compute the distance between the instance and another point. -
distance
Compute the distance (angular separation) between two points.- Parameters:
p1
- first vectorp2
- second vector- Returns:
- the angular separation between p1 and p2
-
moveTowards
Move towards another point.Motion is linear (along space curvature) and based on a ratio where 0.0 stands for not moving at all, 0.5 stands for moving halfway towards other point, and 1.0 stands for moving fully to the other point.
- Specified by:
moveTowards
in interfacePoint<Sphere1D,
S1Point> - Parameters:
other
- other pointratio
- motion ratio,- Returns:
- moved point
-
equals
Test for the equality of two points on the 1-sphere.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 point and be equals to each other - i.e, if either (or all) coordinates of the point are equal toDouble.NaN
, the point is equal toNaN
. -
equalsIeee754
Test for the equality of two points on the 1-sphere.If all coordinates of two points are exactly the same, and none are
Double.NaN
, the two points are considered to be equal.In compliance with IEEE754 handling, if any coordinates of any of the two points are
NaN
, then the points are considered different. This implies thatS1Point.NaN
.equals(S1Point.NaN
) returnsfalse
despite the instance is checked against itself.- Parameters:
other
- Object to test for equality to this- Returns:
- true if two points objects are equal, false if object is null, not an instance of S1Point, or not equal to this S1Point instance
- Since:
- 2.1
-
hashCode
public int hashCode()Get a hashCode for the point.All NaN values have the same hash code.
-