|
|
|
@ -1,6 +1,27 @@
@@ -1,6 +1,27 @@
|
|
|
|
|
float sqrtf(float x); |
|
|
|
|
float fabsf(float x); |
|
|
|
|
extern char __heap_base; |
|
|
|
|
static int allocated; |
|
|
|
|
|
|
|
|
|
void * |
|
|
|
|
alloc(int size) |
|
|
|
|
{ |
|
|
|
|
void *result = &__heap_base + allocated; |
|
|
|
|
allocated += size; |
|
|
|
|
return(result); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int |
|
|
|
|
sum(int *numbers, int count) |
|
|
|
|
{ |
|
|
|
|
int result = 0; |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < count; ++i) { |
|
|
|
|
result += numbers[i]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return(result); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
static int |
|
|
|
|
rdp_find_max(float *coordinates, float zoom, int coords_from, |
|
|
|
|
int segment_start, int segment_end) |
|
|
|
@ -18,7 +39,7 @@ rdp_find_max(float *coordinates, float zoom, int coords_from,
@@ -18,7 +39,7 @@ rdp_find_max(float *coordinates, float zoom, int coords_from,
|
|
|
|
|
float dx = bx - ax; |
|
|
|
|
float dy = by - ay; |
|
|
|
|
|
|
|
|
|
float dist_ab = sqrtf(dx * dx + dy * dy); |
|
|
|
|
float dist_ab = __builtin_sqrtf(dx * dx + dy * dy); |
|
|
|
|
float dir_nx = dy / dist_ab; |
|
|
|
|
float dir_ny = -dx / dist_ab; |
|
|
|
|
|
|
|
|
@ -29,7 +50,7 @@ rdp_find_max(float *coordinates, float zoom, int coords_from,
@@ -29,7 +50,7 @@ rdp_find_max(float *coordinates, float zoom, int coords_from,
|
|
|
|
|
float apx = px - ax; |
|
|
|
|
float apy = py - ay; |
|
|
|
|
|
|
|
|
|
float dist = fabsf(apx * dir_nx + apy * dir_ny); |
|
|
|
|
float dist = __builtin_fabsf(apx * dir_nx + apy * dir_ny); |
|
|
|
|
|
|
|
|
|
if (dist > EPS && dist > max_dist) { |
|
|
|
|
result = i; |
|
|
|
@ -113,3 +134,4 @@ do_lod(int *clipped_indices, int clipped_count, float zoom,
@@ -113,3 +134,4 @@ do_lod(int *clipped_indices, int clipped_count, float zoom,
|
|
|
|
|
|
|
|
|
|
return(segments_head); |
|
|
|
|
} |
|
|
|
|
#endif |