Task

Using the data storage type defined on this page for raster images,
write an implementation of the midpoint circle algorithm   (also known as Bresenham's circle algorithm).

(definition on Wikipedia).




# 20220301 Perl programming solution
 
use strict;
use warnings;
 
use Algorithm::Line::Bresenham 'circle';
 
my @points;
my @circle = circle((10) x 3);
 
for (@circle) { $points[$_->[0]][$_->[1]] = '#' }
 
print join "\n", map { join '', map { $_ || ' ' } @$_ } @points