Results 1 to 7 of 7

Thread: Distance between 2 points in 3D

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2001
    Location
    Sweden
    Posts
    174

    Distance between 2 points in 3D

    How do I find the distance between two points in 3D?
    [In time of development time stands still]

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    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
    Have I helped you? Please Rate my posts.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2001
    Location
    Sweden
    Posts
    174
    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?
    [In time of development time stands still]

  4. #4
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Yes you're right. I'm too tired for any of this right now.
    Have I helped you? Please Rate my posts.

  5. #5
    Hyperactive Member Arachnid13's Avatar
    Join Date
    Jan 2003
    Location
    England
    Posts
    327
    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
    Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White

  6. #6
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    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.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  7. #7
    Hyperactive Member Arachnid13's Avatar
    Join Date
    Jan 2003
    Location
    England
    Posts
    327
    woops, so it is. sorry bout that! i didnt notice the corrected one
    Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width