Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ポイントA(x、y)とB(x、y)があります。それらは配列としてリストされています (a => array(x,y), b => array(x,y))
ポイントAとBの間の長さを取得する方法。phpで助けてください。:)
さて、高校の幾何学を思い出してください。
r = square_root((x2 - x1)^2 + (y2 - y1)^2)
だからPHPで:
$dx = $points['b'][0] - $points['a'][0]; $dy = $points['b'][1] - $points['a'][1]; $r = sqrt(pow($dx, 2) + pow($dy, 2));