distance formulas

BlitzMax Forums/BlitzMax Programming/distance formulas

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.

As for this:
distance# = (dx# * 0.41) + (dy# * 0.941246)

How can that possibly work with any degree of accuracy at all? You're setting the distance to be like, mostly the Y difference, and a bit of the X difference. Shouldn't those two numbers the differences are being multiplied be the same?

I guess I'll have to test it to be sure, but it seems like it couldn't possibly work... well!

edit:

Ah, I see the link tot he wikipedia article and reading that the above equation is incomplete. You have to do ABS on the differences, and you have to swap the values each difference is multiplied by if one is greater than the other.