the distance between 2 points in space

Started by
5 comments, last by APCJim 18 years, 7 months ago
does anyone know a good way to determine the distance between 2 points in space?
Advertisement
This should do it.

HERE

Hope that helps,

ace
thank you. is there a library with a squareroot function built in?
Probably be included by windows.h somewhere along the line, other than that i can't remember, sorry.

ace
I haven't seen a (modern) language without it.

C: sqrt (#include <math.h>)
C++: std::sqrt (#include <cmath>)
Java: Math.sqrt
Hey man! This is the Pythagoras theorem!

However this is the code

A = (x1, y1, z1)
B = (x2, y2, z2)

d = sqrt( (x2-x1)2 + (y2-y1)2 + (z2-z1)2 )
For C++.NET the square root function is Math::Sqrt().

This topic is closed to new replies.

Advertisement