Class PointI2

java.lang.Object
com.badlogic.gdx.math.GridPoint2
com.github.tommyettinger.gand.points.PointI2
All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable, com.github.tommyettinger.crux.Point2<PointI2>, com.github.tommyettinger.crux.PointN<PointI2>, Serializable

public class PointI2 extends com.badlogic.gdx.math.GridPoint2 implements com.github.tommyettinger.crux.Point2<PointI2>, com.badlogic.gdx.utils.Json.Serializable
The same as GridPoint2, just implementing Point2 and Json.Serializable.
See Also:
  • Field Summary

    Fields inherited from class com.badlogic.gdx.math.GridPoint2

    x, y
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    PointI2(float x, float y)
     
    PointI2(int x, int y)
     
    PointI2(com.badlogic.gdx.math.GridPoint2 v)
     
    PointI2(com.badlogic.gdx.math.Vector2 v)
     
    PointI2(com.github.tommyettinger.crux.Point2<? extends com.github.tommyettinger.crux.Point2<?>> v)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    add(int x, int y)
    Adds another x,y,z point to this point.
    add(com.badlogic.gdx.math.GridPoint2 other)
    Adds another point to this point.
    add(PointI2 point)
     
    cpy()
     
    float
    dst(PointI2 point)
     
    float
    dst2(PointI2 point)
     
    boolean
    Returns true if this type of point uses float or double for its components, or false otherwise.
    Sets this PointI2 to the value represented by the specified string according to the format of toString().
    int
     
    boolean
     
    boolean
    isUnit(float v)
     
    boolean
     
    boolean
    isZero(float v)
     
    float
     
    void
    read(com.badlogic.gdx.utils.Json json, com.badlogic.gdx.utils.JsonValue jsonData)
     
    scl(PointI2 point)
     
    set(float x, float y)
     
    set(int x, int y)
    Sets the coordinates of this PointI2.
    set(com.badlogic.gdx.math.GridPoint2 point)
    Sets the coordinates of this point to that of another.
    set(com.github.tommyettinger.crux.Point2<?> pt)
     
    set(PointI2 point)
     
     
    sub(int x, int y)
    Subtracts another x,y,z point from this point.
    sub(com.badlogic.gdx.math.GridPoint2 other)
    Subtracts another point from this point.
    sub(PointI2 point)
     
    Converts this PointI2 to a string in the format (x,y,z).
    void
    write(com.badlogic.gdx.utils.Json json)
     
    float
    x()
     
    x(float next)
     
    float
    y()
     
    y(float next)
     

    Methods inherited from class com.badlogic.gdx.math.GridPoint2

    dst, dst, dst2, dst2, equals

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.github.tommyettinger.crux.Point2

    rank

    Methods inherited from interface com.github.tommyettinger.crux.PointN

    len, mutable
  • Constructor Details

    • PointI2

      public PointI2()
    • PointI2

      public PointI2(int x, int y)
    • PointI2

      public PointI2(float x, float y)
    • PointI2

      public PointI2(com.badlogic.gdx.math.GridPoint2 v)
    • PointI2

      public PointI2(com.badlogic.gdx.math.Vector2 v)
    • PointI2

      public PointI2(PointI2 v)
    • PointI2

      public PointI2(com.github.tommyettinger.crux.Point2<? extends com.github.tommyettinger.crux.Point2<?>> v)
  • Method Details

    • floatingPoint

      public boolean floatingPoint()
      Returns true if this type of point uses float or double for its components, or false otherwise. This always returns false.
      Specified by:
      floatingPoint in interface com.github.tommyettinger.crux.PointN<PointI2>
      Returns:
      false
    • cpy

      public PointI2 cpy()
      Specified by:
      cpy in interface com.github.tommyettinger.crux.PointN<PointI2>
      Overrides:
      cpy in class com.badlogic.gdx.math.GridPoint2
    • len2

      public float len2()
      Specified by:
      len2 in interface com.github.tommyettinger.crux.PointN<PointI2>
    • set

      public PointI2 set(PointI2 point)
      Specified by:
      set in interface com.github.tommyettinger.crux.PointN<PointI2>
    • sub

      public PointI2 sub(PointI2 point)
      Specified by:
      sub in interface com.github.tommyettinger.crux.PointN<PointI2>
    • add

      public PointI2 add(PointI2 point)
      Specified by:
      add in interface com.github.tommyettinger.crux.PointN<PointI2>
    • scl

      public PointI2 scl(PointI2 point)
      Specified by:
      scl in interface com.github.tommyettinger.crux.PointN<PointI2>
    • dst

      public float dst(PointI2 point)
      Specified by:
      dst in interface com.github.tommyettinger.crux.PointN<PointI2>
    • dst2

      public float dst2(PointI2 point)
      Specified by:
      dst2 in interface com.github.tommyettinger.crux.PointN<PointI2>
    • isUnit

      public boolean isUnit()
      Specified by:
      isUnit in interface com.github.tommyettinger.crux.PointN<PointI2>
    • isUnit

      public boolean isUnit(float v)
      Specified by:
      isUnit in interface com.github.tommyettinger.crux.PointN<PointI2>
    • isZero

      public boolean isZero()
      Specified by:
      isZero in interface com.github.tommyettinger.crux.PointN<PointI2>
    • isZero

      public boolean isZero(float v)
      Specified by:
      isZero in interface com.github.tommyettinger.crux.PointN<PointI2>
    • setZero

      public PointI2 setZero()
      Specified by:
      setZero in interface com.github.tommyettinger.crux.PointN<PointI2>
    • x

      public float x()
      Specified by:
      x in interface com.github.tommyettinger.crux.Point2<PointI2>
    • x

      public PointI2 x(float next)
      Specified by:
      x in interface com.github.tommyettinger.crux.Point2<PointI2>
    • y

      public float y()
      Specified by:
      y in interface com.github.tommyettinger.crux.Point2<PointI2>
    • y

      public PointI2 y(float next)
      Specified by:
      y in interface com.github.tommyettinger.crux.Point2<PointI2>
    • set

      public PointI2 set(float x, float y)
      Specified by:
      set in interface com.github.tommyettinger.crux.Point2<PointI2>
    • set

      public PointI2 set(com.badlogic.gdx.math.GridPoint2 point)
      Sets the coordinates of this point to that of another.
      Overrides:
      set in class com.badlogic.gdx.math.GridPoint2
      Parameters:
      point - The 2D grid point (which may be a PointI2 or GridPoint2) to copy coordinates of.
      Returns:
      this PointI2 for chaining.
    • set

      public PointI2 set(int x, int y)
      Sets the coordinates of this PointI2.
      Overrides:
      set in class com.badlogic.gdx.math.GridPoint2
      Parameters:
      x - X coordinate
      y - Y coordinate
      Returns:
      this PointI2 for chaining.
    • set

      public PointI2 set(com.github.tommyettinger.crux.Point2<?> pt)
    • add

      public PointI2 add(com.badlogic.gdx.math.GridPoint2 other)
      Adds another point to this point.
      Overrides:
      add in class com.badlogic.gdx.math.GridPoint2
      Parameters:
      other - The other point
      Returns:
      this PointI2 for chaining.
    • add

      public PointI2 add(int x, int y)
      Adds another x,y,z point to this point.
      Overrides:
      add in class com.badlogic.gdx.math.GridPoint2
      Parameters:
      x - The x-coordinate of the other point
      y - The y-coordinate of the other point
      Returns:
      this PointI2 for chaining.
    • sub

      public PointI2 sub(com.badlogic.gdx.math.GridPoint2 other)
      Subtracts another point from this point.
      Overrides:
      sub in class com.badlogic.gdx.math.GridPoint2
      Parameters:
      other - The other point
      Returns:
      this PointI2 for chaining.
    • sub

      public PointI2 sub(int x, int y)
      Subtracts another x,y,z point from this point.
      Overrides:
      sub in class com.badlogic.gdx.math.GridPoint2
      Parameters:
      x - The x-coordinate of the other point
      y - The y-coordinate of the other point
      Returns:
      this PointI2 for chaining.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class com.badlogic.gdx.math.GridPoint2
    • write

      public void write(com.badlogic.gdx.utils.Json json)
      Specified by:
      write in interface com.badlogic.gdx.utils.Json.Serializable
    • read

      public void read(com.badlogic.gdx.utils.Json json, com.badlogic.gdx.utils.JsonValue jsonData)
      Specified by:
      read in interface com.badlogic.gdx.utils.Json.Serializable
    • toString

      public String toString()
      Converts this PointI2 to a string in the format (x,y,z).
      Overrides:
      toString in class com.badlogic.gdx.math.GridPoint2
      Returns:
      a string representation of this object.
    • fromString

      public PointI2 fromString(String v)
      Sets this PointI2 to the value represented by the specified string according to the format of toString().
      Parameters:
      v - the string.
      Returns:
      this vector for chaining