Package bagel.util

Class Point

java.lang.Object
bagel.util.Point

public class Point extends Object
Immutable class that represents a 2D point in space.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final double
     
    final double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create the point (0, 0).
    Point(double x, double y)
    Create the point (x, y).
  • Method Summary

    Modifier and Type
    Method
    Description
    Converts this point to a Vector2 with the same x and y values.
    double
     
    boolean
    equals(Object other)
    Performs exact equality checking.
     

    Methods inherited from class java.lang.Object

    getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • x

      public final double x
    • y

      public final double y
  • Constructor Details

    • Point

      public Point()
      Create the point (0, 0).
    • Point

      public Point(double x, double y)
      Create the point (x, y).
  • Method Details

    • asVector

      public Vector2 asVector()
      Converts this point to a Vector2 with the same x and y values.
    • equals

      public boolean equals(Object other)
      Performs exact equality checking.
      Overrides:
      equals in class Object
    • distanceTo

      public double distanceTo(Point b)
    • toString

      public String toString()
      Overrides:
      toString in class Object