Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: to wrap or not to wrap?
Home

[Freeciv-Dev] Re: to wrap or not to wrap?

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: to wrap or not to wrap?
From: Jason Dorje Short <vze2zq63@xxxxxxxxxxx>
Date: Sat, 13 Oct 2001 01:01:35 -0400
Reply-to: jdorje@xxxxxxxxxxxx

"Ross W. Wetmore" wrote:
> 
> At 11:39 AM 01/10/10 -0400, Jason Dorje Short wrote:
> >Raimar Falke wrote:
> >wrap_map_pos(&x, &y) takes the vector (x, y) and physically wraps it
> >into its proper position.  It is independent of (x, y) being real, so it
> >will only work for topologies that wrap "regularly".  However, the fact
> >that it'll work on any position or vector makes usage much simpler.
> >
> >For a real position, it will have identical effect to
> >normalize_map_pos.  For an unreal position, it will wrap the coordinate
>                                                      ^^^^^^^^^^^^^^^^^^^
> >normally just as if it were real (which is only possible under a limited
>  ^^^^^^^^  i.e. do bogus transformations of gaming coordinates.

The transormation is not "bogus" if we define topologies as Gaute has
proposed; i.e. such that equivalence classes of coordinates are defined
as differing by a linear combination of given vectors.  It's a bit of a
tautology, but if we are willing to limit our topologies in this way we
can make the conversion a lot easier.

Personally, I now believe the use of wrap_map_pos (with the added
restriction to topologies) is a good intermediate step; at least it will
allow us to convert the code to entirely use one set of constructs
(wrap_map_pos) before we set about a full cleanup.  The "full cleanup"
will be very difficult.

> >set of topologies).
> >
> >Like I said, it is confusing and will probably lead to misuse.
> 
> I don't see any real use for this. Perhaps you could give the example
> (again if I missed it). I think it is more than confusing, I think it
> is fundamentally wrong to think of a topology unaware 2-D wrap.

Again, so long as you define the topology as always wrapping in the same
way it is acceptable.  To use vague mathematical terms, we're taking
advantage of linear algebra here instead of just plain set theory.

The "use" for it is that it makes cleanup of the GUI code much, much
easier (see my previous overlong patch that allowed map wrapping in the
opposite direction).

> Put another way, I can see the corresponding clip_map_pos(&x,&y) being
> used in certain kinds of GUI operations that draw into a fixed window
> object. This is because GUI window pixel coordinates are non-wrapped
> in both directions. But one would never wrap such coordinates in the
> same way.

I don't understand.

> Or, yet another flavour, I can see independently wrapping or clipping
> individual coordinates as suboperations in certain specialized code that
> knows exactly what it is doing, but I don't see use for a generalized two
> coordinate function.

Huh?  You cannot wrap coordinates individually.  And any such
"specialized code", no matter how little it is used, must go into
map.[ch] so that it can be easily adjusted to handle alternate
topologies (case in point: nearest_real_pos).

jason


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