]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/commitdiff
Refactor
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 24 Jun 2019 10:01:19 +0000 (12:01 +0200)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 24 Jun 2019 10:29:29 +0000 (12:29 +0200)
incl/aux.h

index 7884242c9538423c2715debe2a1378cbe865138e..73fefb83c263d6f4b83e24542bc88c1ba386d7e5 100644 (file)
@@ -18,19 +18,27 @@ along with I am car. If not, see <http://www.gnu.org/licenses/>.
 #ifndef AUX_H
 #define AUX_H
 
-#define EDIST(a, b) ({ __typeof__ (a) _a = (a); \
-                __typeof__ (b) _b = (b); \
-                pow(pow((_b)->x() - (_a)->x(), 2) + \
-                                pow((_b)->y() - (_a)->y(), 2), 0.5); })
+#define EDIST(a, b) ({ \
+        __typeof__ (a) _a = (a); \
+        __typeof__ (b) _b = (b); \
+        sqrt( \
+                pow((_b)->x() - (_a)->x(), 2) \
+                + pow((_b)->y() - (_a)->y(), 2) \
+        ); \
+})
 
 // see http://www.cplusplus.com/reference/algorithm/max/
-#define MAX(a, b) ({ __typeof__ (a) _a = (a); \
-                __typeof__ (b) _b = (b); \
-                (_a < _b) ? _b : _a; })
+#define MAX(a, b) ({ \
+        __typeof__ (a) _a = (a); \
+        __typeof__ (b) _b = (b); \
+        (_a < _b) ? _b : _a; \
+})
 
 // see http://www.cplusplus.com/reference/algorithm/min/
-#define MIN(a, b) ({ __typeof__ (a) _a = (a); \
-                __typeof__ (b) _b = (b); \
-                !(_b < _a) ? _a : _b; })
+#define MIN(a, b) ({ \
+        __typeof__ (a) _a = (a); \
+        __typeof__ (b) _b = (b); \
+        !(_b < _a) ? _a : _b; \
+})
 
 #endif