Class Vertex

java.lang.Object
xyz.gmitch215.socketmc.util.render.Vertex
All Implemented Interfaces:
Serializable

public final class Vertex extends Object implements Serializable
Utility class for representing a vertex in 2D space, with a Z index.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Vertex
    Represents a Vertex at the origin with a Z index of 0.
    static final Vertex
    Represents a Vertex at the origin with the lowest possible Z index.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new vertex at the origin.
    Vertex(int x, int y)
    Creates a new vertex.
    Vertex(int x, int y, int zIndex)
    Creates a new vertex.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
    Gets the X coordinate.
    int
    Gets the Y coordinate.
    int
    Gets the Z index on the screen.
    int
     
    void
    setX(int x)
    Sets the X coordinate.
    void
    setY(int y)
    Sets the Y coordinate.
    void
    setZ(int zIndex)
    Sets the Z index.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ZERO

      public static final Vertex ZERO
      Represents a Vertex at the origin with a Z index of 0.
    • ZERO_BACK

      public static final Vertex ZERO_BACK
      Represents a Vertex at the origin with the lowest possible Z index.
  • Constructor Details

    • Vertex

      public Vertex()
      Creates a new vertex at the origin.
    • Vertex

      public Vertex(int x, int y)
      Creates a new vertex.
      Parameters:
      x - The X coordinate.
      y - The Y coordinate.
    • Vertex

      public Vertex(int x, int y, int zIndex)
      Creates a new vertex.
      Parameters:
      x - The X coordinate.
      y - The Y coordinate.
      zIndex - The Z index on the screen.
  • Method Details

    • getX

      public int getX()
      Gets the X coordinate.
      Returns:
      The X coordinate.
    • setX

      public void setX(int x)
      Sets the X coordinate.
      Parameters:
      x - The X coordinate.
    • getY

      public int getY()
      Gets the Y coordinate.
      Returns:
      The Y coordinate.
    • setY

      public void setY(int y)
      Sets the Y coordinate.
      Parameters:
      y - The Y coordinate.
    • getZ

      public int getZ()
      Gets the Z index on the screen. Z index is used to determine the order in which shapes are drawn. Shapes with a higher Z index are drawn on top of shapes with a lower Z index.
      Returns:
      The Z index.
    • setZ

      public void setZ(int zIndex)
      Sets the Z index.
      Parameters:
      zIndex - The Z index.
      See Also:
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object