Class Point2d

java.lang.Object
com.thecsdev.common.math.Point2d
All Implemented Interfaces:
Cloneable

public final class Point2d extends Object implements Cloneable
Immutable two-dimensional integer-based point.
  • Field Details

    • ZERO

      public static final Point2d ZERO
      The default "zero" value whose (x, y) values are all 0.
    • x

      public final double x
    • y

      public final double y
  • Constructor Details

    • Point2d

      public Point2d()
    • Point2d

      public Point2d(double x, double y)
  • Method Details

    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

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

      public final Point2d clone()
      Overrides:
      clone in class Object
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • add

      @NotNull public final @NotNull Point2d add(double dX, double dY)
      Returns a new Point2d with the x and y values added.
    • sub

      @NotNull public final @NotNull Point2d sub(double dX, double dY)
      Returns a new Point2d with the x and y values subtracted.
    • clamp01

      @NotNull public final @NotNull Point2d clamp01()
      Returns a new Point2d with the x and y values clamped to 0 to 1 range.