I have point A(x,y) and B(x,y). they listed as array (a => array(x,y), b => array(x,y))
How get lenght between point A and B. Please help in php. :)
I have point A(x,y) and B(x,y). they listed as array (a => array(x,y), b => array(x,y))
How get lenght between point A and B. Please help in php. :)
Well, remember your high-school geometry.
r = square_root((x2 - x1)^2 + (y2 - y1)^2)
So in php:
$dx = $points['b'][0] - $points['a'][0];
$dy = $points['b'][1] - $points['a'][1];
$r = sqrt(pow($dx, 2) + pow($dy, 2));