Complete.Org: Mailing Lists: Archives: freeciv-dev: June 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: Sat, 5 Jun 2004 04:09:34 -0700
Reply-to: rt@xxxxxxxxxxx

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

Le jeu 06/05/2004 à 19:28, Jason Short a écrit :

Hi, your was asked me about math in torus topology.
this math is a little difficult to be explains, i was constructed it
with my known, this is a intuitive equation working well.

there i explain the exact calculations needed to create the exact map
math. this is not really needed to change the math by these exact one.
for players there is some result. but it easiest explained. the i will
probably change the math in code and put it in docs.

Marcelo 
  

After the map is folded we get a rectangular base map with Cartesian 
coordinates are (x, y)
x and y are Real Range [0, 1].

for a torus topology we choice to place one pole in coordinates (0,0) on these 
map, and the other in coordinates (1,1).

the pole are circles of radius 0 the equation of this are
1)x² + y² = 0

for the second pole the equation are
2)(x â 1)² + (y â 1)² = 0

We want a function evolution from a pole to a another. this be easy made by

3)f (x,y) =  (x² + y² ) / ((x â 1)² + (y â 1)²)

f(x,y) is a Real Range function [0, infinity] it reach 0 value in (0,0) pole 
and infinity one for the (1,1) pole.

a isotherm line can be define by
4)G : f(x,y) = g where g is a Real positive constant.

Solve the equation:
5)f(x,0) = g    
allow to find the maximal value of x for the isotherm
                                        g - sqrt(-g (g â 2))
6)                       x(g) =    ----------------------
                                              -1 + g

Solve the equation:
6)f(x,y) = g    
and the equation of the isotherm G :
                   g -sqrt (-g²  - x²  + 2 g - 2 g x + 2 g x²  + 2 g²  x - 
g ² x² )
7)G : y(x,g)      
-------------------------------------------------------------------
                                          -1 + g

then the area on the map covered by the isotherm G is
 
                                                 
                                               / x(g)
                                              |
 8)                                  A =      |   y(x, g) dx
                                              |
                                             / 0

to calculate it we need some work.

if we see the isotherm pasing equator (1,0) 
9) g(equator) = f(1,0) = 1
 we verify this is the spected equator solvin

9)f(x,y) = 1

we find the equation of the diagonal of the map
10)y(x, 1) = 1 â x

then to calculate A we  can assume g is only in the Real Range (0 .. 1)

and we get 


                       
                       /         sqrt(2 g)                               sqrt(2 
(2 â g~))      \
                -  g~ |arcsin(------------) + sqrt(2 - g)  g   - 
arcsin(-------------------) - g|
                       \            2                                           
2               /
 11)  A (g)=    
---------------------------------------------------------------------------
                                              (g â 1)²


we can see at equator A(1) = 0.5

we can create a function going from 0 to 1 from (0,0) pole to equator fomr 
equation 11 and 3

12)temperature(x,y) =2 A( f(x,y))

the for equator to pole (1,1) we need to fold the map over diagonal y(x, 1) = 1 
â x.


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