两点计算器之间的距离
找到飞机上两点之间的直线距离。
输入结果时更新 。
关于此计算器
This calculator finds the straight-line distance between two points (x₁, y₁) and (x₂, y₂) using the distance formula, and also reports the horizontal change (Δx), the vertical change (Δy), and the midpoint of the segment, with a plot of the two points.
The distance formula, d = √((x₂ − x₁)² + (y₂ − y₁)²), is simply the Pythagorean theorem applied to a grid: the horizontal and vertical gaps are the two legs of a right triangle and the distance is the hypotenuse. Between (0, 0) and (3, 4), Δx = 3 and Δy = 4, so d = √(3² + 4²) = √(9 + 16) = √25 = 5. Because the differences are squared, the order of the points does not change the result, and negative coordinates work fine.
This is the everyday tool for map distances, the length of a line segment, the magnitude of a vector, and nearest-neighbour comparisons in data. Any two points on a plane have exactly one straight-line distance between them.
经常问到的问题
距离公式是什么?
d= ((x2)- x1)2+(y2)-(y1)2+(y2)-(y1)2。 在(0,0)和(3,4)之间,距离是 (9+16)= 25=5。
与毕达哥里定理有什么关系?
垂直和水平的缺口构成右三角的两条腿,距离是它的下限——因此,距离公式是网格上的比达哥拉斯。
什么是x和y?
它们是点、 x2 - x1 和 y2 - y1 之间的水平和垂直差异,即距离后面右三角的两腿。
工具显示中点吗?
是的,除了中间点的距离, 中间点的坐标正好是两点之间的一半。
点的顺序重要吗?
不,差异是平的,所以换掉两个点可以保持同样的距离。
它能处理负坐标吗?
是的,任何真正的坐标工作,包括负数和小数—— 间隔使每个距离保持正数。
API - 使用代码中的计算器
将此计算器称为自由 JSON 端点 。 不需要按键 。 将字段值发送到下面作为查询参数或 JSON 。 任何您省略的, 都会使用相同的默认值, 此页面预填的默认值是预填的; 未知参数是 400, 而不是静音零 。 读取 API 全部文件 →
终点
GET https://calculator.free/api/v1/distance-two-points/
curl
curl "https://calculator.free/api/v1/distance-two-points/?x1=0&y1=0&x2=3&y2=4"
JavaScript fetch()
const r = await fetch(
"https://calculator.free/api/v1/distance-two-points/?" + new URLSearchParams({
"x1": "0",
"y1": "0",
"x2": "3",
"y2": "4"
}));
const data = await r.json();
console.log(data.results);
成果仅是一般指导的估计数,而不是财务、医疗或税务咨询。