Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c3f97a9

Browse files
committed
Don't cache many-sided unit regular polygons -- just the small ones --
otherwise we could end up caching many large things. svn path=/trunk/matplotlib/; revision=4981
1 parent 3bc4747 commit c3f97a9

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

lib/matplotlib/path.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,10 @@ def unit_regular_polygon(cls, numVertices):
317317
Returns a Path for a unit regular polygon with the given
318318
numVertices and radius of 1.0, centered at (0, 0).
319319
"""
320-
path = cls._unit_regular_polygons.get(numVertices)
320+
if numVertices <= 16:
321+
path = cls._unit_regular_polygons.get(numVertices)
322+
else:
323+
path = None
321324
if path is None:
322325
theta = (2*npy.pi/numVertices *
323326
npy.arange(numVertices + 1).reshape((numVertices + 1, 1)))
@@ -337,7 +340,10 @@ def unit_regular_star(cls, numVertices, innerCircle=0.5):
337340
Returns a Path for a unit regular star with the given
338341
numVertices and radius of 1.0, centered at (0, 0).
339342
"""
340-
path = cls._unit_regular_stars.get((numVertices, innerCircle))
343+
if numVertices <= 16:
344+
path = cls._unit_regular_stars.get((numVertices, innerCircle))
345+
else:
346+
path = None
341347
if path is None:
342348
ns2 = numVertices * 2
343349
theta = (2*npy.pi/ns2 * npy.arange(ns2 + 1))

0 commit comments

Comments
 (0)