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 10:27:26 -0400

Attached is a crude diagram showing a 2-D unnormalization.

The pre-unnormalized coordinates lie in the standard rectangular normal
set contained by the rectangular box.

The target axes are overlayed at a pi/4 rotation. For visual cues only
a pi/4 rotated rectangular window is drawn to suggest what might be seen
in that view.

As can be seen, shapes 1, 2, 3 and 4 do not lie in the positive quadrant
of the target axes. Thus a final wrap step is required in addition to the
pre-unnormalization.

This is accomplished by wrapping points in 1 to 1', points in 2 to 2', etc.
If you look at the resulting shape, it is an "N" (actually a mirror image
N in the given case). This is the most compact representation in the
target view with all bounding sides of the shape parallel to target axes.
It maps points with the minimum number of wraps to just lie within the
positive quadrant.

Note if you could not wrap in the standard y-direction, then regions 1 and
2 which form a triangle, could only be wrapped in the x-direction to form
a parallelogram in which all target coordinates lie in the positive
quadrant..

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]