Line circle intersection: Difference between revisions
m
→{{header|Perl}}: clean up punctuation
SqrtNegInf (talk | contribs) (Added Perl example) |
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: clean up punctuation) |
||
Line 200:
my $b = 2 * ($f[0]*$d[0] + $f[1]*$d[1]);
my $c = sum(map { $_**2 } @f) - $radius**2;
my $D = $b**2 -
return unless $D >= 0;
my ($t1, $t2) = ( (-$b - sqrt
return unless
my ($dx, $dy) = ($$P2[0] - $$P1[0], $$P2[1] - $$P1[1]);
Line 221:
);
sub rnd { map {
for my $d (@data) {
my @solution = find_intersection
say 'For input: ' . join
say 'Solutions: ' . (@solution > 1 ?
say '';
}</lang>
|