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)
| 664 | |
| 665 | @classmethod |
| 666 | def unit_regular_star(cls, numVertices, innerCircle=0.5): |
| 667 | """ |
| 668 | Return a :class:`Path` for a unit regular star with the given |
| 669 | numVertices and radius of 1.0, centered at (0, 0). |
| 670 | """ |
| 671 | if numVertices <= 16: |
| 672 | path = cls._unit_regular_stars.get((numVertices, innerCircle)) |
| 673 | else: |
| 674 | path = None |
| 675 | if path is None: |
| 676 | ns2 = numVertices * 2 |
| 677 | theta = (2*np.pi/ns2 * np.arange(ns2 + 1)) |
| 678 | # This initial rotation is to make sure the polygon always |
| 679 | # "points-up" |
| 680 | theta += np.pi / 2.0 |
| 681 | r = np.ones(ns2 + 1) |
| 682 | r[1::2] = innerCircle |
| 683 | verts = np.vstack((r*np.cos(theta), r*np.sin(theta))).transpose() |
| 684 | codes = np.empty((ns2 + 1,)) |
| 685 | codes[0] = cls.MOVETO |
| 686 | codes[1:-1] = cls.LINETO |
| 687 | codes[-1] = cls.CLOSEPOLY |
| 688 | path = cls(verts, codes, readonly=True) |
| 689 | if numVertices <= 16: |
| 690 | cls._unit_regular_stars[(numVertices, innerCircle)] = path |
| 691 | return path |
| 692 | |
| 693 | @classmethod |
| 694 | def unit_regular_asterisk(cls, numVertices): |