Import std.math.int_vector
std.math.int_vector
Vec2i and Vec3i: points and steps on a grid, as Ints, for cells, tiles, and voxels, and as Map keys. Their Operators work component by component, and an Int scales; dividing rounds toward 0, as Ints do, and dividing by 0, or overflow in debug builds, panics where it's called, as it does for an Int.
std/math/int_vector.fb
Types
Vec2i
struct
Public Struct Vec2i Implements Numeric, Hashable, Printable, Defaultable
A cell or step on a 2D grid.
std/math/int_vector.fb, line 11
-
Its x component.
-
Its y component.
-
The number that adding leaves alone: 0.
Doc from
std.core.interfaces.Numeric.Zero. -
The number that multiplying leaves alone: 1.
Doc from
std.core.interfaces.Numeric.One. -
The value to start from, like 0 for a number, "" for a String, or an empty collection.
-
The components as Floats, rounded to the nearest one a Float holds.
-
Its text, as a string interpolation like "{value}" shows it.
Doc from
std.core.interfaces.Printable.ToString. -
The component at the index: x at 0, and y at 1. Any other index panics.
-
aandbadded up.Doc from
std.core.interfaces.Numeric.Operator+. -
btaken away froma.Doc from
std.core.interfaces.Numeric.Operator-. -
aandbmultiplied together.Doc from
std.core.interfaces.Numeric.Operator*. -
adivided byb.Doc from
std.core.interfaces.Numeric.Operator/. -
atimesscale. -
scaletimesa. -
adivided byscale. -
anegated.
Vec3i
struct
Public Struct Vec3i Implements Numeric, Hashable, Printable, Defaultable
A cell or step on a 3D grid.
std/math/int_vector.fb, line 64
-
Its x component.
-
Its y component.
-
Its z component.
-
The number that adding leaves alone: 0.
Doc from
std.core.interfaces.Numeric.Zero. -
The number that multiplying leaves alone: 1.
Doc from
std.core.interfaces.Numeric.One. -
The value to start from, like 0 for a number, "" for a String, or an empty collection.
-
The components as Floats, rounded to the nearest one a Float holds.
-
Its text, as a string interpolation like "{value}" shows it.
Doc from
std.core.interfaces.Printable.ToString. -
The component at the index: x at 0, y at 1, and z at 2. Any other index panics.
-
aandbadded up.Doc from
std.core.interfaces.Numeric.Operator+. -
btaken away froma.Doc from
std.core.interfaces.Numeric.Operator-. -
aandbmultiplied together.Doc from
std.core.interfaces.Numeric.Operator*. -
adivided byb.Doc from
std.core.interfaces.Numeric.Operator/. -
atimesscale. -
scaletimesa. -
adivided byscale. -
anegated.
Functions
Dot
function
@PanicsAtCaller Public Function Dot(a: Vec2i, b: Vec2i): Int
The sum of the products of the components.
Dot
function
@PanicsAtCaller Public Function Dot(a: Vec3i, b: Vec3i): Int
The dot product of a and b.
LengthSquared
function
@PanicsAtCaller Public Function LengthSquared(v: Vec2i): Int
The length times itself, which is a whole number.
LengthSquared
function
@PanicsAtCaller Public Function LengthSquared(v: Vec3i): Int
The length of v times itself.
ManhattanDistance
function
@PanicsAtCaller Public Function ManhattanDistance(a: Vec2i, b: Vec2i): Int
How many steps along the axes go from a to b: the taxicab distance.
ManhattanDistance
function
@PanicsAtCaller Public Function ManhattanDistance(a: Vec3i, b: Vec3i): Int
How many steps along the axes go from a to b: the taxicab distance.
ChebyshevDistance
function
@PanicsAtCaller Public Function ChebyshevDistance(a: Vec2i, b: Vec2i): Int
How many steps go from a to b where a diagonal is one step too: the chessboard distance.
ChebyshevDistance
function
@PanicsAtCaller Public Function ChebyshevDistance(a: Vec3i, b: Vec3i): Int
How many steps go from a to b where a diagonal is one step too: the chessboard distance.
Min
function
Public Function Min(a: Vec2i, b: Vec2i): Vec2i
The smaller of each component.
Min
function
Public Function Min(a: Vec3i, b: Vec3i): Vec3i
The smaller of each component.
Max
function
Public Function Max(a: Vec2i, b: Vec2i): Vec2i
The larger of each component.
Max
function
Public Function Max(a: Vec3i, b: Vec3i): Vec3i
The larger of each component.
Clamp
function
@PanicsAtCaller Public Function Clamp(v: Vec2i, low: Vec2i, high: Vec2i): Vec2i
Each component kept between low's and high's, as Clamp keeps an Int. A component whose low
is above its high panics.
Clamp
function
@PanicsAtCaller Public Function Clamp(v: Vec3i, low: Vec3i, high: Vec3i): Vec3i
Each component kept between low's and high's, as Clamp keeps an Int. A component whose low
is above its high panics.
Abs
function
@PanicsAtCaller Public Function Abs(v: Vec2i): Vec2i
Each component's Abs.
Abs
function
@PanicsAtCaller Public Function Abs(v: Vec3i): Vec3i
Each component without its sign.
Report an issue with this page or with FutureBlitz on GitHub.