From e1dd68f16f98f0f05f1fa631cf53d9d9ee7964ef Mon Sep 17 00:00:00 2001 From: Taksh Date: Tue, 30 Jun 2026 16:25:22 +0530 Subject: [PATCH] fix(graphing): align coords_to_point/point_to_coords base signatures The abstract CoordinateSystem.coords_to_point declared a single Point3D return and a scalar coord param, but Axes/NumberPlane accept batch coords and return np.ndarray. Align the base (and p2c) annotations with the concrete implementations and drop the stale TODO. Fixes #4804. --- manim/mobject/graphing/coordinate_systems.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/manim/mobject/graphing/coordinate_systems.py b/manim/mobject/graphing/coordinate_systems.py index 6b8237827f..17c4b7ba9c 100644 --- a/manim/mobject/graphing/coordinate_systems.py +++ b/manim/mobject/graphing/coordinate_systems.py @@ -155,12 +155,14 @@ def __init__( self.num_sampled_graph_points_per_tick = 10 self.x_axis: NumberLine - def coords_to_point(self, *coords: ManimFloat) -> Point3D: - # TODO: I think the method should be able to return more than just a single point. - # E.g. see the implementation of it on line 2065. + def coords_to_point( + self, *coords: float | Sequence[float] | Sequence[Sequence[float]] | np.ndarray + ) -> np.ndarray: + # Subclasses (e.g. Axes, NumberPlane) return one point per input + # coordinate, so this returns a single point or a batch of points. raise NotImplementedError() - def point_to_coords(self, point: Point3DLike) -> list[ManimFloat]: + def point_to_coords(self, point: Point3DLike) -> np.ndarray: raise NotImplementedError() def polar_to_point(self, radius: float, azimuth: float) -> Point2D: @@ -216,7 +218,7 @@ def c2p( """Abbreviation for :meth:`coords_to_point`""" return self.coords_to_point(*coords) - def p2c(self, point: Point3DLike) -> list[ManimFloat]: + def p2c(self, point: Point3DLike) -> np.ndarray: """Abbreviation for :meth:`point_to_coords`""" return self.point_to_coords(point)