Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] Re: (PR#8624) New clima function to best handle terrain pl
Home

[Freeciv-Dev] Re: (PR#8624) New clima function to best handle terrain pl

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#8624) New clima function to best handle terrain place, used to place poles.
From: "Marcelo Burda" <mburda@xxxxxxxxx>
Date: Fri, 7 May 2004 12:24:42 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8624 >

Le ven 07/05/2004 à 20:58, Jason Short a écrit :
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8624 >
> 
> Marcelo Burda wrote:
> 
> > that is exactly i not want. this only find simplest singularities but
> > not the central simetries in quincuntial. if iterator is well defined
> > (as is in quincuntial patch!) this near_singularities find it!
> > but evidently is_singular_map_pos is realy best in any other topologies.
> 
> I don't understand how the iterator method will find the singularity. 
> The current iterators will happily duplicate points if the wrapping 
> works out, and changing this seems hard.
Yes that was hard but avoid duplicate points was a big problems to be
solved in quincuntial topologies. any iterator used by ia, pf, etc need
to avoid this. in torus this is not realy a problem but for quincuntial
this is. 
> 
> Also, in a quincuncial topology you know exactly where the singularities 
> are ((map.xsize/2,0) and so on).  So can't you easily check for them in 
> is_singular_map_pos?
not so easy, the number of differnet topologies of type quincutial is
big, this point can are in (0,0), (map.xsize/4,0), (map.xsize/2,0),
(map.xsize*3/4,0). etc!, the nombers of case is big and the code so
ugly. if speed is not fondamental i was seach a way to make a easy 
is_singular_map_pos(map_x, map_y, dist). working for all topos and
avoiding any cast!
> 
> However is_singular_map_pos doesn't work well in hex topologies.  It is 
> possible but not pretty.  So this may not be the best solution.
there are one iterator from Quincuntial patch as sample of solution.

 #define square_dxy_iterate(center_x, center_y, radius, x_itr, y_itr,\
                            dx_itr, dy_itr)    \
 {       \
   int dx_itr, dy_itr;        \
   REVERSE_DESCRIPTOR_TYPE macro_revdes=REVERSE_NONE; \
   bool _is_border = IS_BORDER_MAP_POS((center_x),(center_y),(radius));\
   CHECK_MAP_POS((center_x), (center_y));  \
   for (dy_itr = -(radius); dy_itr <= (radius); dy_itr++) {  \
     for (dx_itr = -(radius); dx_itr <= (radius); dx_itr++) {   \
       int x_itr = dx_itr + (center_x), y_itr = dy_itr + (center_y);\
      if (_is_border &&  \
       !normalize_map_pos_revdes(&(x_itr), &(y_itr),&macro_revdes)) {\
         continue;       \
      }  \
    ONETIME((center_x),(center_y),(x_itr),(y_itr),(radius),macro_revdes)
where
#define ONETIME(XC,YC,X,Y,D,rev_des)   \
      if( (rev_des) && (MAX(abs((XC)-(X)),abs((YC)-(Y)))<=(D))) { \
        continue;                 \
       }

you see why i like use a default iterator ! 
 
> 
> jason
-- 
 . /  .     '    ,    .      (*)   '        `     '      `    .    
  |    ,  |   `     ,     .      ,   '  Marcelo Julián Burda      .
 /  '     \     `     \@_     '      .        '      `        '    
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




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