Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
40
Task/Pentagram/Perl/pentagram.pl
Normal file
40
Task/Pentagram/Perl/pentagram.pl
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
use SVG;
|
||||
|
||||
my $tau = 2 * 4*atan2(1, 1);
|
||||
my $dim = 200;
|
||||
my $sides = 5;
|
||||
|
||||
for $v (0, 2, 4, 1, 3, 0) {
|
||||
push @vx, 0.9 * $dim * cos($tau * $v / $sides);
|
||||
push @vy, 0.9 * $dim * sin($tau * $v / $sides);
|
||||
}
|
||||
|
||||
my $svg= SVG->new( width => 2*$dim, height => 2*$dim);
|
||||
|
||||
my $points = $svg->get_path(
|
||||
x => \@vx,
|
||||
y => \@vy,
|
||||
-type => 'polyline',
|
||||
);
|
||||
|
||||
$svg->rect (
|
||||
width => "100%",
|
||||
height => "100%",
|
||||
style => {
|
||||
'fill' => 'bisque'
|
||||
}
|
||||
);
|
||||
|
||||
$svg->polyline (
|
||||
%$points,
|
||||
style => {
|
||||
'fill' => 'seashell',
|
||||
'stroke' => 'blue',
|
||||
'stroke-width' => 3,
|
||||
},
|
||||
transform => "translate($dim,$dim) rotate(-18)"
|
||||
);
|
||||
|
||||
open $fh, '>', 'pentagram.svg';
|
||||
print $fh $svg->xmlify(-namespace=>'svg');
|
||||
close $fh;
|
||||
Loading…
Add table
Add a link
Reference in a new issue