Skip to content

Align CoordinateSystem coord-conversion return types with subclasses#4855

Open
Chessing234 wants to merge 1 commit into
ManimCommunity:mainfrom
Chessing234:fix/coordinate-system-conversion-return-types
Open

Align CoordinateSystem coord-conversion return types with subclasses#4855
Chessing234 wants to merge 1 commit into
ManimCommunity:mainfrom
Chessing234:fix/coordinate-system-conversion-return-types

Conversation

@Chessing234

Copy link
Copy Markdown

Overview

Fixes #4804.

The abstract CoordinateSystem.coords_to_point / point_to_coords declared single-point return types:

def coords_to_point(self, *coords: ManimFloat) -> Point3D: ...
def point_to_coords(self, point: Point3DLike) -> list[ManimFloat]: ...

but the concrete implementations in Axes / NumberPlane accept batched input and return np.ndarray (a single point or a stack of points). The base signatures — and the p2c alias — are therefore inconsistent with actual behaviour, misleading type checkers and API readers.

Fix

  • Widen coords_to_point input to the same union already used by c2p, and return np.ndarray.
  • Widen point_to_coords (and p2c) to accept batched points and return np.ndarray.
  • Remove the stale # ... line 2065 TODO comment (the referenced line no longer exists).

No runtime behaviour changes; annotations only.

Made with Cursor

The abstract CoordinateSystem.coords_to_point/point_to_coords (and the p2c
alias) declared single-point return types (Point3D / list[ManimFloat]), but
concrete implementations (Axes, NumberPlane) accept batched input and return
np.ndarray. Widen the base signatures to match and drop the stale
line-number TODO (ManimCommunity#4804).

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

graphing: align coords_to_point return type in base class with subclass behaviour

1 participant