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

Added missing Circle attrs #2519

Merged

Conversation

itzpr3d4t0r
Copy link
Member

@itzpr3d4t0r itzpr3d4t0r commented Oct 15, 2023

Follows #2267. This PR adds the following attributes to the Circle class:

  • r_sqr: representing the radius squared
  • center: a tuple containing the x and y
  • d, diameter
  • area
  • circumference

It also adds a new internal C api function for creating tuples more efficiently: pg_tuple_couple_from_values_double.

Credits

Geometry Project:
For code, docs and tests:
@novialriptide @Emc2356 @itzpr3d4t0r @ScriptLineStudios @avaxar @Matiiss @newpaxonian @maqa41 @blankRiot96
Also thanks to @Starbuck5 for kickstarting the idea and the occasional help!

Functionality added in this PR

@itzpr3d4t0r itzpr3d4t0r added New API This pull request may need extra debate as it adds a new class or function to pygame geometry pygame.geometry labels Oct 15, 2023
@itzpr3d4t0r itzpr3d4t0r requested a review from a team as a code owner October 15, 2023 17:38
@itzpr3d4t0r itzpr3d4t0r mentioned this pull request Oct 15, 2023
87 tasks
@MyreMylar
Copy link
Member

Looks like this needs stubs!

@itzpr3d4t0r
Copy link
Member Author

Looks like this needs stubs!

Oh god yeah forgot the stubs xD.

Copy link
Member

@MyreMylar MyreMylar left a comment

Choose a reason for hiding this comment

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

I think we should add 'radius' as an alias for 'r' just as we have 'diameter' and 'd' - for consistency.

Otherwise it all works well and makes the draw.circle use case simpler:

circle_1 = Circle((50, 50), 30)

...

pygame.draw.circle(screen, Color("red"), circle_1.center, circle_1.r)

Approved 👍

Copy link
Member

@MyreMylar MyreMylar left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@ankith26
Copy link
Member

ankith26 commented Nov 2, 2023

Hmm, this PR seems to have conflicts now

Copy link
Member

@ankith26 ankith26 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the PR 🥳

@ankith26
Copy link
Member

ankith26 commented Nov 2, 2023

I'll squash and merge but add the co-authors you mentioned in the last section of the PR comment. Thanks to all who contributed!

@ankith26 ankith26 merged commit b64c90d into pygame-community:main Nov 2, 2023
30 checks passed
@ankith26 ankith26 added this to the 2.4.0 milestone Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
geometry pygame.geometry New API This pull request may need extra debate as it adds a new class or function to pygame
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants