Class Vector2d

java.lang.Object
de.placeblock.betterinventories.util.Vector2d

public class Vector2d extends Object
Vector class to specify positions in GUIs
  • Constructor Details

    • Vector2d

      public Vector2d()
      Creates a new Vector with 0-values
  • Method Details

    • subtract

      public Vector2d subtract(Vector2d vector2d)
      Subtract a Vector from this Vector
      Parameters:
      vector2d - The Vector
      Returns:
      The new Vector
    • add

      public Vector2d add(Vector2d vector2d)
      Adds a Vector to this Vector
      Parameters:
      vector2d - The Vector
      Returns:
      The new Vector
    • equals

      public boolean equals(Object o)
      New equals method comparing just x and y
      Overrides:
      equals in class Object
      Parameters:
      o - The object
      Returns:
      True if both objects are equals
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      Returns:
      The hash-code of the Vector
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      The string representation of the Vector
    • largest

      public static Vector2d largest(Collection<Vector2d> vectors)
      Calculates the largest Vector
      Parameters:
      vectors - The Vectors
      Returns:
      The largest Vector
    • max

      public static Vector2d max(Vector2d vector1, Vector2d vector2)
      Calculates the maximum of two Vectors
      Parameters:
      vector1 - The first Vector
      vector2 - The second Vector
      Returns:
      The new Vector
    • min

      public static Vector2d min(Vector2d vector1, Vector2d vector2)
      Calculates the minimum of two Vectors
      Parameters:
      vector1 - The first Vector
      vector2 - The second Vector
      Returns:
      The new Vector
    • clamp

      public static Vector2d clamp(Vector2d vector, Vector2d min, Vector2d max)
      Clamps a Vector to two Vectors
      Parameters:
      vector - The Vector to clamp
      min - The minimum Vector
      max - The maximum Vector
      Returns:
      The clamped Vector