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

Added `geometry.Line` base

Open itzpr3d4t0r opened this issue 1 year ago • 1 comments
trafficstars

This pull request adds the Line class to the pygame.geometry module.

It also adds the xa, ya, xb, yb, a, b attributes, str functionality (for printing), and the copy method. It also adds their associated docs and tests.

Important Note As things stand, we don't accept building a Line with the exact same start and end point. This isn't strictly necessary as we reversed this same behaviour with the Circle class. Just tell me if this should be changed in this PR on a following one.

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

  • geometry.pyi https://github.com/pygame-community/pygame-geometry/blame/main/geometry.pyi Credits to @Emc2356 @itzpr3d4t0r @novialriptide @ScriptLineStudios @avaxar

  • geometry.rst https://github.com/pygame-community/pygame-geometry/blame/main/docs/line.rst Credits to @Emc2356 @itzpr3d4t0r @ScriptLineStudios @avaxar

  • line.c https://github.com/pygame-community/pygame-geometry/blame/main/src_c/line.c Credits to @Emc2356 @itzpr3d4t0r @novialriptide @ScriptLineStudios @avaxar

  • geometry.h https://github.com/pygame-community/pygame-geometry/blame/main/src_c/include/geometry.h Credits to @Emc2356 @itzpr3d4t0r @maqa41

  • geometry.c https://github.com/pygame-community/pygame-geometry/blame/main/src_c/geometry.c Credits to @Emc2356 @itzpr3d4t0r @novialriptide @ScriptLineStudios @avaxar

  • geometry_test.py https://github.com/pygame-community/pygame-geometry/blame/main/test/test_line.py Credits to @Emc2356 @itzpr3d4t0r @novialriptide @ScriptLineStudios @avaxar

itzpr3d4t0r avatar Sep 29 '24 10:09 itzpr3d4t0r

woah

damusss avatar Sep 29 '24 10:09 damusss

Is there any specific reason why the coordinates are named with xa, yb instead of ax, by? The current is annoying for me to parse mentally, as it looks backwards and the 'subscript' appears in front of the point.

aatle avatar Oct 09 '24 02:10 aatle