Class S2Point

  • All Implemented Interfaces:
    Comparable<S2Point>

    public class S2Point
    extends Object
    implements Comparable<S2Point>
    An S2Point represents a point on the unit sphere as a 3D vector. Usually points are normalized to be unit length, but some methods do not require this.
    • Constructor Detail

      • S2Point

        public S2Point()
      • S2Point

        public S2Point​(double x,
                       double y,
                       double z)
    • Method Detail

      • norm2

        public double norm2()
      • norm

        public double norm()
      • dotProd

        public double dotProd​(S2Point that)
      • ortho

        public S2Point ortho()
        return a vector orthogonal to this one
      • largestAbsComponent

        public int largestAbsComponent()
        Return the index of the largest component fabs
      • get

        public double get​(int axis)
      • angle

        public double angle​(S2Point va)
        Return the angle between two vectors in radians
      • lessThan

        public boolean lessThan​(S2Point vb)
      • toDegreesString

        public String toDegreesString()
      • hashCode

        public int hashCode()
        Calcualates hashcode based on stored coordinates. Since we want +0.0 and -0.0 to be treated the same, we ignore the sign of the coordinates.
        Overrides:
        hashCode in class Object