Class Vector


  • public class Vector
    extends java.lang.Object
    A two-dimensional vector with a direction and a magnitude, both defined with float precision. The direction of the vector is defined by an angle in degrees. An angle of 0 degrees represents the vector (1, 0). Angles greater than 0 rotate in a clockwise direction, so an angle of 180 degress would represent the vector (-1, 0).
    • Constructor Detail

      • Vector

        public Vector​(float direction,
                      float magnitude)
    • Method Detail

      • setDirection

        public void setDirection​(float direction)
      • getDirection

        public float getDirection()
      • setMagnitude

        public void setMagnitude​(float magnitude)
      • getMagnitude

        public float getMagnitude()
      • getX

        public float getX()
      • getY

        public float getY()
      • toPoint

        public Point toPoint()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object