Available

amalgame-math-vec

Vec3 / Vec4 / Mat4 column-major (OpenGL).

amc package add math-vec GitHub ↗ ← Back to the ecosystem

Overview

Linear algebra for graphics and games: vectors, matrices, quaternions. Column-major convention compatible with OpenGL/Vulkan. Pairs naturally with ui-gl or ui-vk.

Features

  • Vec2, Vec3, Vec4 with vector ops
  • Mat3, Mat4 column-major (OpenGL/Vulkan)
  • Quaternions for 3D rotations
  • Builders: translation, rotation, scale, perspective, ortho, lookAt
  • Pure Amalgame — no C dep

Example

Minimal usage example — copy-paste runnable after install.

amc package add math-vec

let eye    = Vec3.New(0.0, 0.0, 5.0)
let center = Vec3.New(0.0, 0.0, 0.0)
let up     = Vec3.New(0.0, 1.0, 0.0)
let view   = Mat4.LookAt(eye, center, up)

At a glance

Related packages