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) {