↗️ Vectors for Gleam https://hexdocs.pm/vec
Find a file
2026-03-16 19:51:21 +07:00
src/vec feat: Added vec2f.signed_angle. 2026-03-16 19:51:21 +07:00
test feat: Added vec2f.signed_angle. 2026-03-16 19:51:21 +07:00
.gitignore feat: Init. 2025-05-19 00:11:58 +07:00
gleam.toml feat: Added vec2f.signed_angle. 2026-03-16 19:51:21 +07:00
manifest.toml refactor: Refactor functions to use map3. 2026-02-22 15:53:03 +07:00
README.md docs: Added Kaplay to README.md 2025-12-30 22:47:12 +07:00

vec

Package Version Hex Docs

This is a vectors library for the Gleam programming language.

Features

  • Supports 2D/3D/4D vectors.
  • Have StdLib's quality, from design and naming convention to documentation and tests.
  • Functionality comparable to the things that you can do with vectors in Godot, Kaplay, Phaser and Bevy.
  • All vector types are generic:
    • Gives users the freedom to have any kind of vector (integer vector, float vector, rational vector, ...).
    • And it's more convenient to handle (e.g: function-mapping).

Installation

gleam add vec
import vec/vec3.{Vec3}
import vec/vec3i

pub fn main() {
  Vec3(12, -34, 420)
  |> vec3i.add(Vec3(21, 45, -20))
  |> echo // -> Vec3(33, 11, 400)
  |> vec3i.scale(2)
  |> echo // -> Vec3(66, 22, 800)
}

Further documentation can be found at https://hexdocs.pm/vec.

Credits

Special thanks to: