From 7caf0b3dac621434028010f007b781c2e2ea431f Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 11 Dec 2021 11:16:11 +0100 Subject: [PATCH] Fix missing abs(), and sign(). --- geometry_2d.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/geometry_2d.h b/geometry_2d.h index 04cf9c6..bf23e65 100644 --- a/geometry_2d.h +++ b/geometry_2d.h @@ -422,8 +422,10 @@ public: static Vector bresenham_line(const Point2i &p_start, const Point2i &p_end) { Vector points; - Vector2i delta = (p_end - p_start).abs() * 2; - Vector2i step = (p_end - p_start).sign(); + Point2i e_s = p_end - p_start; + + Vector2i delta = Vector2i(ABS(e_s.x), ABS(e_s.y)) * 2; + Vector2i step = Vector2i(SIGN(e_s.x), SIGN(e_s.y)); Vector2i current = p_start; if (delta.x > delta.y) {