Quote:
Originally Posted by legodude
isnt that pythagoras?
|
Pythagoras:
aІ+bІ=cІ
We've got:
xІ+yІ+zІ=aІ
It has it's origin from Pythagoras, but we just added another dimension.
Proof that it works:
Imagine the world would be a coordination system. We've got a triangle, so we first use Pythagoras to get the distance of the points on the ground level:
xІ+yІ=d(xy)І
d(xy) means the distance, from X to Y.
Now, when we've got the ground level, we add the altitude, Z. We get this:
d(xy)І+zІ=d(xyz)І
Now we can easily replace d(xy)І with xІ+yІ. What we get looks like this:
xІ+yІ+zІ=d(xyz)І
We want d(xyz), not d(xyz)І, so we use the squareroot. Now we've got:
√(xІ+yІ+zІ) = √d(xyz)І = d(xyz)
I don't know if this was necessary for you, but it might help some people to understand the background of the code.