Class ColoredPoint

java.lang.Object
net.regsirius06.engine.point.Point
net.regsirius06.engine.point.ColoredPoint
Direct Known Subclasses:
Wall

public class ColoredPoint extends Point
The ColoredPoint class extends the Point class by adding a Color attribute to represent the point's color. This allows the point to have a visual representation, making it suitable for applications that require both positional and visual data, such as graphical applications or UI components.

This class provides methods to access the color of the point, as well as to create a new ColoredPoint with the same coordinates and color as the current point.

  • Constructor Details

    • ColoredPoint

      public ColoredPoint(double x, double y, Color color)
      Constructs a new ColoredPoint with the specified x and y coordinates and a given Color.
      Parameters:
      x - the x coordinate of the colored point
      y - the y coordinate of the colored point
      color - the Color of the point, represented as a Color object
    • ColoredPoint

      public ColoredPoint(@NotNull @NotNull Point point, Color color)
      Constructs a new ColoredPoint by copying the coordinates of an existing Point and setting the color to the specified Color.
      Parameters:
      point - the Point to copy coordinates from
      color - the Color of the point
  • Method Details

    • getColor

      public Color getColor()
      Returns the Color of this ColoredPoint.

      The color is used for visual representation and can be applied in graphical contexts such as rendering the point in a UI component or graphical interface.

      Returns:
      the Color representing the visual appearance of the point
    • getColoredPoint

      public ColoredPoint getColoredPoint()
      Returns a new ColoredPoint with the same coordinates and color as this point. This method allows for creating a copy of the current colored point.
      Returns:
      a new ColoredPoint with the same x, y, and color