Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: RFC: 8-topology system
Home

[Freeciv-Dev] Re: RFC: 8-topology system

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: RFC: 8-topology system
From: Jason Dorje Short <vze2zq63@xxxxxxxxxxx>
Date: Tue, 16 Oct 2001 18:22:35 -0400
Reply-to: jdorje@xxxxxxxxxxxx

Raimar Falke wrote:
> 
> On Tue, Oct 16, 2001 at 01:42:48PM -0400, Jason Dorje Short wrote:
> > Here is a (hopefully) full explanation of how I propose to implement an
> > 8-topology system.  The eight topologies include flat vs isometric,
> > north-south wrapping vs no wrapping, and east-west wrapping vs no
> > wrapping.  We also allow the possibility of adding non-rectangular maps
> > in the future.  Any of these 8 topologies will work under my proposed
> > general topological system (an earlier post), either with or without the
> > linear-combination-of-vectors (LCOV) extension (LCOV allows
> > wrap_map_pos()).
> >
> > The current code defines only map.xsize and map.ysize (henceforth
> > referred to as xsize and ysize).  These currently define the topology
> > itself.  Under the new system, they will only define the bounding
> > rectangle for the topology.  The topology itself will be referred to by
> > another set of values (declared either within the map structure or as
> > part of a separate topology structure):
> >
> > - shape: 0 for rectangle; no other valid values yet.
> 
> 1 for a ellipse
> 
> I think that another shape is good. This may be of no real use but it
> allows use to test the code. And a non-isometric ellipse has the
> semantics of most north <=> y=0. Also such an ellipse will also have
> non-real tiles in the rectangular xsize*ysize.

Yes, the purpose of the field is to allow other shapes :-).  A hexagon
and a triangle were also mentioned (although the triangle has problems
if it wraps).  My only worry is that the (width, height) dimensions
won't be enough to easily express the dimensions of an arbitrary shape.

> So based on the xsize and ysize an ellipse should look like:
> 
>                               #
>                     # # # # # # # # # # #
>               # # # # # # # # # # # # # # # # #
>             # # # # # # # # # # # # # # # # # # #
>           # # # # # # # # # # # # # # # # # # # # #
>         # # # # # # # # # # # # # # # # # # # # # # #
>       # # # # # # # # # # # # # # # # # # # # # # # # #
>       # # # # # # # # # # # # # # # # # # # # # # # # #
>       # # # # # # # # # # # # # # # # # # # # # # # # #
>     # # # # # # # # # # # # # # # # # # # # # # # # # # #
>       # # # # # # # # # # # # # # # # # # # # # # # # #
>       # # # # # # # # # # # # # # # # # # # # # # # # #
>       # # # # # # # # # # # # # # # # # # # # # # # # #
>         # # # # # # # # # # # # # # # # # # # # # # #
>           # # # # # # # # # # # # # # # # # # # # #
>             # # # # # # # # # # # # # # # # # # #
>               # # # # # # # # # # # # # # # # #
>                     # # # # # # # # # # #
>                               #
> 
> For testing such shape may also omit wrapping.

Omit wrapping?  How could such a shape possibly wrap?

We have (width, height) as the width and height of the ellipse. 
xsize==width and ysize==height.

The center point is (width/2, height/2).

Allow the ellipse to range as far out as possible before encountering
the next row.  For instance your picture above would become something
like

                             # # #
                     # # # # # # # # # # #
               # # # # # # # # # # # # # # # # #
             # # # # # # # # # # # # # # # # # # #
           # # # # # # # # # # # # # # # # # # # # #
         # # # # # # # # # # # # # # # # # # # # # # #
       # # # # # # # # # # # # # # # # # # # # # # # # #
       # # # # # # # # # # # # # # # # # # # # # # # # #
     # # # # # # # # # # # # # # # # # # # # # # # # # # #
     # # # # # # # # # # # # # # # # # # # # # # # # # # #
     # # # # # # # # # # # # # # # # # # # # # # # # # # #
       # # # # # # # # # # # # # # # # # # # # # # # # #
       # # # # # # # # # # # # # # # # # # # # # # # # #
         # # # # # # # # # # # # # # # # # # # # # # #
           # # # # # # # # # # # # # # # # # # # # #
             # # # # # # # # # # # # # # # # # # #
               # # # # # # # # # # # # # # # # #
                     # # # # # # # # # # #
                             # # #

This preserves the ellipse while making the ends as unpointy as
possible.  It means that the horizontal and vertical radiuses become one
larger ( (width/2+1) and (height/2+1) ) but we want to use <
(inequality) rather than <= in our comparison.

The equation then becomes

Let
  xr=widtht/2
  yr=height/2
in
  ( (x-xr)/(xr+1) )^2 + ( (y-yr)/(yr+1) )^2 < 1

Which can either be done floating-point, or multiplied out to get a
very-long-but-integer-only equation.

jason


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