-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
Added missing Circle attrs #2519
Conversation
Looks like this needs stubs! |
Oh god yeah forgot the stubs xD. |
There was a problem hiding this 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 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Hmm, this PR seems to have conflicts now |
There was a problem hiding this 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 🥳
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! |
Follows #2267. This PR adds the following attributes to the
Circle
class:r_sqr
: representing the radius squaredcenter
: a tuple containing the x and yd
,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
circle.c
https://github.com/pygame-community/pygame-geometry/blame/main/src_c/circle.c
Credits to @Emc2356 @itzpr3d4t0r @novialriptide
geometry_test.py
https://github.com/pygame-community/pygame-geometry/blame/main/test/test_circle.py
Credits to @itzpr3d4t0r @novialriptide
geometry.rst
https://github.com/pygame-community/pygame-geometry/blame/main/docs/circle.rst
Credits to @itzpr3d4t0r