Skip to content

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

Copy link
Member

@JasonGrace2282 JasonGrace2282 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to get back to this so late!

@chopan050
Copy link
Contributor Author

Thanks! 🎉

@chopan050 chopan050 enabled auto-merge (squash) August 1, 2025 04:17
@chopan050 chopan050 merged commit d18dc8f into ManimCommunity:main Aug 1, 2025
21 checks passed
@chopan050 chopan050 deleted the vectorndlike branch August 1, 2025 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

typehints For adding/discussing typehints

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants