Direction enum

Inheritance
Implemented types
Mixed in types

Constructors

Direction(int x, int y)
const

Values

none → const Direction
const Direction(0, 0)
n → const Direction
const Direction(0, -1)
ne → const Direction
const Direction(1, -1)
e → const Direction
const Direction(1, 0)
se → const Direction
const Direction(1, 1)
s → const Direction
const Direction(0, 1)
sw → const Direction
const Direction(-1, 1)
w → const Direction
const Direction(-1, 0)
nw → const Direction
const Direction(-1, -1)

Properties

area int
Gets the area of a Rect whose corners are (0, 0) and this Vec.
no setterinherited
cardinalNeighbors List<Vec>
The four Vecs surrounding this one to the north, south, east, and west.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
intercardinalNeighbors List<Vec>
The four Vecs surrounding this one to the northeast, southeast, southwest, and northwest.
no setterinherited
kingLength int
Gets the king length of the Vec, which is the number of squares a king on a chessboard would need to move from (0, 0) to reach the endpoint of the Vec. Also known as Chebyshev distance.
no setterinherited
length num
The Cartesian length of the vector.
no setterinherited
lengthSquared int
no setterinherited
nearestDirection Direction
The Direction that most closely approximates the angle of this Vec.
no setterinherited
neighbors List<Vec>
The eight Vecs surrounding this one to the north, south, east, and west and points in between.
no setterinherited
rookLength int
Gets the rook length of the Vec, which is the number of squares a rook on a chessboard would need to move from (0, 0) to reach the endpoint of the Vec. Also known as Manhattan or taxicab distance.
no setterinherited
rotate180 Direction
no setter
rotateLeft45 Direction
no setter
rotateLeft90 Direction
no setter
rotateRight45 Direction
no setter
rotateRight90 Direction
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
x int
final
y int
final

Methods

abs() Vec
Returns a new Vec with the absolute value of the coordinates of this one.
inherited
contains(Vec pos) bool
Returns true if pos is within a rectangle from (0,0) to this vector (half-inclusive).
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
offset(int x, int y) Vec
Returns a new Vec whose coordinates are this one's translated by x and y.
inherited
offsetX(int x) Vec
Returns a new Vec whose coordinates are this one's but with the X coordinate translated by x.
inherited
offsetY(int y) Vec
Returns a new Vec whose coordinates are this one's but with the Y coordinate translated by y.
inherited
toString() String
A string representation of this object.
override

Operators

operator *(int other) Vec
Scales this Vec by other.
inherited
operator +(Object other) Vec
Adds other to this Vec.
inherited
operator -(Object other) Vec
Substracts other from this Vec.
inherited
operator <(Object other) bool
Returns true if the magnitude of this vector is less than other.
inherited
operator <=(Object other) bool
Returns true if the magnitude of this vector is less than or equal to other.
inherited
operator ==(Object other) bool
The equality operator.
inherited
operator >(Object other) bool
Returns true if the magnitude of this vector is greater than other.
inherited
operator >=(Object other) bool
Returns true if the magnitude of this vector is greater than or equal to other.
inherited
operator ~/(int other) Vec
Scales this Vec by other.
inherited

Constants

all → const List<Direction>
The eight cardinal and intercardinal directions.
cardinal → const List<Direction>
The four cardinal directions: north, south, east, and west.
intercardinal → const List<Direction>
The four directions between the cardinal ones: northwest, northeast, southwest and southeast.
values → const List<Direction>
A constant List of the values in this enum, in order of their declaration.