please help me to find the distance between two points
this is the derivation of the distance equation between two cells for hexagon type, please help me to get the distance between two cells for triangle and square cells
The formula remains unchanged.
You just measure the coordinates u,v in height of triangles. And taking into account that the height each triangle is 1/2 and the center of the triangle is at h/3 = 1/6.
u = 1/6+1/2+1/2+1/2 = 5/3
v = 1/2+1/6 = 2/3
D = sqrt(25+4+10)/3 = sqrt(39)/3
The general formula is that you put in your first message.
The only secret is the computation of u and v according to where in the triangle are the start and end points.
Depends what your data are given, something that we still not know.
If the data are [u1, v1] and [u2, v2], just apply the fornula.
But if the data are the centers of the triangles, you must count the number that separates in each direction, including the fraction of height (h/3 or 2h/3 ; h: height of the triangle).