Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2003:
[Freeciv-Dev] (PR#4648) how to do wrapping in map_to_canvas_pos?
Home

[Freeciv-Dev] (PR#4648) how to do wrapping in map_to_canvas_pos?

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#4648) how to do wrapping in map_to_canvas_pos?
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Tue, 30 Sep 2003 03:57:12 -0700
Reply-to: rt@xxxxxxxxxxxxxx

[jdorje - Thu Sep 25 20:34:03 2003]:

> Attached is an update of the patch to do gen-topology-safe wrapping in 
> map_to_canvas_pos using map_distance_vector.  See the rest of PR#4648 
> for discussion

Just to remind ourselves what your algorithm does:
1. find the coordinates of the canvas centre
2. find the closest representation (because of wrapping there are many
representation) of the given tile to the canvas centre.  The closest is
calculated wrt real_map_distance (aka max norm)
3. convert the coordinates of this representation to the canvas coords.

I think it will fail in the case of standard rectangular coords with
x-wrap and the iso-view clients.  Attached is a picture illustrating it.

Map is drawn with thin lines, window of the canvas with thick.  Cross
marks the centre of the canvas, the tile marked with dashed thick lines
fits into window (wrapped in x-direction).  But it won't be, because the
real_map_distance-closest representation is the not wrapped copy.

This setup is probably rare and undesrving much attention.  I would
recommend, however, in the view of ever-slowing client, to cache the
numbers that are recalcualted for every call.  center_map_x,
center_map_y, only need to be recalculated when the window is shifted or
gets resized, not when we draw each tile.

Also, I take back any of my complaints about normalising the canvas
centre coordinates.  Leave them unnormalised, saves CPU.

Best wishes,
G.

GIF image


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