Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: Map coordinate cleanups.
Home

[Freeciv-Dev] Re: Map coordinate cleanups.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Cc: Gaute B Strokkenes <gs234@xxxxxxxxx>, Jason Dorje Short <jshort@xxxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Map coordinate cleanups.
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 19 Aug 2001 15:15:44 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sat, Aug 18, 2001 at 01:39:32AM -0400, Ross W. Wetmore wrote:
> At 04:15 AM 01/08/18 +0200, Gaute B Strokkenes wrote:
> >On Fri, 17 Aug 2001, hawk@xxxxxxxxxxxxxxxxxxxxxxx wrote:
> [...]
> >Moreover, when one asks oneself the question "Are these coordinates
> >canonical or not?" the natural thing to do is simply to check whether
> >the coordinate is wrapped or not.  Why bring the realness of the tile
> >into it at all?  It's a very artifical thing to do.
> >
> >Finally, if you take the attitude that it's not necessary to normalise
> >the coordinates of unreal tiles then you're only going to run into
> >paradoxes like the above.  One might argue that in most cases we drop
> >unreal coordinates on the floor without further ado whenever we detect
> >them, and that there are only a few places where we juggle them about
> >on purpose.  However, that's only a (rather dubious) optimisation; I
> >think correctness should come first.
> 
> If one looks closely at the juxtaposition in these two paragraphs, you 
> actually do understand but have taken the opposite condition from the
> rest of us as your primary one. Let me see if I can convince you that
> while valid, it isn't really the practical one. And be careful to use
> "real" as the concept I have defined below, though you can mentally
> translate it to something else if you want to use your own word :-).
> 
> First, in the server gaming context, one is really only interested in
> map coordinates that refer directly or by a valid transformation to a 
> playing tile. So "unreal" coordinates that cannot be so mapped do need 
> to be dropped, and probably with a rude error.
> 
> Once we know a set of coordinates is "real" or usable, we may need to 
> do a transform into a form that is "normalized" or safe for access. At
> this point we consider wrap transformations, translations or whatever 
> you do to isometric thingies.
> 
> At no point in this sequence do we need to worry about coordinates that
> are "unreal" but could be transformed by a wrap operation to something
> that looked safe. 

> If they are unreal, there is by definition no valid transformation

By definition the transformation can also accept unreal positions.

> , and there is not much point in applying an invalid one.  Moreover,
> applying a test to determine if an "unreal" tile could be mapped by
> an invalid transformation, i.e. a subset of the is_wrapped(),
> condition is never required and just pollutes the useful subset of
> this test. I think you called this condition "canonical" and "unreal
> canonical" is just an oxymoron.
> 
> If you know a set of coordinates are real, then there is a valid test to 
> see if they are also normalized, i.e. the useful subset above. Most of 
> the time it is to decide if they should then be normalized.

Normalization can be done unconditionally.

> This is done in one step by normalize_map_pos and it always returns
> TRUE in this case because that is the state of its input variables
> on exit.
> 
> There is perhaps a need to determine if real coordinates are normalized
> and return that value without actually munging the values. But it is
> rare. Hence is_normal<something> is a useful function, but not really
> needed.
> 
> Note there is also a case where you are *not* concerned about gaming
> coordinates, but things like GUI windows and memory boundaries. When
> dealing with such coordinates (as opposed to gaming coordinates), you 
> may be concerned about "unreal" coordinates which are anything outside
> of the object space, and often use a "transformation" like truncate to
> nearest border to obtain boundary coordinates. Don't confuse this with
> the above, or mix the two tests, except as an explicit commented hack.
> These are typically always unwrappable rectangular coordinates, with
> a completely different reality from the gaming coordinates.
> 
> >-- 
> >Big Gaute                               http://www.srcf.ucam.org/~gs234/
> >How do I get HOME?
> 
> In this case you might need to stop thinking like a mathematician and
> think more like an accountant - it is the bottom line that is important.

I agree with Ross here: the Gaute's question of "can unreal positions
be normalizeabled" is valid but is of no or little use in freeciv.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx


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