-----BEGIN PGP SIGNED MESSAGE-----
I’m a bit stupefied by the different results of this algorithm I
implemented (Euclidean distance for 3 dimensions):
Calculates the relative distance_to an arbitrary
Note: The algorithm is not yet optimized for speed.
Hopefully, it is accurate, though.
~ # Stub, will use vector math or so to approximate the true distance
~ distance = (self.x - actor.x)^2 + (self.y - actor.y)^2 + (self.z -
actor1 = Gondor::AI::Actor.new(:x => 0,:y => 0,:z => 0)
actor2 = Gondor::AI::Actor.new(:x => 16, :y => 16, :z => 16)
actor1 = Gondor::AI::Actor.new(:x => 1,:y => 1,:z => 1)
actor2 = Gondor::AI::Actor.new(:x => 15, :y => 15, :z => 15)
Why is that? From my understanding, these results should be identical
(The algebraic sign is eliminated by exponent 2, everything else is
Another thing that has me stumped is, that Math::sqrt requires the
absolute, but the result should be positive (addition of positive
Do I need to brush up my math more than I thought?
- – Phillip G.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----