diff options
-rw-r--r-- | src/spatial.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/spatial.c b/src/spatial.c index 02a4bf3..e49f668 100644 --- a/src/spatial.c +++ b/src/spatial.c @@ -12,6 +12,28 @@ static inline float dist(xas_spatial_coord a, xas_spatial_coord b) { + powf(b.z - a.z, 2.0f), 0.5f); } +static float dotf(float *sets, size_t count, size_t len) { + float ret = 0.0f; + + size_t x, y; + + if (count == 0 || len == 0) { + return 0.0f; + } + + for (x=0; x<count; x++) { + float num = sets[x*len+0]; + + for (y=1; y<len; y++) { + num *= sets[x*len+y]; + } + + ret += num; + } + + return ret; +} + static void rotate(xas_spatial_rotation rotation, xas_spatial_coord *coord) { double cosY = cos(rotation.y), @@ -87,28 +109,6 @@ static int within_cone(xas_spatial_coord coord, return 1; } -static float dotf(float *sets, size_t count, size_t len) { - float ret = 0.0f; - - size_t x, y; - - if (count == 0 || len == 0) { - return 0.0f; - } - - for (x=0; x<count; x++) { - float num = sets[x*len+0]; - - for (y=1; y<len; y++) { - num *= sets[x*len+y]; - } - - ret += num; - } - - return ret; -} - static int buffer_realloc(xas_spatial_scene *scene, xas_spatial_buffer *buffer) { float seconds = scene->radius / scene->speed; |