The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Math::Shape::Grid - a 2d grid for visualizing Math::Shape::Point objects on the terminal

VERSION

version 0.01

SYNOPSIS

my $p1 = Math::Shape::Point->new(1, 1, 0);
my $p2 = Math::Shape::Point->new(2, 2, 0);
my $p3 = Math::Shape::Point->new(3, 3, 0);

Math::Shape::Grid::print({ p1 => $p1, p2 => $p2, p3 => $p3 });

# prints:
p1 x:  1, y:  1, r:     0
p2 x:  2, y:  2, r:     0
p3 x:  3, y:  3, r:     0

    -5 -4 -3 -2 -1  0  1  2  3  4  5  6  7  8 x
  8  .  .  .  .  .  .  .  .  .  .  .  .  .  .
  7  .  .  .  .  .  .  .  .  .  .  .  .  .  .
  6  .  .  .  .  .  .  .  .  .  .  .  .  .  .
  5  .  .  .  .  .  .  .  .  .  .  .  .  .  .
  4  .  .  .  .  .  .  .  .  .  .  .  .  .  .
  3  .  .  .  .  .  .  .  . p3  .  .  .  .  .
  2  .  .  .  .  .  .  . p2  .  .  .  .  .  .
  1  .  .  .  .  .  . p1  .  .  .  .  .  .  .
  0  .  .  .  .  .  .  .  .  .  .  .  .  .  .
 -1  .  .  .  .  .  .  .  .  .  .  .  .  .  .
 -2  .  .  .  .  .  .  .  .  .  .  .  .  .  .
 -3  .  .  .  .  .  .  .  .  .  .  .  .  .  .
 -4  .  .  .  .  .  .  .  .  .  .  .  .  .  .
 -5  .  .  .  .  .  .  .  .  .  .  .  .  .  .
 y

FUNCTIONS

print

Prints a grid to STDOUT. Requires a hashref of Math::Shape::Point objects.

Math::Shape::Grid::print($points);

AUTHOR

David Farrell <sillymoos@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by David Farrell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.