[Numpy-discussion] Distance Formula on an Array

Ian Mallett geometrian@gmail....
Sat Apr 25 13:50:11 CDT 2009


Hi,

I have an array sized n*3.  Each three-component is a 3D position.  Given
another 3D position, how is the distance between it and every
three-component in the array found with NumPy?

So, for example, if the array is:
[[0,0,0],[0,1,0],[0,0,3]]
And the position is:
[0,4,0]
I need this array out:
[4,3,5]
(Just a simple Pythagorean Distance Formula)

Ideas?
Thanks,
Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090425/54f617b0/attachment.html 


More information about the Numpy-discussion mailing list