This companion object of class `Direction`

provides some constants of type `Direction`

and methods for creating new `Direction`

instances.

The object has an alias in the top-level package o1, so it’s accessible to students
simply via `import o1.*`

.

- Companion:
- class

## Type members

### Inherited types

## Value members

### Concrete methods

Returns the Direction that corresponds to the given arrow key. For example, the right arrow corresponds to `Right`

.

Takes in an angle as degrees and returns the corresponding Direction. Zero degrees points rightwards; positive angles are counterclockwise from there, negative ones clockwise.

Takes in an angle as degrees and returns the corresponding Direction. Zero degrees points rightwards; positive angles are counterclockwise from there, negative ones clockwise.

Takes in a difference between x coordinates and a difference between y coordinates and constructs a Direction from them.

Takes in a difference between x coordinates and a difference between y coordinates and constructs a Direction from them.

- Value parameters:
- dx
a difference between two x coordinates; it is

*not*necessary that this is normalized between -1.0 and +1.0 like the`dx`

and`dy`

of the resulting Direction object- dy
a difference between two x coordinates; it is

*not*necessary that this is normalized between -1.0 and +1.0 like the`dx`

and`dy`

of the resulting Direction object

- Returns:
the Direction that corresponds to the given deltas. If both are exactly equal to zero, returns NoDirection.

Takes in an angle as radians and returns the corresponding Direction. Zero radians points rightwards; positive angles are counterclockwise from there, negative ones clockwise.

Takes in an angle as radians and returns the corresponding Direction. Zero radians points rightwards; positive angles are counterclockwise from there, negative ones clockwise.

Returns the Direction that corresponds to the given WASD key. For example, the D key corresponds to `East`

.

### Concrete fields

the “straight downwards” direction with a `dx`

of zero, and a `dy`

of +1

the “straight downwards” direction with a `dx`

of zero, and a `dy`

of +1

the “straight leftwards” direction with a `dx`

of -1, and a `dy`

of zero

the “straight leftwards” direction with a `dx`

of -1, and a `dy`

of zero