tapestry 0.1.0

Generic 2D grid data structure and utilities.
Documentation
  • Coverage
  • 32%
    24 out of 75 items documented0 out of 49 items with examples
  • Size
  • Source code size: 41.96 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.52 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • zerovolts/tapestry
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • zerovolts

A library that implements many common operations over generic 2D matrices. This came about after having implemented the same flood-fill, neighbor selection, and other operations in multiple grid-based game projects.

The core of this library is the Grid<T> type along with its selection and flood iterators.

The flood iterator takes a starting coordinate and a predicate, and executes a flood fill to return all the recursively adjacent coordinates satisfying the predicate (such as being the same color in a paint program).

The selection iterator takes a collection of coordinates and returns the values of each of the cells. The returned values of the flood iterator, as well as the various "patterns" that exist (line, rect, neighbors) can be plugged into this in order to access and mutate collections of grid cells.

Flood fill example (Minesweeper)

Flood fill example (Minesweeper)

Line pattern example

Line pattern example

Rect binary space partitioning example (dungeon rooms)

Rect BSP example