From: Marius Gavrilescu Date: Wed, 17 Jun 2015 13:04:53 +0000 (+0300) Subject: Set h to 0 when C is very small X-Git-Tag: 0.002~7 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=00e063a53708d76f2a54ce1eaf20638681336f03;p=convert-color-husl.git Set h to 0 when C is very small --- diff --git a/lib/Convert/Color/LCh.pm b/lib/Convert/Color/LCh.pm index 83cf1bf..3632729 100644 --- a/lib/Convert/Color/LCh.pm +++ b/lib/Convert/Color/LCh.pm @@ -37,6 +37,7 @@ sub new_from_luv { my ($class, $luv) = @_; my ($l, $u, $v) = @$luv; my $c = sqrt $u * $u + $v * $v; + return $class->new($l, $c, 0) if $c < 0.00000001; my $hrad = atan2 $v, $u; my $h = $hrad * 180 / pi; $h += 360 if $h < 0;