Function: distance()
ts
function distance(a, b): number;Euclidean distance between two coordinate vectors (2D, 3D, or same length). 两点欧氏距离(坐标数组长度须相同,支持 2D/3D 等)。
Parameters
| Parameter | Type | Description |
|---|---|---|
a | number[] | First point coordinates / 第一点坐标 |
b | number[] | Second point coordinates / 第二点坐标 |
Returns
number
Distance / 距离
Example
ts
distance([0, 0], [3, 4]) // => 5Since
1.0.0