API Reference › IVec2
namespace

IVec2

Integer 2D vector math for tile and grid coordinates, cell offsets, and integer sizes. An IVec2 is a pair of whole-number int components (x, y) packed into one value, so it is copied by value and never allocates. Every operation is exact integer arithmetic — no rounding, and bit-identical on every platform. Use it wherever a fractional part would be meaningless; reach for Vector when you need sub-pixel precision. Arguments are positional.

IVec2.make(x, y) -> IVec2Build an integer vector from x and y components.IVec2.zero() -> IVec2The origin cell, (0, 0).IVec2.x(v) -> intThe x component of an integer vector.IVec2.y(v) -> intThe y component of an integer vector.IVec2.add(a, b) -> IVec2Component-wise sum of two integer vectors.IVec2.sub(a, b) -> IVec2Component-wise difference of two integer vectors.IVec2.scale(v, s) -> IVec2Multiply both components by an integer.IVec2.dot(a, b) -> intThe dot product ax*bx + ay*by.IVec2.equal(a, b) -> boolTrue when both components match.IVec2.manhattan(a, b) -> intGrid distance |dx| + |dy|.IVec2.to_vector(v) -> VectorWiden to a fixed-point Vector.IVec2.distance2(a, b) -> intThe squared distance between two points.IVec2.within(a, b, radius) -> boolAre two points within a radius of each other?IVec2.heading(from, to) -> intThe direction from one point to another, in degrees.IVec2.along(origin, degrees, distance) -> IVec2The point a distance along a heading.IVec2.step(degrees) -> IVec2A -1/0/1 unit step along a heading.
← All symbols