From bdcbb4816251b726f37c995880d1517196fb822b Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Fri, 3 May 2019 03:49:37 +0200 Subject: Rectified my infinite stupidity --- m.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'm.c') diff --git a/m.c b/m.c index 86fb968..c8d3a23 100644 --- a/m.c +++ b/m.c @@ -16,6 +16,7 @@ uint8_t avg(int argc, uint8_t *argv) 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) ) ); + return fabs( sqrt( pow((double)_2[0] - (double)_1[0], 2) + + pow((double)_2[1] - (double)_1[1], 2) + + pow((double)_2[2] - (double)_1[2], 2) ) ); } -- cgit v1.2.3