Record Class Vec2f

java.lang.Object
java.lang.Record
dev.latvian.mods.klib.math.Vec2f

public record Vec2f(float x, float y) extends Record
  • Field Details

    • ZERO

      public static final Vec2f ZERO
    • ONE

      public static final Vec2f ONE
    • UNIT_X

      public static final Vec2f UNIT_X
    • NEG_UNIT_X

      public static final Vec2f NEG_UNIT_X
    • UNIT_Y

      public static final Vec2f UNIT_Y
    • NEG_UNIT_Y

      public static final Vec2f NEG_UNIT_Y
    • MAX

      public static final Vec2f MAX
    • MIN

      public static final Vec2f MIN
  • Constructor Details

    • Vec2f

      public Vec2f(float x, float y)
      Creates an instance of a Vec2f record class.
      Parameters:
      x - the value for the x record component
      y - the value for the y record component
  • Method Details

    • scale

      public Vec2f scale(float factor)
    • dot

      public double dot(Vec2f other)
    • add

      public Vec2f add(Vec2f other)
    • add

      public Vec2f add(float value)
    • equals

      public boolean equals(Vec2f other)
    • normalized

      public Vec2f normalized()
    • length

      public double length()
    • lengthSquared

      public float lengthSquared()
    • distanceToSqr

      public double distanceToSqr(Vec2f other)
    • negated

      public Vec2f negated()
    • lerp

      public Vec2f lerp(Vec2f to, float delta)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • x

      public float x()
      Returns the value of the x record component.
      Returns:
      the value of the x record component
    • y

      public float y()
      Returns the value of the y record component.
      Returns:
      the value of the y record component