How do I find the distance between two points in 3D?
Printable View
How do I find the distance between two points in 3D?
let's say the points are:
(x1,y1,z1) and (x2,y2,z2)
You then basically do pythagoras thingy twice. So:
distance = sqrt(sqrt((x2-x1)2 + (y2-y1)2) + (z2-z1)2)
Edit: edited, forgot the 2's
Shouldn't that be:
distance = sqrt(sqrt((x2-x1)2 + (y2-y1)2)2 + (z2-z1)2)
thus would equal:
distance = sqrt((x2-x1)2 + (y2-y1)2 + (z2-z1)2)
Or did I miss something?
Yes you're right. I'm too tired for any of this right now.
u crazy fools, it is exactly the same as the the distance between two points in 2-dimensions except u add in a bit for the third dimension, u dont need any extra spuare roots or anything.
d = ((x1 - x2) ^ 2 + (y1 - y2) ^ 2 + (z1 - z2) ^ 2) ^ 0.5
errr....Quote:
Originally posted by Arachnid13
u crazy fools, it is exactly the same as the the distance between two points in 2-dimensions except u add in a bit for the third dimension, u dont need any extra spuare roots or anything.
d = ((x1 - x2) ^ 2 + (y1 - y2) ^ 2 + (z1 - z2) ^ 2) ^ 0.5
You're formula is identical to eXterminator's (corrected) one.
woops, so it is. sorry bout that! i didnt notice the corrected one :blush: