# Grid Distances

• Feb 19th 2010, 01:22 PM
Mystery
Grid Distances
Given a basic X & Y grid what is the formula to determine distance between two grid items?
I.E
First item is at grid 5, 6 second grid item is at 7, 8.
• Feb 19th 2010, 01:35 PM
e^(i*pi)
Quote:

Originally Posted by Mystery
Given a basic X & Y grid what is the formula to determine distance between two grid items?
I.E
First item is at grid 5, 6 second grid item is at 7, 8.

It's a form of Pythagoras' Theorem.

For two points $\displaystyle (x_1, y_1)$ and $\displaystyle (x_2,y_2)$ the distance between them (d) is given by:

$\displaystyle d = \sqrt{(y_2-y_1)^2 + (x_2-x_1)^2}$
• Feb 19th 2010, 02:29 PM
Plato
Quote:

Originally Posted by Mystery
Given a basic X & Y grid what is the formula to determine distance between two grid items?
First item is at grid 5, 6 second grid item is at 7, 8.

No it is not a form of Pythagoras' Theorem.
It is the grid-metric or the 'taxicab' metric.
If $\displaystyle P(x_1,y_1)~\&~Q(x_2,y_2)$ then the grid-metric is $\displaystyle d(P,Q)=\left| {x_1 - x_2 } \right| + \left| {y_1 - y_2 } \right|$
• Feb 20th 2010, 11:53 AM
shayan603
what kind of grid is it?