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

[Freeciv-Dev] Re: (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: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#4648) how to do wrapping in map_to_canvas_pos?
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 30 Sep 2003 06:01:47 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Gregory Berkolaiko wrote:
> [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.

Yep.

> 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.

Yep.  Note that unnormalize_map_pos will also fail in this (or similar) 
situations.  But both will show all tiles if the mapview window is 
sufficiently large (which is not true of the current code), and will 
work just fine for sufficiently small mapviews.

> 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.

Seems reasonable.

jason




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