From: Martin Mares Date: Sun, 2 Dec 2007 20:34:44 +0000 (+0100) Subject: Uz umime pocitat i pruseciky s degenerovanymi parabolami. X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=5ae71016a8e0a036badab8adb5503eb1c0b91092;p=anim.git Uz umime pocitat i pruseciky s degenerovanymi parabolami. --- diff --git a/fortune.pl b/fortune.pl index 46bf34c..df9f28d 100755 --- a/fortune.pl +++ b/fortune.pl @@ -73,6 +73,13 @@ sub para_isec($$$$$$) { my ($a, $b, $c, $d, $e, $f) = @_; if (!defined($a) || !defined($b)) { # Either is degenerate + if (defined($a)) { + my $y = $a*sqr($e-$b) + $c; + if ($y < $f) { return [$e, $y]; } else { return; } + } elsif (defined($d)) { + my $y = $d*sqr($b-$e) + $f; + if ($y < $c) { return [$b, $y]; } else { return; } + } return; } # Coefficients of the corresponding quadratic equation