pygame-community / pygame-geometry

🐍🎮-🔷 pygame with polygons, circles, lines, and raycasting
GNU General Public License v3.0
28 stars 11 forks source link

`RegularPolygon` implementation #82

Open novialriptide opened 2 years ago

novialriptide commented 2 years ago

@Emc2356 has already done a PR that does exactly this, but not in what I hoped. https://github.com/novialriptide/pygame_geometry/pull/73

To recap, the function is supposed to create a polygon with sides of equal length.

I was thinking of either reimplementing his PR's design to look more like this:

def RegularPolygon(pos, radius) -> Polygon

# So we would use it like this
geometry.RegularPolygon(...)

Or we can do something like this

class RegularPolygon(Polygon):
   def __init__(self, pos, radius): ...

If RegularPolygon becomes a child class of Polygon, the user would be able to modify its radius, origin_pos, etc on the go, where as if we implement the function method, the user would need to create a new Polygon when they want to change its radius as well as using a for loop to change every point to the Polygon

itzpr3d4t0r commented 2 years ago

As a short term solution we can go for (1), i'm fine with that.

novialriptide commented 2 years ago

I would like this issue to stay open for now. I feel like we can do better than just creating a new function to create a regular polygon.