calculate euclidean distance with numpy
Posted
by Nathan Fellman
on Stack Overflow
See other posts from Stack Overflow
or by Nathan Fellman
Published on 2009-09-09T19:48:49Z
Indexed on
2010/04/26
10:13 UTC
Read the original article
Hit count: 310
I have two points in 3D:
(xa,ya,za)
(xb,yb,zb)
And I want to calculate the distance:
dist = sqrt((xa-xb)^2 + (ya-yb)^2 + (za-zb)^2)
What's the best way to do this with Numpy, or with Python in general? I have:
a = numpy.array((xa,ya,za))
b = numpy.array((xb,yb,zb))
© Stack Overflow or respective owner