2D/3D Distance DLL

Blitz3D Forums/Blitz3D Userlibs/2D/3D Distance DLL

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

You can do this easily with just Blitz commands, but I dont know, maybe its faster in C++. Probably not. You can also find this in DLL Toolbox.

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.