Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2003:
[Freeciv-Dev] Re: (PR#3936) introducing native coordinates
Home

[Freeciv-Dev] Re: (PR#3936) introducing native coordinates

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>, jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#3936) introducing native coordinates
From: Ross Wetmore <rwetmore@xxxxxxxxxxxx>
Date: Sun, 27 Apr 2003 12:59:53 -0400


Remember, these examples only deal with the special case where the
origin (native or topological) axes are not aligned with the target
(standard) axes, and thus pre-unnormalization is not sufficient to
guarantee the unnormalized point has positive offsets.

Another possible mapping during the final unnormalization step adds
constraints that the normal set shape should not be changed, or
alternatively, the bounds of the wrap regions are aligned with the
origin rather than the target axes. This is less efficient in using
the viewable area near the origin/axes, i.e.target aligned viewspace,
and thus has a greater percentage of black tiles in most views. Since
it also preserves the orign vs the target axis alignments, it will
give rise to the "tipped" view with diagonal edges that is currently
one of the most commonly voiced irritants in the isometric view of a
standard map.

Again, the pre-unnormalized rectangular set and both original and
target (rotated) axes are drawn. A sample rotated rectangular view
is provided for visual cues only (i.e. it does not have any part in
the unnormalization process).

In this case, the normal set is diagonally shifted along the x or y
target direction until all points are positive. This corresponds to
x-wrap of points in 1 to 1', x and y wrap of points in 2 to 2', and
y-wrap of points in 3 to 3'.

One of the points that should be clear by these examples is that
normal sets can be defined in an arbitrarily large number of ways.
The only invariant that is critical is that there be a one-to-one
mapping between points in any two such sets. Creating one set from
another by mapping regions through wrapping operations is a good
way to insure that no mistakes are made, and no many-to-one or
one-to-many points creep in (i.e. tile seen at multiple locations
in the same view).

Cheers,
RossW
=====

Ross Wetmore wrote:

As a primer ...

[...]

Personally, I found it instructive to understand the process here visually, and thus drawing graphs and doing a geometric mapping operation on paper helped me to verify all the subtleties of the code conditions. The comments tell you how to do this and the result to look for in the simple 1-D wrapping case (the normal set rectangle gets mapped to a parallelogram to remain within the positive
region of the target axes) as well as the full 2-D one.

Geometrically, every point (above/)below a diagonal line through the origin is wrapped to the other end of the rectangle to create a parellelogram in the simple case. Points below that diagonal line would be negative in the output coordinate system. This is a vector operation (bounded by a diagonal line) rather than a simple single coordinate "+ map.xsize" operation because the transformation is a linear combination of coordinates rather than an independent function of each
coordinate separately as in the parellel wrap axes case.

For the 2-D case you just need to juggle more mental balls because you wrap in
two diagonal/vector steps, but the logic is the same.

[...]

Windows bitmap


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