function calcPoiGroupsExtendPoi($startPoi, $endPoi, $d)
{
$r = sqrt(pow($startPoi['x'] - $endPoi['x'], 2) + pow($startPoi['y'] - $endPoi['y'], 2));
return [
's' => [
'x' => (-$d * ($endPoi['x'] - $startPoi['x'])) / $r + $startPoi['x'],
'y' => (-$d * ($endPoi['y'] - $startPoi['y'])) / $r + $startPoi['y'],
],
'e' => [
'x' => ($d * ($endPoi['x'] - $startPoi['x'])) / $r + $startPoi['x'],
'y' => ($d * ($endPoi['y'] - $startPoi['y'])) / $r + $startPoi['y'],
],
];
}
```
版权归属:
Malson
许可协议:
MIT