Package net.regsirius06.engine.point
Class ColoredPoint
java.lang.Object
net.regsirius06.engine.point.Point
net.regsirius06.engine.point.ColoredPoint
- Direct Known Subclasses:
Wall
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.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionColoredPoint(double x, double y, Color color) Constructs a newColoredPointwith the specifiedxandycoordinates and a givenColor.ColoredPoint(@NotNull Point point, Color color) Constructs a newColoredPointby copying the coordinates of an existingPointand setting the color to the specifiedColor. -
Method Summary
Modifier and TypeMethodDescriptiongetColor()Returns theColorof thisColoredPoint.Returns a newColoredPointwith the same coordinates and color as this point.Methods inherited from class net.regsirius06.engine.point.Point
angleTo, angleTo, distanceTo, distanceTo, equals, getPoint, getX, getY, hashCode, isPointInside, isPointInside, movePoint, movePoint
-
Constructor Details
-
ColoredPoint
Constructs a newColoredPointwith the specifiedxandycoordinates and a givenColor.- Parameters:
x- thexcoordinate of the colored pointy- theycoordinate of the colored pointcolor- theColorof the point, represented as aColorobject
-
ColoredPoint
Constructs a newColoredPointby copying the coordinates of an existingPointand setting the color to the specifiedColor.- Parameters:
point- thePointto copy coordinates fromcolor- theColorof the point
-
-
Method Details
-
getColor
Returns theColorof thisColoredPoint.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
Colorrepresenting the visual appearance of the point
-
getColoredPoint
Returns a newColoredPointwith the same coordinates and color as this point. This method allows for creating a copy of the current colored point.- Returns:
- a new
ColoredPointwith the samex,y, and color
-