An open API service indexing awesome lists of open source software.

https://github.com/dnmfarrell/math-hexgrid


https://github.com/dnmfarrell/math-hexgrid

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

          

=pod

=encoding UTF-8

=head1 NAME

Math::HexGrid - Math::HexGrid - create hex coordinate grids

=head1 VERSION

version 0.04

=head1 DESCRIPTION

This module is for creating hex grids of L objects. For
now it only supports hexagonally-shaped grids. It supports both cube and
axial (trapezoidal) coordinate systems.

=head1 METHODS

=head2 new_hexagon ($radius)

Constructs a new hexagonally-shaped grid of size C<$radius>.

=head2 new_triangle ($rows)

Constructs a new triangle-shaped grid with C<$rows> number of rows.

=head2 hexgrid

Returns a hashref of all hexes in the grid.

=head2 hex ($q, $r)

Returns the hex at location C<$q> and C<$r>.

=head2 count_sides

Returns a count of all unique sides (edges) in the grid.

=head1 SEE ALSO

This code was helped by Amit Patel's L on hexagonal grids.

=head1 AUTHOR

David Farrell

=head1 COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by David Farrell.

This is free software, licensed under:

The (two-clause) FreeBSD License

=cut