Angle

@Serializable(with = AngleSerializer.class)
public final class Angle implements Comparable<Angle>

Class for representing angles.

Constructors

Link copied to clipboard
public Angle Angle(Double value, AngleUnit units)
public Angle Angle(AngleUnit units)

Properties

Link copied to clipboard
public final static Angle circle
Link copied to clipboard
private final Double degrees

The measure of this angle in degrees.

Link copied to clipboard
public final static Angle halfCircle
Link copied to clipboard
public final static Angle quarterCircle
Link copied to clipboard
private final Double radians

The measure of this angle in radians.

Link copied to clipboard
public final AngleUnit units
Link copied to clipboard
public final Double value

Functions

Link copied to clipboard
public final Angle abs()

Returns the absolute value of this angle.

Link copied to clipboard
public final Angle angleTo(Angle other)

Returns the shortest angle that can be added to this angle to get other (e.g., 10° angleTo 360° = -10°).

Link copied to clipboard
public final Angle coerceIn(Angle min, Angle max)

Ensures that this angle lies in the specified range min..max.

Link copied to clipboard
public Integer compareTo(Angle other)

Returns 1 if this angle is greater than other, 0 if they are equal, and -1 if this angle is less than other.

Link copied to clipboard
public final Double cos()

Returns the cosine of this angle.

Link copied to clipboard
public final static Angle deg(Double value)

Constructs an angle from the specified value in degrees.

Link copied to clipboard
public final Double degrees()
Link copied to clipboard
public final Double div(Angle other)

Divides two angles.

public final Angle div(Double scalar)

Divides this angle by a scalar.

Link copied to clipboard
public final Boolean epsilonEquals(Angle other)

Returns whether two angles are approximately equal (within EPSILON), but angles which point in the same direction are considered equal as well (e.g., 0° = 360° = 720°).

Link copied to clipboard
public Boolean equals(Object other)
Link copied to clipboard
public final Double getValue(AngleUnit units)
Link copied to clipboard
public Integer hashCode()
Link copied to clipboard
public final Angle minus(Angle other)

Subtracts two angles.

Link copied to clipboard
public final Angle norm()

Returns this angle clamped to [0, 2pi] in radians, or [0, 360] in degrees.

Link copied to clipboard
public final Angle normDelta()

Returns this angle clamped to [-pi, pi] in radians, or [-180, 180] in degrees.

Link copied to clipboard
public final Angle plus(Angle other)

Adds two angles.

Link copied to clipboard
public final static Angle rad(Double value)

Constructs an angle from the specified value in radians.

Link copied to clipboard
public final Double radians()
Link copied to clipboard
public final Double sin()

Returns the sine of this angle.

Link copied to clipboard
public final Boolean strictEpsilonEquals(Angle other)

Returns whether two angles are approximately equal (within EPSILON).

Link copied to clipboard
public final Double tan()

Returns the tangent of this angle.

Link copied to clipboard
public final Angle times(Double scalar)

Multiplies this angle by a scalar.

Link copied to clipboard
public String toString()
Link copied to clipboard
public final Angle unaryMinus()

Returns the negative of this angle.

Link copied to clipboard
public final Vector2d vec()

Returns the vector representation of this angle.