Package nl.colorize.multimedialib.math
Record Class Angle
java.lang.Object
java.lang.Record
nl.colorize.multimedialib.math.Angle
Immutable representation of an angle in degrees. Angles are normalized to
the range between 0 and 360, so an angle of 20 degrees is considered
equivalent to an angle of 380 degrees.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfloat
degrees()
Returns the value of thedegrees
record component.float
difference
(Angle other) Returns the distance between this angle and the specified other angle, in degrees.final boolean
Indicates whether some other object is "equal to" this one.float
final int
hashCode()
Returns a hash code value for this object.move
(float byDegrees) toString()
Returns a string representation of this record class.
-
Field Details
-
ORIGIN
-
-
Constructor Details
-
Angle
public Angle(float degrees) Creates an instance of aAngle
record class.- Parameters:
degrees
- the value for thedegrees
record component
-
-
Method Details
-
getRadians
public float getRadians() -
difference
Returns the distance between this angle and the specified other angle, in degrees. The returned value will be in the range between 0 and 180 degrees. -
move
-
move
-
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. All components in this record class are compared with '=='. -
degrees
public float degrees()Returns the value of thedegrees
record component.- Returns:
- the value of the
degrees
record component
-