From a2606c7e37dfb133ea644e90d6017ec34fbc2dd0 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Thu, 3 Nov 2022 16:48:14 -0700 Subject: [PATCH] Make sure find_intersection returns a result matching the shape of inputs --- manimlib/utils/space_ops.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manimlib/utils/space_ops.py b/manimlib/utils/space_ops.py index faeef158..7c2cfe4e 100644 --- a/manimlib/utils/space_ops.py +++ b/manimlib/utils/space_ops.py @@ -294,7 +294,10 @@ def find_intersection( denom[abs(denom) < threshold] = np.inf # So that ratio goes to 0 there ratio = numer / denom ratio = np.repeat(ratio, n).reshape((m, n)) - return p0 + ratio * v0 + result = p0 + ratio * v0 + if m == 1: + return result[0] + return result def get_closest_point_on_line(