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

`RegularPolygon` implementation

Open andrewhong04 opened this issue 3 years ago • 2 comments

@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

andrewhong04 avatar Sep 20 '22 20:09 andrewhong04

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

itzpr3d4t0r avatar Sep 25 '22 18:09 itzpr3d4t0r

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.

andrewhong04 avatar Nov 01 '22 18:11 andrewhong04