Blitz Toolbox/DLLs/Distance Formula

Distance Formula by Xzider

http://xelevgames.servegame.com/forums/BloodBane/

About

http://xelevgames.servegame.com/Site/Downloads/DLL/DistanceDLL.zip

This is a distance formula for 2D x,y coords and 3D x,y,z coords. Post at forums at http://xelevgames.servegame.com/forums/BloodBane/ for comments/suggestions

Example - after putting Distance.dll and Distance.decls in Blitz3D\userlibs folder, open blitz basic and type

Print "2D Distance Example 1: " + dist2d(10,10,10,10) ;Should be 0
Print "2D Distance Example 2: " + dist2d(10,10,10,11) ;Should be 1, changed second y coord

Print "3D Distance Example 1: " + dist3d(50,2,100,50,2,100) ;Should be 0
Print "3D Distance Example 1: " + dist3d(50,2,100,159,5,255) ;Should be 189

WaitKey
End

This DLL was made in C++ and was very simple, took me around 5 minutes to make in C++.

Revisions:

December 15 2007:

Changed return type of dist2d/dist3d functions to float, I made them integers by accident.