Te tātaitai tawhiti i waenganui i ngā ira e rua
Ka kitea te tawhiti o te raina hāngai i waenganui i ngā pito e rua i runga i te rererangi.
Ka whakahōutia ngā hua i te wā e tātuhi ana.
Mo tēnei tātaitai
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.
Ko nga pātai e pā ana
He aha te tātai tawhiti?
Ko d = √((x2 − x1)² + (y2 − y1)²). I waenganui i te (0,0) me te (3,4) ko te tawhiti ko te √(9 + 16) = √25 = 5.
He pēhea te pātahitanga ki te kupu Pythagorean?
Ko ngā mokowā whakawhāiti me ngā mokowā poutū e hanga ana i ngā kōpaka e rua o tētahi tapawhā tika, ā, ko te tawhiti ko tōna pātata — nō reira ko te tātai tawhiti ko Pythagoras i runga i te kāwai.
He aha te Δx me te Δy?
Ko ēnei ngā rerekētanga pāwhewa me te poutū i waenganui i ngā ira, x2 − x1 me y2 − y1 — ko ngā kōaro e rua o te tapawhā tika i muri i te tawhiti.
E whakaatu ana te utauta i te wāhi waenganui?
He. I te taha o te tawhiti e hoatu ana e ia ki te pito matua, ko te taururuku e tika ana te waenganui i waenganui i ngā pito e rua.
He mea hira te raupapa o ngā ira?
Kāore. He tapawhā nga rerekētanga, nō reira ko te whakawhitinga i ngā pito e rua e tuku ana i te tawhiti ōrite.
Ka taea e ia te whakahaere i ngā taururuku tōraro?
He. He mahi ngā taururuku tūturu katoa, tae atu ki ngā tōraro me ngā ira — ka pupuri te tapawhā i ngā tawhiti tōrunga katoa.
API — whakamahi tēnei tātaitai mai i te waehere
E kī ana tēnei tātaitai hei wāhi mutunga kore JSON - kāore he kī e hiahiatia ana. Ka tukuna ngā uara āpure i raro nei hei tohutoro pātai, JSON rānei. Anything you omit uses the same default this page is pre-filled with; an unknown parameter is a 400, never a silent zero. Ka pānui te papatono API katoa →
Whakamutunga
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);
Ko ngā hua he whakataunga mō te tohutohu ahuwhānui anake, ehara i te tohutohu moni, rongoā, tāke rānei.