From 5ae71016a8e0a036badab8adb5503eb1c0b91092 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 2 Dec 2007 21:34:44 +0100 Subject: [PATCH] Uz umime pocitat i pruseciky s degenerovanymi parabolami. --- fortune.pl | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- 2.39.2