侧边栏壁纸
  • 累计撰写 100 篇文章
  • 累计创建 55 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录
PHP

PHP 根据两坐标绘制延长线

Malson
2022-06-25 / 0 评论 / 0 点赞 / 64 阅读 / 111 字
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'],
            ],
        ];
    }
    ```
0
博主关闭了所有页面的评论