#### Archived

This topic is now archived and is closed to further replies.

# 3D Distance Formula

This topic is 6355 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey, I know this sounds stupid, and it''s a simple formula, but for some reason I can''t remember it right now. I figured a quick answer might come from this forum. What is the 3D distance formula? I know I''ve used it many times in the past, but it escapes me at this time. Thanks ahead of time! Alex Broadwin A-Tronic Software & Design ----- "if you fail in life, you were destined to fail. If you suceed in life, call me." "The answer is out there." "Please help, I''m using Windows!"

##### Share on other sites
Distance = [(x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2]^1/2

##### Share on other sites
Thanks, but what do the [ and ] represent?

A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."

##### Share on other sites
List it as you would in c++ for two points. That would be a good example for me.

A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."

##### Share on other sites
the [ and ] were just meant as parenthesises (sp?), written differently than the standard ( and ) simply to clarify where each sub-expression begins and ends.

It''s the standard pythagorean theorem for 3 dimensions.

in C/C++
  float dx = x2 - x1; // delta xfloat dy = y2 - y1; // delta yfloat dz = z2 - z1; // delta zfloat distance = sqrt(dx*dx + dy*dy + dz*dz);

##### Share on other sites
Thanks a million!

A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."

##### Share on other sites
Yeah, I remember someone was writing an equation and used the [], it was a bit confusing until I realized math people wouldn''t put up with (( in their equations. It is a bit hard to read, especially on really long equations. I usually break down my equations into multiple lines, it helps if I decide to rewrite in asm later.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633729
• Total Posts
3013578
×