pygame-ce
pygame-ce copied to clipboard
added Vector2.from_polar and Vector3.from_spherical classmethods
Port of https://github.com/pygame/pygame/pull/3744
I'm surprised upstream chose to make the same name method have two different signatures in two different scenarios.
Is there a reason that Vector2().from_polar shouldn't return itself? That way it could be:
Vector2.from_polar((r, phi)) -> Vector2
Vector2().from_polar((r, phi)) -> Vector2
And maybe that would have simpler code? The implementation they chose works and is clever, but is a lot of complexity to add.
I don't see why we can't have the same signature for both. I'll have to dedicate more time to rewriting it, so it might have to wait until this weekend. I have at least found a way to clean up the stub for the current implementation and I'll push a commit for that
Just toggling this to re-run the CI as I think it is ready for review.
Looks like this will need to merge with main to clear the CircleCI failure.
It would be good to get this rebased and have the original author of this be added as a coauthor to the commit.
Why not make these functions METH_FASTCALL? Instead of doing it in a separate PR doubling review time we should implement it here i think.