Return a :class:`Path` for a unit regular star with the given numVertices and radius of 1.0, centered at (0, 0).
(cls, numVertices, innerCircle=0.5)
| 812 | |
| 813 | @classmethod |
| 814 | def unit_regular_star(cls, numVertices, innerCircle=0.5): |
| 815 | """ |
| 816 | Return a :class:`Path` for a unit regular star with the given |
| 817 | numVertices and radius of 1.0, centered at (0, 0). |
| 818 | """ |
| 819 | if numVertices <= 16: |
| 820 | path = cls._unit_regular_stars.get((numVertices, innerCircle)) |
| 821 | else: |
| 822 | path = None |
| 823 | if path is None: |
| 824 | ns2 = numVertices * 2 |
| 825 | theta = (2*np.pi/ns2 * np.arange(ns2 + 1)) |
| 826 | # This initial rotation is to make sure the polygon always |
| 827 | # "points-up" |
| 828 | theta += np.pi / 2.0 |
| 829 | r = np.ones(ns2 + 1) |
| 830 | r[1::2] = innerCircle |
| 831 | verts = (r * np.vstack((np.cos(theta), np.sin(theta)))).T |
| 832 | path = cls(verts, closed=True, readonly=True) |
| 833 | if numVertices <= 16: |
| 834 | cls._unit_regular_stars[(numVertices, innerCircle)] = path |
| 835 | return path |
| 836 | |
| 837 | @classmethod |
| 838 | def unit_regular_asterisk(cls, numVertices): |