vec/dict/vec2i_dict

Types

A dictionary with 2D integer vector as keys.

pub type Vec2iDict(value) =
  dict.Dict(vec2.Vec2(Int), value)

Values

pub fn anchor_position(
  dict: dict.Dict(vec2.Vec2(Int), value),
  at position: vec2.Vec2(Int),
  then fun: fn(dict.Dict(vec2.Vec2(Int), value)) -> dict.Dict(
    vec2.Vec2(Int),
    value,
  ),
) -> dict.Dict(vec2.Vec2(Int), value)

Return the equivalent of dict |> offset(vec2i.negate(position)) |> fun() |> offset(position).

pub fn anchor_rotation(
  dict: dict.Dict(vec2.Vec2(Int), value),
  at angle: Int,
  then fun: fn(dict.Dict(vec2.Vec2(Int), value)) -> dict.Dict(
    vec2.Vec2(Int),
    value,
  ),
) -> dict.Dict(vec2.Vec2(Int), value)

Return the equivalent of dict |> rotate(-angle) |> fun() |> rotate(angle).

pub fn mirror(
  in dict: dict.Dict(vec2.Vec2(Int), value),
  through normal: vec2.Vec2(Int),
) -> dict.Dict(vec2.Vec2(Int), value)

Returns the mirror of a vec-dict through a plane defined by the given normal vector.

pub fn new_rectangle(
  from start: vec2.Vec2(Int),
  to stop: vec2.Vec2(Int),
  with fun: fn(vec2.Vec2(Int)) -> value,
) -> dict.Dict(vec2.Vec2(Int), value)

Returns a new rectangle vec-dict from start to stop fill with values return from fun.

pub fn offset(
  in dict: dict.Dict(vec2.Vec2(Int), value),
  by vector: vec2.Vec2(Int),
) -> dict.Dict(vec2.Vec2(Int), value)

Returns a new vec-dict containing the key offset by vector.

pub fn rotate(
  in dict: dict.Dict(vec2.Vec2(Int), value),
  by angle: Int,
) -> dict.Dict(vec2.Vec2(Int), value)

Rotate a vec-dict by an angle (in 90 degree steps).

Search Document