Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: directional system: more magic codecleanups
Home

[Freeciv-Dev] Re: directional system: more magic codecleanups

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: directional system: more magic codecleanups
From: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Date: Tue, 18 Sep 2001 01:57:24 -0400
Reply-to: jdorje@xxxxxxxxxxxxxxxxxxxxx

"Ross W. Wetmore" wrote:
> 
> I like the scalar product as a way to reduce the code flow noise
> plus reduce the possibility of getting one of the tests or magic
> numbers wrong.
> 
> The key elements of this are that any point in the 4 quadrants
> is reduced to a diagonal unit vector, and only if you are on one
> of the cartesian axes do you get a cartesian unit vector.
> 
> Thus most of the time, straightest direction implemented by these
> diff tests will return a diagonal move. And the iterated walk is
> to march down the diagonal, then in along the cartesian direction.
> 
> In a true straightest direction, you would start off in whichever
> of the two, diagonal or cartesian was larger, doing a step in the
> shorter of the two, every so often.

Yes.  Using the cartesian products (is that the correct term?  it's been
a while since I've done any linear algebra...) will work if (1) the
direction vectors you use are normalized to be unit vectors and (2) you
use the entire travel vector, rather than the "fake" normalized one.  My
patch did both of these.

> If Raimar takes a look at the submitted patch, and the last few emails
> with Jason, maybe he will change his mind about whether there is some
> value in the one he hasn't quite yet figured out :-).

Raimar points out (and appears to be correct) that straightest_direction
is *not* used for your typical goto routes.  I wonder what is used for
those?  Is there another identical function somewhere else?  What
straightest_direction *is* used for (AFAICT) is building roads with the
"connect" command.

Similarly, dir_ok is only used in one place.

jason


[Prev in Thread] Current Thread [Next in Thread]