Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / 3d distance equation?

Author
Message
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 24th Mar 2004 02:42
Hi all, im in need of an equation that works out the distance between two points in 3d space, using x1,y1,z1 & x2,y2,z2 as coordinates. I had a go but its been so long ive totally forgotten it. Any help is appreciated.

Cheers

Currently thinking of a new company name
Sticking to a project idea for once
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 24th Mar 2004 03:05
IIRC...

deltaX# = x1 - x2
deltaY# = y1 - y2
deltaZ# = z1 - z2

distance# = sqr((deltaX#*deltaX#)+(deltaY#*deltaY#)+(deltaZ#*deltaZ#))

I've seen this question come up before and people posting more elegant solutions, so this topic is worth searching the forums for.
--
TAZ

M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 24th Mar 2004 03:10
Ok thanks zircher, appreciate it.

Currently thinking of a new company name
Sticking to a project idea for once

Login to post a reply

Server time is: 2025-06-02 04:18:44
Your offset time is: 2025-06-02 04:18:44