| 1 | package Math::Geometry::HexGrid::Hex; | ||||||||||||
| 2 | |||||||||||||
| 3 | 2 | ▶ | use 5.014; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | # Ensure parent module and XS binary are loaded | ||||||||||||
| 8 | 2 | require Math::Geometry::HexGrid; | |||||||||||
| 9 | |||||||||||||
| 10 | 2 | our $VERSION = '0.01'; | |||||||||||
| 11 | |||||||||||||
| 12 | use overload | ||||||||||||
| 13 | 2 | ▶ | '""' => \&to_string, | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | '==' => \&equals, | ||||||||||||
| 15 | 1 | ▶ | '!=' => sub { !equals(@_) }, | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 16 | 2 | fallback => 1; | |||||||||||
| 17 | |||||||||||||
| 18 | 1 | ▶ | sub neighbors { | ||||||||||
|
Subroutine
neighbors: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 19 | 1 | my ($self) = @_; | |||||||||||
| 20 | 1 | my @raw = Math::Geometry::HexGrid::hex_neighbors($self->col, $self->row); | |||||||||||
| 21 | 1 | return map { Math::Geometry::HexGrid::Hex->new($_->[0], $_->[1]) } @raw; | |||||||||||
| 22 | } | ||||||||||||
| 23 | |||||||||||||
| 24 | 1 | ▶ | sub ray_to { | ||||||||||
|
Subroutine
ray_to: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||
| 25 | 1 | my ($self, $other, $max_len) = @_; | |||||||||||
| 26 | 1 | ▶ | $max_len //= 100; | ||||||||||
|
Condition50%1/2
$max_len //= 100
MC/DC0%0/1
$max_len //= 100
$max_len
Truth table50%1/2
A
A= $max_len
| |||||||||||||
| 27 | 1 | my @raw = Math::Geometry::HexGrid::hex_collinear_ray($self->col, $self->row, $other->col, $other->row, $max_len); | |||||||||||
| 28 | 1 | return map { Math::Geometry::HexGrid::Hex->new($_->[0], $_->[1]) } @raw; | |||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | 2 | 1; | |||||||||||
| 32 | |||||||||||||