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 => 数组(x,y),b => 数组(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));