]> mj.ucw.cz Git - anim.git/commitdiff
Uz umime pocitat i pruseciky s degenerovanymi parabolami.
authorMartin Mares <mj@ucw.cz>
Sun, 2 Dec 2007 20:34:44 +0000 (21:34 +0100)
committerMartin Mares <mj@ucw.cz>
Sun, 2 Dec 2007 20:34:44 +0000 (21:34 +0100)
fortune.pl

index 46bf34cd2bbe9e21c026d4a003e5bde45049a67a..df9f28dc517a2744f2fc0715e4653e8a59001b42 100755 (executable)
@@ -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