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 thecenter
record component.boolean
Checks if this Shape contains a point.final boolean
Indicates whether some other object is "equal to" this one.float
getArea()
Calculates the area of this shape and return it.Calculates and returns the centroid of thisShape
.Vector2D[]
final int
hashCode()
Returns a hash code value for this object.float
radius()
Returns the value of theradius
record component.final String
toString()
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:Shape
Checks if this Shape contains a point. -
getPoints
-
getCentroid
Description copied from interface:Shape
Calculates and returns the centroid of thisShape
.- Specified by:
getCentroid
in interfaceShape
- Returns:
- the centroid
-
getArea
public float getArea()Description copied from interface:Shape
Calculates 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 theradius
record component.- Returns:
- the value of the
radius
record component
-
center
Returns the value of thecenter
record component.- Returns:
- the value of the
center
record component
-