NAME
Math::HexGrid::Hex
VERSION
version 0.01
SYNOPSIS
use Math::HexGrid::Hex;
my $hex = Math::HexGrid:Hex->new(1,-1); # axial notation
my $hex = Math::HexGrid:Hex->new(1,-1, 0 ); # cube notation
DESCRIPTION
This module is a class for representing hexagons on hex grids. It uses the cube or axial (trapezoidal) coordinate notation. It provides some basic utility methods for hex operations like add, subtract, multiply, distance and neighbor.
NAME
Math::HexGrid::Hex - a hex class for use with hex grids
METHODS
new ($q, $r, $s)
Creates a new Hex object.
hex_equal ($hex)
Compare two Hex objects for equality
hex_add($hex)
Adds another Hex to the object and returns a new Hex object.
hex_subtract ($hex)
Subtract another Hex object and return a new Hew object.
hex_multiply ($hex)
Multiply the Hex by another Hex and return a new Hex object.
hex_distance ($hex)
Get the distance from this Hex object to another.
hex_neighbor ($direction)
Returns a new neighboring hex in the direction given (0-5).
AUTHOR
David Farrell <dfarrell@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by David Farrell.
This is free software, licensed under:
The (two-clause) FreeBSD License