Archived

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

ATronic

3D Distance Formula

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 this post


Link to post
Share on other sites
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!"

Share this post


Link to post
Share on other sites
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!"

Share this post


Link to post
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 x

float dy = y2 - y1; // delta y

float dz = z2 - z1; // delta z

float distance = sqrt(dx*dx + dy*dy + dz*dz);

Share this post


Link to post
Share on other sites
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!"

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites