package toffee
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9
doc/compute_grid/Compute_grid/Grid_track_counts/index.html
Module Compute_grid.Grid_track_countsSource
Track count management and coordinate system conversions for CSS Grid layout.
This module maintains counts of tracks in the implicit and explicit grids and provides conversions between two coordinate systems used internally:
- OriginZero coordinates: Normalized grid line indices where the left/top edge of the explicit grid is line 0, counting up to the right/down and down to the left/up (negative indices).
- CellOccupancyMatrix track indices: Zero-based indices into the track occupancy matrix, where 0 is the leftmost track of the implicit grid.
Invariant: The total track count equals negative_implicit + explicit + positive_implicit.
The module also handles conversion to GridTrackVec indices, where even indices represent lines and odd indices represent tracks.
Construction
make ~negative_implicit ~explicit ~positive_implicit creates track counts from raw numbers.
Track Count Queries
len t returns the total number of tracks across implicit and explicit grids.
negative_implicit t returns the number of tracks in the negative implicit grid.
positive_implicit t returns the number of tracks in the positive implicit grid.
Grid Boundaries
implicit_start_line t returns the OriginZero line at the start of the implicit grid. Always negative or zero.
implicit_end_line t returns the OriginZero line at the end of the implicit grid. Always positive or zero.
Coordinate Conversions
oz_line_to_next_track t line converts an OriginZero grid line to the index of the track immediately following it in the CellOccupancyMatrix.
oz_line_range_to_track_range t range converts a line range in OriginZero coordinates to an exclusive track index range in the CellOccupancyMatrix.
track_to_prev_oz_line t index converts a CellOccupancyMatrix track index to the OriginZero line immediately preceding it.
track_range_to_oz_line_range t range converts an exclusive track index range from the CellOccupancyMatrix to a line range in OriginZero coordinates.
oz_line_to_track t line converts an OriginZero grid line to a GridTrackVec index (even indices). Returns None if the line is outside the implicit grid. The result is doubled to account for interleaved lines and tracks in the GridTrackVec representation.