PDA

Click to See Complete Forum and Search --> : Distance between 2 points in 3D


eXterminator
Nov 20th, 2004, 07:00 PM
How do I find the distance between two points in 3D?

Acidic
Nov 20th, 2004, 07:07 PM
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

eXterminator
Nov 20th, 2004, 07:12 PM
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?

Acidic
Nov 20th, 2004, 07:17 PM
Yes you're right. I'm too tired for any of this right now.

Arachnid13
Nov 28th, 2004, 04:18 PM
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

SLH
Nov 28th, 2004, 04:33 PM
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 errr....

You're formula is identical to eXterminator's (corrected) one.

Arachnid13
Nov 29th, 2004, 02:21 PM
woops, so it is. sorry bout that! i didnt notice the corrected one :blush: