I have question
What php can do for calculate the distance between two (x,y) coordinate?
Is there any coding can help me?
calculate between two coordinate
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
standard distance formula:oror
Code: Select all
$d = sqrt(pow($x2 - $x1,2) + pow($y2 - $y1,2));Code: Select all
$d = sqrt(($x2 - $x1) * ($x2 - $x1) + ($y2 - $y1) * ($y2 - $y1));Code: Select all
$d = sqrt($x2 * $x2 + 2 * $x2 * $x1 + $x1 * $x1 + $y2 * $y2 + 2 * $y2 * $y1 + $y1 * $y1);