def __new__(*args, **kwargs): r = kwargs["r"] del(kwargs["r"]) center = kwargs["center"] del(kwargs["center"]) m = r / 3 cross = Polygon([(-m, -r), (m, -r), (m, -m), (r, -m), (r, m), (m, m), (m, r), (-m, r), (-m, m), (-r, m), (-r, -m), (-m, -m)], **kwargs) cross.translate(center[0], center[1]) cross.rotate(45, (0., 0.)) return cross
def __new__(*args, **kwargs): rc = kwargs["rc"] # circumcircle radius del(kwargs["rc"]) a = rc / (np.sqrt(3) / 3) h = rc / (np.sqrt(3) / 2) center = kwargs["center"] del(kwargs["center"]) rotate = kwargs["rotate"] if "rotate" in kwargs else False if "rotate" in kwargs: del(kwargs["rotate"]) rotate = -1 if rotate else 1 triangle = Polygon([(0., -rc * rotate), (-a / 2, (h / 2) * rotate), (a / 2, (h / 2) * rotate)], **kwargs) triangle.translate(center[0], center[1]) return triangle