From e130625b9b61dcedb8b12b112a306f14e05db22b Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Wed, 7 Aug 2024 12:12:29 -0500 Subject: [PATCH] Handle edge case of single point passed into approx_smooth_quadratic_bezier_handles --- manimlib/utils/bezier.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/manimlib/utils/bezier.py b/manimlib/utils/bezier.py index accf0012..779210a8 100644 --- a/manimlib/utils/bezier.py +++ b/manimlib/utils/bezier.py @@ -198,7 +198,9 @@ def approx_smooth_quadratic_bezier_handles( another that would produce a parabola passing through P0, call it smooth_to_left, and use the midpoint between the two. """ - if len(points) == 2: + if len(points) == 1: + return points[0] + elif len(points) == 2: return midpoint(*points) smooth_to_right, smooth_to_left = [ 0.25 * ps[0:-2] + ps[1:-1] - 0.25 * ps[2:]