8 double sinx[361], cosx[361], asin2sqx[1001];
14 double dist2UTM(
double x1,
double y1,
double x2,
double y2)
16 double x, y, cy1, cy2, yt, xi, yi;
18 x = fabs(x1 - x2) / 2;
19 y = fabs(y1 - y2) / 2;
24 x = (1 - x) * sinx[(
int)xi] + x * sinx[((int)xi) + 1];
25 y = (1 - y) * sinx[(
int)yi] + y * sinx[((int)yi) + 1];
26 yt = fabs(y1 + P.SpatialBoundingBox[1]);
29 cy1 = (1 - cy1) * cosx[((
int)yi)] + cy1 * cosx[((
int)yi) + 1];
30 yt = fabs(y2 + P.SpatialBoundingBox[1]);
33 cy2 = (1 - cy2) * cosx[((
int)yi)] + cy2 * cosx[((
int)yi) + 1];
34 x = fabs(1000 * (y * y + x * x * cy1 * cy2));
37 y = (1 - x) * asin2sqx[((
int)xi)] + x * asin2sqx[((
int)xi) + 1];
38 return 4 * EARTHRADIUS * EARTHRADIUS * y;
45 return dist2UTM(Households[a->hh].loc_x, Households[a->hh].loc_y, Households[b->hh].loc_x, Households[b->hh].loc_y);
48 x = fabs(Households[a->hh].loc_x - Households[b->hh].loc_x);
49 y = fabs(Households[a->hh].loc_y - Households[b->hh].loc_y);
50 if (P.DoPeriodicBoundaries)
72 if (P.DoPeriodicBoundaries)
80 double dist2_cc_min(
Cell* a,
Cell* b)
92 if (m / P.nch > l / P.nch)
94 else if (m / P.nch < l / P.nch)
99 if (m / P.nch > l / P.nch)
101 else if (m / P.nch < l / P.nch)
104 if (m % P.nch > l % P.nch)
106 else if (m % P.nch < l % P.nch)
115 if (m / P.nch > l / P.nch)
117 else if (m / P.nch < l / P.nch)
122 if (m / P.nch > l / P.nch)
124 else if (m / P.nch < l / P.nch)
129 if (m % P.nch > l % P.nch)
131 else if (m % P.nch < l % P.nch)
136 if (m % P.nch > l % P.nch)
138 else if (m % P.nch < l % P.nch)
143 if (P.DoPeriodicBoundaries)
148 return x * x + y * y;
156 l = (int)(a - Mcells);
157 m = (int)(b - Mcells);
163 x = P.
in_microcells_.
width_ * fabs((
double)(l / P.get_number_of_micro_cells_high() - m / P.get_number_of_micro_cells_high()));
164 y = P.
in_microcells_.
height_ * fabs((
double)(l % P.get_number_of_micro_cells_high() - m % P.get_number_of_micro_cells_high()));
165 if (P.DoPeriodicBoundaries)
170 return x * x + y * y;
174 double dist2_raw(
double ax,
double ay,
double bx,
double by)
179 return dist2UTM(ax, ay, bx, by);
184 if (P.DoPeriodicBoundaries)
189 return x * x + y * y;
DomainSize in_degrees_
Size of spatial domain in degrees.
The basic unit of the simulation and is associated to a geographical location.
DomainSize in_microcells_
Size of spatial domain in microcells.
double height_
The height.
DomainSize in_cells_
Size of spatial domain in cells.