Question
Make two 3D-points in a 3-Dimensional space. Calculate the distance between these two points. Instead of integer data type, use any other datatype for x,y,z values. Create an object pt, and call distance function as pt.Distance(pt2), which will calculate the distance between two 3-D points.
Answers
oobleck
Recall that in 2D, d^2 = x^2+y^2
In 3D, d^2 = x^2+y^2+z^2
where x,y,z are the distances, not the coordinates.
In 3D, d^2 = x^2+y^2+z^2
where x,y,z are the distances, not the coordinates.