3D Distance Formula

Started by
5 comments, last by ATronic 22 years, 8 months ago
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!"
Alex BroadwinA-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!"
Advertisement
Distance = [(x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2]^1/2
Thanks, but what do the [ and ] represent?


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!"
Alex BroadwinA-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!"
List it as you would in c++ for two points. That would be a good example for me.

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!"
Alex BroadwinA-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!"
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);  
Thanks a million!

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!"
Alex BroadwinA-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!"
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.

This topic is closed to new replies.

Advertisement