java.lang.Object
org.hipparchus.geometry.spherical.oned.S1Point
All Implemented Interfaces:
Serializable, Point<Sphere1D>

public class S1Point extends Object implements Point<Sphere1D>
This class represents a point on the 1-sphere.

Instances of this class are guaranteed to be immutable.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final S1Point
    A vector with all coordinates set to NaN.
  • Constructor Summary

    Constructors
    Constructor
    Description
    S1Point(double alpha)
    Simple constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Compute the distance between the instance and another point.
    static double
    Compute the distance (angular separation) between two points.
    boolean
    equals(Object other)
    Test for the equality of two points on the 1-sphere.
    boolean
    Test for the equality of two points on the 1-sphere.
    double
    Get the azimuthal angle \( \alpha \).
    Get the space to which the point belongs.
    Get the corresponding normalized vector in the 2D euclidean space.
    int
    Get a hashCode for the point.
    boolean
    Returns true if any coordinate of this point is NaN; false otherwise

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NaN

      public static final S1Point NaN
      A vector with all coordinates set to NaN.
  • Constructor Details

    • S1Point

      public S1Point(double alpha)
      Simple constructor. Build a vector from its coordinates
      Parameters:
      alpha - azimuthal angle \( \alpha \)
      See Also:
  • Method Details

    • getAlpha

      public double getAlpha()
      Get the azimuthal angle \( \alpha \).
      Returns:
      azimuthal angle \( \alpha \)
      See Also:
    • 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.
      Specified by:
      getSpace in interface Point<Sphere1D>
      Returns:
      containing space
    • isNaN

      public boolean isNaN()
      Returns true if any coordinate of this point is NaN; false otherwise
      Specified by:
      isNaN in interface Point<Sphere1D>
      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.
      Specified by:
      distance in interface Point<Sphere1D>
      Parameters:
      point - second point
      Returns:
      the distance between the instance and p
    • distance

      public static double distance(S1Point p1, S1Point p2)
      Compute the distance (angular separation) between two points.
      Parameters:
      p1 - first vector
      p2 - second vector
      Returns:
      the angular separation between p1 and p2
    • equals

      public boolean equals(Object other)
      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 to Double.NaN, the point is equal to NaN.

      Overrides:
      equals in class Object
      Parameters:
      other - Object to test for equality to this
      Returns:
      true if two points on the 1-sphere objects are equal, false if object is null, not an instance of S1Point, or not equal to this S1Point instance
    • equalsIeee754

      public boolean equalsIeee754(Object other)
      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 that S1Point.NaN.equals(S1Point.NaN) returns false 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.

      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object