Skip to content

Releases: labelle-toolkit/zig-utils

v0.6.1

04 Mar 19:10

Choose a tag to compare

Bug Fixes

  • Fix WASM build: gate Floyd-Warshall parallel codepath on builtin.single_threaded (#10)
    • generateParallel() referenced std.Thread.spawn which fails at comptime on single-threaded targets (WASM)

v0.6.0

08 Jan 20:48

Choose a tag to compare

What's New

New Data Structures

  • SparseSet - O(1) key-value mapping with cache-friendly iteration, ideal for ECS
  • ZIndexBuckets - Ordered storage by z-index for render ordering

New Algorithms

  • A Pathfinding* - Single-source shortest path with pluggable heuristics (Euclidean, Manhattan, Chebyshev, Octile)
  • Floyd-Warshall - All-pairs shortest path algorithm
  • FloydWarshallOptimized - SIMD-accelerated and multi-threaded parallel implementation (5-16x faster)

New Utilities

  • Heuristics Module - Distance calculation functions for pathfinding
  • Hook Dispatcher - Comptime event dispatch system
  • ZON Coercion - Comptime struct/union coercion from .zon files

Improvements

  • QuadTree - Refactored with comptime configuration
  • Vector - Additional operations and integer position support
  • Tests moved to dedicated tests/ folder using zspec

Breaking Changes

  • Minimum Zig version updated to 0.15.2
  • QuadTree now uses QuadTree(T, config) signature

Full Changelog

v0.5.0...v0.6.0

v0.5.0

07 Dec 18:47

Choose a tag to compare

What's New

QuadTree Improvements

  • Added clear() method - clears all points while keeping the original boundary from init()
  • Added resize(boundary) method - clears all points and sets a new boundary
  • Fixed init() to properly initialize boundary tracking fields

Full Changelog

v0.4.0...v0.5.0

v0.4.0

07 Dec 17:54

Choose a tag to compare

What's New

Breaking Changes

  • QuadTree is now generic over ID type: QuadTree(T) instead of fixed u32
  • QuadTree uses EntityPoint(T) with Position field instead of separate x/y coordinates
  • Removed QuadTreeNode export (now internal type)

New Features

  • Sweep and Prune: O(n log n) broad-phase collision detection

    • SweepAndPrune(T) - generic over ID type
    • findCollisions() - find all overlapping AABB pairs
    • queryRect() and queryRadius() - spatial queries
    • AABB and CollisionPair helper types
  • QuadTree enhancements:

    • queryRadius(center, radius, buffer) - circular queries
    • remove(id) - remove entities by ID
    • update(id, new_pos) - update entity positions
    • hasPointInRect(range) - existence check without collecting results
    • resetWithBoundaries(positions) - reset with auto-computed bounds
  • Rectangle improvements:

    • fromPosition(pos, w, h) - create from Position
    • centered(pos, w, h) - create centered on Position
    • center() - get center Position
    • position() - get top-left Position
    • containsPosition(pos) - Position-based containment

Improvements

  • QuadTree uses flat array storage for better cache efficiency
  • All spatial queries now use Position type consistently
  • Both QuadTree and SweepAndPrune support generic ID types
  • 45 tests covering all functionality

v0.3.0

07 Dec 17:46

Choose a tag to compare

What's New

Breaking Changes

  • Renamed Vector2 to Position for clearer intent (#3)

New Features

  • Added PositionI struct for integer pixel-perfect positioning
  • Added mul, lengthSquared, distanceSquared methods to PositionI

Documentation

  • Added README.md with usage examples and API reference
  • Added claude.md for AI assistant context

Improvements

  • PositionI.fromPosition now rounds instead of truncating

Backwards Compatibility

  • Vector2 is still available as a deprecated alias for Position

v0.2.0

30 Nov 04:24
be9f093

Choose a tag to compare

What's New

QuadTree Spatial Partitioning

  • Added QuadTree data structure for efficient 2D spatial queries
  • Added Rectangle struct with contains() and intersects() methods
  • Added QuadTreeNode struct for entity storage
  • Operations: insert, query, queryNearest, clear, count
  • Optimized findNearest with quadrant pruning

Testing Infrastructure

  • Added zspec testing framework
  • BDD-style test organization with nested structs
  • 21 tests covering Vector2, Rectangle, and QuadTree

CI/CD

  • Added GitHub Actions workflow for automated testing
  • Runs on push/PR to main branch

Usage

const zig_utils = @import("zig_utils");
const QuadTree = zig_utils.QuadTree;
const Rectangle = zig_utils.Rectangle;

var qt = QuadTree.init(allocator, .{ .x = 0, .y = 0, .width = 100, .height = 100 });
defer qt.deinit();

try qt.insert(.{ .entity = 1, .x = 10, .y = 10 });

var result: std.ArrayListUnmanaged(zig_utils.QuadTreeNode) = .empty;
defer result.deinit(allocator);
try qt.query(.{ .x = 0, .y = 0, .width = 50, .height = 50 }, &result, allocator);

v0.1.0

30 Nov 00:01

Choose a tag to compare

Initial Release

First release of zig-utils - standalone vector math utilities for Zig with no external dependencies.

Features

  • Vector2 math utilities for 2D game development
  • Zero external dependencies
  • Compatible with Zig 0.15.x

🤖 Generated with Claude Code