N-dimensional geometric proximity - Grin with cat attached
|N-dimensional geometric proximity||Sep. 8th, 2005 02:46 pm|
For reasons likely to bore, I need to write an algorithm that includes finding the distance between two points in an N-dimensional geometric phase space.|
Now I know that in 2D the distance from x1,y1 to x2,y2 is sqrt((x1-x2)^2 + (y1-y2)^2), but all the maths they failed to teach me at Uni has drained away, meaning I can't remember the algorithm for higher dimensions.
I have a vague memory that the 3D equivalent should be sqrt((x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2). Is that right or do I need to deal in higher powers? Is it always square root(sum of squares)?