2013-04-08 83 views

回答

3

答案是直forward.Its數學,而不是PHP

<?php 
    //Coordinates are (a,b) and (c,d) 
    //the point (x,y) is the required point. 
    $a=1; 
    $b=2; 
    $c=3; 
    $d=4; 

    $m=($d-$b)/($c-$a); 
    //echo $m."\n"; 

    $x=10; 
    $y=20; 
    //echo $y-($m*$x)-$b+($m*$a)."\n"; 
    $distance=abs($y-($m*$x)-$b+($m*$a))/sqrt(1+($m*$m)); 
    echo $distance; 
    ?> 
+0

非常感謝。奇蹟般有效 :) – 2013-04-08 15:24:30

相關問題