Advertisement
Aleksander

Distance between two points in 3D

Jan 24th, 2012
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. /*
  2.     @info: retrieves the distance between point 1 and point 2 (third dimension).
  3.     @author: the creator of the third dimension.
  4. */
  5. float distance3d(float px, float py, float pz, float dx, float dy, float dz)
  6. {
  7.     return sqrtf(powf(dx - px, 2.0f) + powf(dy - py, 2.0f) + powf(dz - pz, 2.0f));
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement