Julia set: Difference between revisions
m
→{{header|Perl 6}}: more efficient color space conversion
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Small tweaks, finishes in 1/3 the time, same output) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: more efficient color space conversion) |
||
Line 1,186:
}
sub hsv2rgb ( $h, $s, $v ){
my $c = $v * $s;
my $x = $c * (1 - abs( (($h*6) % 2) - 1 ) );
my $m = $v - $c;
my ($r, $g, $b) = (do given $h {
when 0..^
when 1/6..^
when 1/3..^
when 1/2..^
when 2/3..^
when 5/6..1
▲ ( $r, $g, $b ).map: ((*+$m) * 255).Int
}</lang>
|