Class Vector


  • public final class Vector
    extends java.lang.Object
    A 2D vector.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private float x  
      private float y  
    • Constructor Summary

      Constructors 
      Constructor Description
      Vector​(float x, float y)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float getX()
      Returns the x magnitude.
      float getY()
      Returns the y magnitude.
      Vector scale​(float sxy)
      Returns a new vector scaled by both x and y.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • x

        private final float x
      • y

        private final float y
    • Constructor Detail

      • Vector

        public Vector​(float x,
                      float y)
    • Method Detail

      • getX

        public float getX()
        Returns the x magnitude.
      • getY

        public float getY()
        Returns the y magnitude.
      • scale

        public Vector scale​(float sxy)
        Returns a new vector scaled by both x and y.
        Parameters:
        sxy - x and y scale
      • toString

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