Record Class Circle
java.lang.Object
java.lang.Record
nl.colorize.multimedialib.math.Circle
- All Implemented Interfaces:
Shape
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatcalculateDistance(Circle other) Returns the distance between the center of this circle and the center of the specified other circle.floatReturns the distance between the center of this circle and the specified point.center()Returns the value of thecenterrecord component.booleanReturns whether this shape contains the specified point.final booleanIndicates whether some other object is "equal to" this one.Returns the smallest possible rectangular bounding box that can fit this shape.final inthashCode()Returns a hash code value for this object.booleanintersects(Circle other) floatradius()Returns the value of theradiusrecord component.reposition(Point2D offset) Returns a newShapeinstance that is repositioned by the specified offset.toString()Returns a string representation of this record class.Methods inherited from interface Shape
reposition
-
Constructor Details
-
Circle
Creates an instance of aCirclerecord class.- Parameters:
center- the value for thecenterrecord componentradius- the value for theradiusrecord component
-
Circle
public Circle(float x, float y, float radius) -
Circle
public Circle(float radius) Creates a circle with its center point located at the origin (0, 0).
-
-
Method Details
-
getCenter
-
contains
-
intersects
-
calculateDistance
Returns the distance between the center of this circle and the specified point. -
calculateDistance
Returns the distance between the center of this circle and the center of the specified other circle. -
getBoundingBox
Description copied from interface:ShapeReturns the smallest possible rectangular bounding box that can fit this shape.- Specified by:
getBoundingBoxin interfaceShape
-
reposition
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
center
Returns the value of thecenterrecord component.- Returns:
- the value of the
centerrecord component
-
radius
public float radius()Returns the value of theradiusrecord component.- Returns:
- the value of the
radiusrecord component
-