sector 0.3.0 copy "sector: ^0.3.0" to clipboard
sector: ^0.3.0 copied to clipboard

Fast and intuitive 2D data structures: grids, graphs, pathfinding & more.

Change Log #

0.3.0 #

Major overhaul of the API, almost all classes and methods have been renamed or restructured; the API is now more consistent and easier to use, and has been layered partially on top of package:lodim; sector now includes data structures, graphs, grids, and pathfinding, with a more consistent API and is better tested and tuned for performance.

In summary:

  • Sector now depends on, and uses, package:lodim for 2D vector operations.
  • Sector now has types and functionality for general-purpose graphs and pathfinding.
  • Grid operations based on column-major order have been removed.
  • Grid has an empty field used for resizing and sparse-grid optimizations.
  • Grid resizing is now doen via setting widht or height respectively
  • Traversals have moved into general graph algorithms in package:sector.

0.2.0 #

  • Renamed <Grid>.contains to <Grid>.containsXY:

    - if (grid.contains(0, 0)) {
    + if (grid.containsXY(0, 0)) {
    
  • Added <Grid>.contains to check if a given element is within the grid, similar to List.contains:

    if (grid.contains('#')) {
      // ...
    }
    
  • Removed Uint8Grid, in favor of ListGrid.view(List<T>, {int width}):

    - final grid = Uint8Grid(3, 3);
    + final grid = ListGrid.view(Uint8List(3 * 3), width: 3);
    

    This reducs the API surface, and focuses on the key use-case of creating a grid without copying the data: using compact lists as backing storage without generics or codegen.

  • Added GridIterator, GridIterable and Traversal. These classes provide ways to iterate over the elements of a grid, and to traverse the grid in different directions.

    For example, a row-major traversal:

    for (final element in grid.traverse(rowMajor())) {
      // ...
    }
    

    See also:

    • rowMajor
    • drawLine
  • Added <Grid>.layoutHint and <Grid>.getByIndexUnchecked; these methods allow for more efficient traversal of the grid, by providing a hint about the layout of the grid, and by accessing elements by index without extra bounds checking.

    Most users never need to use these methods.

0.1.1 #

  • Added Uint8Grid, the first sub-type of TypedDataGrid. A Uint8Grid, like it's counterpart Uint8List, is a grid of unsigned 8-bit integers, which makes it suitable for storing pixel data, tile maps, and other data that can be represented as a grid of 8-bit values.

0.1.0 #

🎉 Initial release 🎉

12
likes
0
pub points
20%
popularity

Publisher

verified publisherlurey.dev

Fast and intuitive 2D data structures: grids, graphs, pathfinding & more.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

lodim, meta

More

Packages that depend on sector