Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2003:
[Freeciv-Dev] (PR#3953) Off-canvas coordinates problem
Home

[Freeciv-Dev] (PR#3953) Off-canvas coordinates problem

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#3953) Off-canvas coordinates problem
From: "a-l@xxxxxxx" <a-l@xxxxxxx>
Date: Mon, 7 Apr 2003 13:26:26 -0700
Reply-to: rt@xxxxxxxxxxxxxx

There are one or two more issues with map_to_canvas_pos() I think
need to be addressed, and I'm not quite sure how to go about it.
This is only about tiles outside of the mapview.

Issue 1.

I would like the function to behave so that a tile with a higher map
Y coordinate always gets a higher canvas Y coordinate.

In Iso, this is not always true for out-of-sight-tiles.

However, the reverse function is ok; You can start with a canvas
coordinate, increase it by a half or full NORMAL_TILE_HEIGHT, and
always get a tile with a higher map Y coordinate.

Example:

  Canvas coordinates given by map_to_canvas_pos().

  A vertical line drawn with tiles
  (0,0)  (1,1)  ...  (49,49)

  on a isometric map:

     / \
    /   \______ (0, 0) north pole
   /    |\
   \    | \
    \   |  \
     \  |  /
      \ |_/____ (tile_x, tile_y)
       \|/_____ (49, 49) south pole

  The problem:

    The canvas coordinate of tile_y can be the same as the Y canvas
    coordinate of tile (0, 0) when the mapview is centered about the
    center of the global map. The X will be different.

  (0, 0) and (tile_x, tile_y) are clearly not on the same latitude,
  but they are clearly on the same longitude, so the function's got
  it backwards in some cases.

Issue 2.

Canvas coordinates can be negative. But the minimum and maximum
values (the wrapping point) given by map_to_canvas_pos() are
variable, depending on the mapview's centering and size. Also,
because of Issue 1) isometric will rarely give negative X
coordinates.

So I have to use somewhat special cases when iterating over canvas
coordinates to determine the wrapping point. (I want to keep them in
agreement with the canvas coordinates that the function gives for the
tile they represent, for certain reasons.)

Maybe the ideal behaviour of map_to_canvas_pos() would be this:
For tiles outside of mapview, consider the map's X and/or Y wrapping,
and determine wheter a negative or a very big coordinate should be
produced based upon the shortest real distance. To the left or right
of the monitor?

The reverse function can already coordinate negative or positive
canvas coordinates to the correct tile, as long as they are whole
multiples of map size.

Could we have normalize_canvas_pos() ?
Native canvas coordinates?


Arnstein



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