public final class Angle extends java.lang.Object implements java.lang.Comparable<Angle>
Angle represents a
non-negative angle less than 360 degrees or 2*pi radians.| Modifier and Type | Field and Description |
|---|---|
static Angle |
DEG_135
A 135-degree angle
|
static Angle |
DEG_180
A 180-degree angle
|
static Angle |
DEG_225
A 225-degree angle
|
static Angle |
DEG_270
A 270-degree angle
|
static Angle |
DEG_315
A 315-degree angle
|
static Angle |
DEG_45
A 45-degree angle
|
static Angle |
DEG_90
A 90-degree angle
|
static Angle |
RAD_PI
An angle of pi radians
|
static Angle |
RAD_PI_OVER_FOUR
An angle of pi/4 radians
|
static Angle |
RAD_PI_OVER_TWO
An angle of pi/2 radians
|
static Angle |
ZERO
A zero-degree or zero-radian angle
|
| Constructor and Description |
|---|
Angle(double radians)
Constructs an
Angle with radians radians. |
Angle(double x,
double y) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Angle c)
Compares this object with the specified object for order.
|
double |
cos() |
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
Angle |
minus(Angle a) |
Angle |
plus(Angle a) |
double |
radians() |
double |
sin() |
double |
tan() |
java.lang.String |
toString() |
public static final Angle ZERO
public static final Angle DEG_45
public static final Angle DEG_90
public static final Angle DEG_135
public static final Angle DEG_180
public static final Angle DEG_225
public static final Angle DEG_270
public static final Angle DEG_315
public static final Angle RAD_PI_OVER_FOUR
public static final Angle RAD_PI_OVER_TWO
public static final Angle RAD_PI
public Angle(double radians)
Angle with radians radians.public Angle(double x,
double y)
x - ; requires that (x,y) != (0,0)y - ; requires that (x,y) != (0,0)
Constructs the Angle that starts from the
positive x-axis and runs to the line segment from the origin to (x,
y).public double cos()
public double sin()
public double tan()
public double radians()
public int compareTo(Angle c)
compareTo in interface java.lang.Comparable<Angle>java.lang.NullPointerException - if c is nullpublic Angle plus(Angle a)
a - angle to add to; requires that a is not nullthis + a.public Angle minus(Angle a)
a - angle to subtract from; requires that a is not nullthis - a.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object