sub solve{ my( $a, $b, $c, $d ) = @_; my( $x, $y ); $x = ($b - $a) / ($d - $a - $c + $b); $y = ($d - $a) * ($b - $a) / ($d - $a - $c + $b) + $a; return( $x, $y ); }
sub solve{ my( $a, $b, $c, $d ) = @_; my $x = ($b - $a) / ($d - $a - $c + $b); my $y = ($d - $a) * $x + $a; return( $x, $y ); }
formula for line 1: Y = (D - A) * X + A formula for line 2: Y = (C - B) * X + B intersection: X and Y coordinates of line1 and line2 are equal ... (D - A) * X + A = (C - B) * X + B reduces to => X = (B - A) / (D - A - C + B) plug X into equation for line 1 gives ... Y = (D - A) * (B - A) / (D - A - C + B) + A
In reply to Re: A little schoolboy math (but my schooldays were a long time ago).
by Roger
in thread A little schoolboy math (but my schooldays were a long time ago).
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |