Open chopan050 opened 3 days ago
could you also update our docs on choosing typehints?
Done! Please, take a look and tell me what you think about it, @JasonGrace2282
.. warning:: This is not always true. For example, as of Manim 0.18.0, the direction parameter of the :class:
.Vector
Mobject should bePoint2D | Point3D
, as it can also accepttuple[float, float]
andtuple[float, float, float]
.
To me, this indicates that we also need Vector2DLike
, Vector3DLike
and similar type aliases.
There are also methods like Mobject.rotate()
which can actually accept hypothetical Vector3DLike
arguments in their current state, methods like Mobject.shift()
which could do that with a small rewriting (np.sum(vectors, axis=0)
instead of reduce(op.add, vectors)
) and functions like cross
from space_ops
.
Also, it's a bit weird that find_intersection
from space_ops
accepts Point3DLike_Array
for p0s
and p1s
, but not Vector3DLike_Array
for v0s
and v1s
.
I would like to discuss this more. If we agree on this, I could add those Vector...Like...
type aliases, either in this PR or in a different one.
Closes #4016
Reviewer Checklist