Grid - create geometric grids
use Grid; my $grid = Grid->new($grid_width, $grid_height, $item_width, $item_height, $gutter, $border, $arrangement);
Grid creates an array of x-y positions for items of a given height and width arranged in a grid. This is used to create grid layouts on a page, or repeate items on a number of pages of the same size.
POSIX
List::AllUtils
Moose::Util::TypeConstraints
Moose
$grid->bbox();
Returns the total bounding box of the grid
$grid->numbers();
Returns the sequence item numbers, with the top left item as item 1.
+---------+---------+---------+---------+ | | | | | | 1 | 2 | 3 | 4 | | | | | | +---------+---------+---------+---------+ | | | | | | 5 | 6 | 7 | 8 | | | | | | +---------+---------+---------+---------+ | | | | | | 9 | 10 | 11 | 12 | | | | | | +---------+---------+---------+---------+
$grid->sequence();
Returns the sequence of x-y grid item coordinates, with the top left item as item [0, 0], the next one (assuming a horizontal arrangement) being [1, 0] etc.
[0, 0]
[1, 0]
+---------+---------+---------+---------+ | | | | | | [0, 0] | [0, 1] | [0, 2] | [0, 3] | | | | | | +---------+---------+---------+---------+ | | | | | | [1, 0] | [1, 1] | [1, 2] | [1, 3] | | | | | | +---------+---------+---------+---------+ | | | | | | [2, 0] | [2, 1] | [2, 2] | [2, 3] | | | | | | +---------+---------+---------+---------+
$grid->positions();
Returns the sequence of x-y grid coordinates.
$grid->total_height();
The total height of the grid
$grid->total_width();
The total width of the grid
Allow for different vertical and horizontal gutters
Allow for different top, bottom, left right borders
Allow for bottom or top start of grid
To install Math::Grid::Coordinates, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Grid::Coordinates
CPAN shell
perl -MCPAN -e shell install Math::Grid::Coordinates
For more information on module installation, please visit the detailed CPAN module installation guide.