Expand description
§NBSlim – Geometric compression algorithms for 2D point sets
This crate implements SIA, SIATEC, COSIATEC, and RecurSIA – algorithms that discover
translational equivalence classes (TECs) in planar point sets. It is designed primarily
for compressing Note Block Studio (.nbs) music files but works on any set of points
in the plane.
§Algorithms
- SIA – finds all maximal translatable patterns from a point set.
- SIATEC – builds translational equivalence classes from SIA results.
- COSIATEC – greedy lossless compression: repeatedly extracts the best TEC and removes its covered points.
- RecurSIA – recursive version of COSIATEC that compresses patterns of each TEC to capture nested repetitions.
§Examples
Basic compression:
use nbslim::cosiatec_compress;
let points = vec![(0, 100), (1, 200), (2, 100), (3, 200)];
let tecs = cosiatec_compress(&points, true, true);
assert!(tecs.len() > 0);Modules§
- utils
- Utility functions for converting between note events and points, merging TECs, computing compression statistics, and reconstructing original data.
Structs§
- Translational
Equivalence - A translational equivalence class (TEC) consisting of a pattern (a set of points) and a set of non‑zero translation vectors that map the pattern onto other occurrences within the same dataset.
Functions§
- build_
tecs_ from_ mtps - Builds translational equivalence classes (TECs) for every maximal translatable pattern (MTP) found in the dataset by the SIA algorithm.
- build_
tecs_ from_ mtps_ sweepline - Builds translational equivalences (TECs) using sweepline both for MTP discovery and exact matching.
- cosiatec_
compress - COSIATEC: a greedy, iterative compression algorithm based on translational equivalence classes (TECs).
- find_
mtps - Finds all maximal translatable patterns (MTPs) in a 2‑D point set using the SIA algorithm.
- recursive_
cosiatec_ compress - RECURSIA (Recursive SIA) applied to the COSIATEC compression algorithm.