VecMixin mixin
Shared functionality between Vec and Direction.
Properties
-
area
→ int
-
Gets the area of a Rect whose corners are (0, 0) and this Vec.
no setter
-
cardinalNeighbors
→ List<Vec>
-
The four Vecs surrounding this one to the north, south, east, and west.
no setter
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
intercardinalNeighbors
→ List<Vec>
-
The four Vecs surrounding this one to the northeast, southeast, southwest,
and northwest.
no setter
-
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 setter
-
length
→ num
-
The Cartesian length of the vector.
no setter
-
lengthSquared
→ int
-
no setter
-
nearestDirection
→ Direction
-
The Direction that most closely approximates the angle of this Vec.
no setter
-
neighbors
→ List<Vec>
-
The eight Vecs surrounding this one to the north, south, east, and west
and points in between.
no setter
-
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 setter
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
-
x
→ int
-
no setter
-
y
→ int
-
no setter
Methods
-
abs()
→ Vec
-
Returns a new Vec with the absolute value of the coordinates of this
one.
-
contains(Vec pos)
→ bool
-
Returns
true
if pos
is within a rectangle from (0,0) to this vector
(half-inclusive).
-
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
.
-
offsetX(int x)
→ Vec
-
Returns a new Vec whose coordinates are this one's but with the X
coordinate translated by
x
.
-
offsetY(int y)
→ Vec
-
Returns a new Vec whose coordinates are this one's but with the Y
coordinate translated by
y
.
-
toString()
→ String
-
A string representation of this object.
override