return white / (black + white);
}
-float RadarMapAtPoint_Trace(float x, float y, float w, float h, float zmin, float zsize, float q)
+float RadarMapAtPoint_Trace(float e, float f, float w, float h, float zmin, float zsize, float q)
{
vector a, b, mi, ma;
mi = '0 0 0';
ma = '1 0 0' * w + '0 1 0' * h;
- a = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin;
- b = '1 0 0' * x + '0 1 0' * y + '0 0 1' * (zsize + zmin);
+ a = '1 0 0' * e + '0 1 0' * f + '0 0 1' * zmin;
+ b = '1 0 0' * e + '0 1 0' * f + '0 0 1' * (zsize + zmin);
return FullTraceFraction(a, mi, ma, b);
}
-float RadarMapAtPoint_LineBlock(float x, float y, float w, float h, float zmin, float zsize, float q)
+float RadarMapAtPoint_LineBlock(float e, float f, float w, float h, float zmin, float zsize, float q)
{
vector o, mi, ma;
float i, r;
mi = '0 0 0';
dz = (zsize / q) * '0 0 1';
ma = '1 0 0' * w + '0 1 0' * h + dz;
- o = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin;
+ o = '1 0 0' * e + '0 1 0' * f + '0 0 1' * zmin;
- if (x < world.absmin.x - w) return 0;
- if (y < world.absmin.y - h) return 0;
- if (x > world.absmax.x) return 0;
- if (y > world.absmax.y) return 0;
+ if (e < world.absmin.x - w) return 0;
+ if (f < world.absmin.y - h) return 0;
+ if (e > world.absmax.x) return 0;
+ if (f > world.absmax.y) return 0;
r = 0;
for (i = 0; i < q; ++i)
}
return r / q;
}
-float RadarMapAtPoint_Block(float x, float y, float w, float h, float zmin, float zsize, float q)
+float RadarMapAtPoint_Block(float e, float f, float w, float h, float zmin, float zsize, float q)
{
vector o, mi, ma;
float i, r;
mi = '0 0 0';
dz = (zsize / q) * '0 0 1';
ma = '1 0 0' * w + '0 1 0' * h + dz;
- o = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin;
+ o = '1 0 0' * e + '0 1 0' * f + '0 0 1' * zmin;
- if (x < world.absmin.x - w) return 0;
- if (y < world.absmin.y - h) return 0;
- if (x > world.absmax.x) return 0;
- if (y > world.absmax.y) return 0;
+ if (e < world.absmin.x - w) return 0;
+ if (f < world.absmin.y - h) return 0;
+ if (e > world.absmax.x) return 0;
+ if (f > world.absmax.y) return 0;
r = 0;
for (i = 0; i < q; ++i)
}
return r / q;
}
-float RadarMapAtPoint_Sample(float x, float y, float w, float h, float zmin, float zsize, float q)
+float RadarMapAtPoint_Sample(float e, float f, float w, float h, float zmin, float zsize, float q)
{
vector a, b, mi, ma;
mi = '0 0 0';
ma = '1 0 0' * w + '0 1 0' * h;
- a = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin;
+ a = '1 0 0' * e + '0 1 0' * f + '0 0 1' * zmin;
b = '1 0 0' * w + '0 1 0' * h + '0 0 1' * zsize;
float c, i;
return c / q;
}
-void sharpen_set(int x, float v)
+void sharpen_set(int b, float v)
{
- sharpen_buffer[x + 2 * RADAR_WIDTH_MAX] = v;
+ sharpen_buffer[b + 2 * RADAR_WIDTH_MAX] = v;
}
-float sharpen_getpixel(int x, int y)
+float sharpen_getpixel(int b, int c)
{
- if (x < 0) return 0;
- if (x >= RADAR_WIDTH_MAX) return 0;
- if (y < 0) return 0;
- if (y > 2) return 0;
- return sharpen_buffer[x + y * RADAR_WIDTH_MAX];
+ if (b < 0) return 0;
+ if (b >= RADAR_WIDTH_MAX) return 0;
+ if (c < 0) return 0;
+ if (c > 2) return 0;
+ return sharpen_buffer[b + c * RADAR_WIDTH_MAX];
}
-float sharpen_get(float x, float a)
+float sharpen_get(float b, float a)
{
- float sum = sharpen_getpixel(x, 1);
+ float sum = sharpen_getpixel(b, 1);
if (a == 0) return sum;
sum *= (8 + 1 / a);
- sum -= sharpen_getpixel(x - 1, 0);
- sum -= sharpen_getpixel(x - 1, 1);
- sum -= sharpen_getpixel(x - 1, 2);
- sum -= sharpen_getpixel(x + 1, 0);
- sum -= sharpen_getpixel(x + 1, 1);
- sum -= sharpen_getpixel(x + 1, 2);
- sum -= sharpen_getpixel(x, 0);
- sum -= sharpen_getpixel(x, 2);
+ sum -= sharpen_getpixel(b - 1, 0);
+ sum -= sharpen_getpixel(b - 1, 1);
+ sum -= sharpen_getpixel(b - 1, 2);
+ sum -= sharpen_getpixel(b + 1, 0);
+ sum -= sharpen_getpixel(b + 1, 1);
+ sum -= sharpen_getpixel(b + 1, 2);
+ sum -= sharpen_getpixel(b, 0);
+ sum -= sharpen_getpixel(b, 2);
return bound(0, sum * a, 1);
}
void sharpen_shift(int w)