pygame-ce icon indicating copy to clipboard operation
pygame-ce copied to clipboard

added Vector2.from_polar and Vector3.from_spherical classmethods

Open oddbookworm opened this issue 2 years ago • 9 comments
trafficstars

Port of https://github.com/pygame/pygame/pull/3744

oddbookworm avatar Apr 30 '23 19:04 oddbookworm

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.

Starbuck5 avatar May 01 '23 07:05 Starbuck5

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

oddbookworm avatar May 02 '23 01:05 oddbookworm

Just toggling this to re-run the CI as I think it is ready for review.

MyreMylar avatar Oct 08 '23 17:10 MyreMylar

Looks like this will need to merge with main to clear the CircleCI failure.

MyreMylar avatar Oct 15 '23 10:10 MyreMylar

It would be good to get this rebased and have the original author of this be added as a coauthor to the commit.

Starbuck5 avatar Nov 19 '23 10:11 Starbuck5

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.

itzpr3d4t0r avatar Apr 27 '24 14:04 itzpr3d4t0r