Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VectorNDLike type aliases #4068

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

chopan050
Copy link
Contributor

@chopan050 chopan050 commented Dec 23, 2024

As mentioned in PR #4027, type aliases such as VectorNDLike and VectorNDLike_Array were necessary, because there were many functions and methods in which we can represent some direction using a tuple/list of floats.

The clearest example would be the Vector Mobject. It accepts a direction as a parameter, which was typehinted as a Point2DLike | Point3DLike because Vector2D | Vector3D can only represent a NumPy array, whereas Point2DLike | Point3DLike can also represent a tuple or list. This is inconsistent and signals us that we actually need Vector2DLike and Vector3DLike type aliases.

TODOs in follow-up PRs:

  • Properly type path_ops.py, space_ops.py and three_dimensions.py, among others. Many parameters are simply typed as np.ndarray. I detected that the PathFuncType actually seems to interpolate two Point3D_Array objects, not Point3DLike.
  • Create a Quaternion type alias, and maybe also Matrix3x3.
  • Remove OpenGLMobject.wag(), because Mobject.wag() was deprecated and removed.
  • Etc.

Links to added or changed documentation pages

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

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.

1 participant