diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2019-05-03 03:07:07 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2019-05-03 03:07:07 +0200 |
commit | 620a534e46a78e2664f1a105c694330fc267453b (patch) | |
tree | 0bff0c9b6e0bd7ed11855450cad03a0ed2ba31f1 /m.c | |
parent | 4aa0cf5afc35509ccbfc23c722672c5a7a89001c (diff) | |
download | AsciiMap-620a534e46a78e2664f1a105c694330fc267453b.tar.gz |
Did a fuck ton.
Diffstat (limited to 'm.c')
-rw-r--r-- | m.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -0,0 +1,21 @@ +#include "m.h" + +uint8_t avg(int argc, uint8_t *argv) +{ + uint8_t ret = 0; + uint64_t sum = 0; + + for(int i = 0; i < argc; i++) + sum += (uint64_t)argv[i]; + + ret = (char)(sum / argc); + + return ret; +}//avg + + +float distance(uint8_t _1[3], uint8_t _2[3]) +{ + return fabs(sqrt( pow((double)_1[0], 2) + pow((double)_1[1],2) + pow((double)_1[2],2) ) + - sqrt( pow((double)_2[0], 2) + pow((double)_2[1],2) + pow((double)_2[2],2) ) ); +} |