java.lang.Object
java.lang.Record
technology.sola.math.geometry.Circle
- Record Components:
radius- the radius of the circlecenter- the center point of the circle
- All Implemented Interfaces:
Shape
Circle represents a geometric circle.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncenter()Returns the value of thecenterrecord component.booleanChecks if this Shape contains a point.final booleanIndicates whether some other object is "equal to" this one.floatgetArea()Calculates the area of this shape and return it.Calculates and returns the centroid of thisShape.final inthashCode()Returns a hash code value for this object.Vector2D[]points()floatradius()Returns the value of theradiusrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Circle
Creates a circle with defined radius and center. If the radius provided is zero then a degenerate circle will be created.- Parameters:
radius- the radius of the circle, positive numbercenter- the center point of the circle
-
-
Method Details
-
contains
Description copied from interface:ShapeChecks if this Shape contains a point. -
points
-
getCentroid
Description copied from interface:ShapeCalculates and returns the centroid of thisShape.- Specified by:
getCentroidin interfaceShape- Returns:
- the centroid
-
getArea
public float getArea()Description copied from interface:ShapeCalculates the area of this shape and return it. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 '=='. -
radius
public float radius()Returns the value of theradiusrecord component.- Returns:
- the value of the
radiusrecord component
-
center
Returns the value of thecenterrecord component.- Returns:
- the value of the
centerrecord component
-