Class Vector2D


public class Vector2D extends Object
Class that implements 2D Vector with methods to do basic calculations.
  • Field Details

    • x

      public int x
    • y

      public int y
  • Constructor Details

    • Vector2D

      public Vector2D()
    • Vector2D

      public Vector2D(int x, int y)
    • Vector2D

      public Vector2D(Vector2D v)
  • Method Details

    • set

      public void set(int x, int y)
    • set

      public void set(Vector2D v)
    • setZero

      public void setZero()
    • getComponents

      public int[] getComponents()
    • getLength

      public double getLength()
    • getLengthSqrt

      public int getLengthSqrt()
    • distanceSq

      public int distanceSq(int vx, int vy)
    • distanceSq

      public int distanceSq(Vector2D v)
    • normalize

      public void normalize()
    • getNormalized

      public Vector2D getNormalized()
    • add

      public void add(Vector2D v)
    • add

      public void add(int vx, int vy)
    • add

      public static Vector2D add(Vector2D v1, Vector2D v2)
    • getAdded

      public Vector2D getAdded(Vector2D v)
    • subtract

      public void subtract(Vector2D v)
    • subtract

      public void subtract(int vx, int vy)
    • subtract

      public static Vector2D subtract(Vector2D v1, Vector2D v2)
    • getSubtracted

      public Vector2D getSubtracted(Vector2D v)
    • multiply

      public void multiply(int scalar)
    • getMultiplied

      public Vector2D getMultiplied(int scalar)
    • divide

      public void divide(int scalar)
    • getDivided

      public Vector2D getDivided(int scalar)
    • getPerp

      public Vector2D getPerp()
    • dot

      public int dot(Vector2D v)
    • dot

      public int dot(int vx, int vy)
    • dot

      public static int dot(Vector2D v1, Vector2D v2)
    • cross

      public int cross(Vector2D v)
    • cross

      public int cross(int vx, int vy)
    • cross

      public static int cross(Vector2D v1, Vector2D v2)
    • reverse

      public void reverse()
    • getReversed

      public Vector2D getReversed()
    • equalValue

      public boolean equalValue(Vector2D vector2d)
    • clone

      public Vector2D clone()
      Overrides:
      clone in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object