-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathcuboid_turtle.pl
More file actions
executable file
·48 lines (41 loc) · 919 Bytes
/
cuboid_turtle.pl
File metadata and controls
executable file
·48 lines (41 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl
use strict;
use warnings;
use GD::Simple;
my $img = 'GD::Simple'->new(2000, 2000);
$img->moveTo(670, 800);
my $pi = atan2(1, -'inf');
my $nr = $pi * 100;
for (0 .. 280) {
$img->fgcolor('black');
$img->turn($nr);
$img->line(-$nr);
$img->turn(-134.2);
$img->line(-$nr);
$img->turn($nr);
$img->line(-$nr);
$img->turn(-134.1);
$img->line(-$nr);
$img->turn($nr);
$img->line(-$nr);
$img->turn(-134.2);
$img->line(-$nr);
$img->turn($nr);
$img->line(-$nr);
$img->fgcolor('red');
$img->turn(134.1);
$img->line(-$nr);
$img->fgcolor('black');
$img->turn(-134.1);
$img->line($nr);
$img->line(-$nr);
$img->turn(-90);
$img->line($nr);
$img->line(-$nr);
$img->turn(90);
$img->line(-$nr);
}
my $image_name = 'cuboid_turtle.png';
open my $fh, '>', $image_name or die $!;
print {$fh} $img->png;
close $fh;