Skip to content

Commit d19e4f2

Browse files
committed
Consider case where matrix A is singular (points are aligned)
1 parent acdefe6 commit d19e4f2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

manim/camera/camera.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,12 @@ def display_image_mobject(
10101010

10111011
A = np.array(homographic_matrix, dtype=ManimFloat)
10121012
b = original_coords.reshape(8).astype(ManimFloat)
1013-
transform_coefficients = np.linalg.solve(A, b)
1013+
1014+
try:
1015+
transform_coefficients = np.linalg.solve(A, b)
1016+
except np.linalg.LinAlgError:
1017+
# The matrix A might be singular
1018+
return
10141019

10151020
sub_image = sub_image.transform(
10161021
size=target_size, # Use the smallest possible size for speed.

0 commit comments

Comments
 (0)