Class R2Vector


  • public final class R2Vector
    extends Object
    R2Vector represents a vector in the two-dimensional space. It defines the basic geometrical operations for 2D vectors, e.g. cross product, addition, norm, comparison etc.
    • Constructor Detail

      • R2Vector

        public R2Vector()
      • R2Vector

        public R2Vector​(double x,
                        double y)
      • R2Vector

        public R2Vector​(double[] coord)
    • Method Detail

      • x

        public double x()
      • y

        public double y()
      • get

        public double get​(int index)
      • norm2

        public double norm2()
      • dotProd

        public double dotProd​(R2Vector that)
      • crossProd

        public double crossProd​(R2Vector that)
      • lessThan

        public boolean lessThan​(R2Vector vb)
      • 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