From bdbf94243f414f377c10a395357c07c7e9f94b72 Mon Sep 17 00:00:00 2001 From: Jiri Vlasak Date: Mon, 11 Mar 2019 16:40:24 +0100 Subject: [PATCH] Fix indexing for negatives --- incl/rrtbase.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/incl/rrtbase.h b/incl/rrtbase.h index 98b4cee..5c46747 100644 --- a/incl/rrtbase.h +++ b/incl/rrtbase.h @@ -33,11 +33,11 @@ along with I am car. If not, see . #define IXSIZE 100 #define IXSTEP (1.0 * ((VMAX) - (VMIN)) / IXSIZE) #define IXI(x) ({ __typeof__ (x) _x = (x); \ - (int) floor(_x / IXSTEP); }) + std::abs((int) floor(_x / IXSTEP)); }) #define IYSIZE 100 #define IYSTEP (1.0 * ((HMAX) - (HMIN)) / IYSIZE) #define IYI(y) ({ __typeof__ (y) _y = (y); \ - (int) floor(_y / IYSTEP); }) + std::abs((int) floor(_y / IYSTEP)); }) class Cell { private: -- 2.39.2