Complete.Org: Mailing Lists: Archives: freeciv-dev: October 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: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#4648) how to do wrapping in map_to_canvas_pos?
From: "rwetmore@xxxxxxxxxxxx" <rwetmore@xxxxxxxxxxxx>
Date: Thu, 2 Oct 2003 23:24:40 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Jason Short wrote:
> Gregory Berkolaiko wrote:
> 
>>[jdorje - Thu Sep 25 20:34:03 2003]:
[...]
>>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.
> 
> Yep.  Note that unnormalize_map_pos will also fail in this (or similar) 
> situations. 

I don't think so. It certainly does much better because it guarantees
all of the tiles Gregory is concerned about are included in the view.

Remember unnormalize has a normal set that is aligned with the view axes,
and thus fits into all the square corners of the view as compactly as
possible. Unnormalize only fails to include coordinates that are
"candycaned", i.e. the view is distorted so that one axis is elongated
to multiple regular or bounding box lengths. And we have agreed that
these views should be outlawed because of the oddball effects they cause.

Unnormalize produces a view something like this, where the origin tile
"O" is the origin of the view. I think you will find that you can
superimpose any view rectangle on this that does not candycane, and
no tiles that lie outside of the rectangle will map to an unoccupied
spot within the view.

   O X X
   X X X X X X X X
   X X X X X X X X
   X X X X X X X X
   X X X X X X X X
             X X *


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

Agreed as far as unnormalize(), but I am not sure I have seen any clear
picture of just how your example fills in the view, i.e. something
corresponding to the ones that showed the geometrical wrapping and
resulting normal set mappings for unnormalize().

It is very important to understand the normal set mapping to guarantee
that coordinates are included once and once only.

You haven't done this, and I suspect can't, because as far as I could
tell your algorithm has no concept of this and the implementation some
bugs in this respect where it almost lucked out and got it by default.

[...]
> jason

Cheers,
RossW
=====




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