Re: No response?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi

The formula for 3d distance is almost the same as the one for 2d
distance
for the points (x1, y1, z1) and (x2, y2, z2)
instead of distance=((x2-x1)^2+(y2-y1)^2)^.5 as in 2d just do
                distance=((x2-x1)^2+(y2-y1)^2+(z2-z1)^2)^.5



I think in Euphoria we might do something like this:

--Start of Euphoria Code
sequence p1, p2
atom distance

p1={1,2,3) ---- 3d coordinates of point 1
p2={4,5,6) ---- 3d coordinates of point 2
distance=((p2[1]-p1[1])^2 + (p2[2]-p1[2])^2 + (p2[3]-p1[3])^2)^.5

-- End of Euphoria Code

This code is just off the top of my head - I'm sure a much more
elegant and compact expression is possible in Euphoria.

Bye
Martin

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu