Import std.math.int_vector
Vec2i
struct
Public Struct Vec2i Implements Numeric, Hashable, Printable, Defaultable
A cell or step on a 2D grid.
Examples
Local a = Vec2i(1, 2)
Local b = Vec2i(4, 6)
Expect(a + b == Vec2i(5, 8))
Expect(ManhattanDistance(a, b) == 7 && ChebyshevDistance(a, b) == 4)
// Cells are Map keys.
Local walls = {Vec2i(0, 0): True}
Expect(walls.Contains(Vec2i(0, 0)) && !walls.Contains(a))std/math/int_vector.fb, line 36
-
Its x component.
-
Its y component.
-
The zero vector, (0, 0).
-
The vector (1, 1), which multiplying leaves alone.
-
The zero vector, (0, 0).
-
The components as Floats, rounded to the nearest one a Float holds.
-
Its components, as "(1, 2)".
-
The component at the index: x at 0, and y at 1. Any other index panics.
-
aplusb, component by component. Panics in a debug build when a component overflows, and wraps in a release one. -
aminusb, component by component. Panics in a debug build when a component overflows, and wraps in a release one. -
atimesb, component by component. Panics in a debug build when a component overflows, and wraps in a release one. -
adivided byb, component by component. Each rounded toward 0. A component of 0 inbpanics. -
atimesscale. -
scaletimesa. -
adivided byscale. -
anegated.
Report an issue with this page or with FutureBlitz on GitHub.