MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / unit_regular_star

Method unit_regular_star

site-packages/matplotlib/path.py:666–691  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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):

Callers 11

unit_regular_asteriskMethod · 0.80
_set_tuple_markerMethod · 0.80
_set_starMethod · 0.80
__init__Method · 0.80
test_clip_to_bboxFunction · 0.80
test_clippingFunction · 0.80

Calls 3

getMethod · 0.45
transposeMethod · 0.45
emptyMethod · 0.45

Tested by 7

test_clip_to_bboxFunction · 0.64
test_clippingFunction · 0.64