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

Skip to content

Commit 1e6352a

Browse files
committed
Special case degree-1 Bezier curves.
This greatly speeds up extent computation for the common case of polylines. (We were previously only special-casing the degree-0 case.)
1 parent 57c8baa commit 1e6352a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/bezier.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,10 @@ def axis_aligned_extrema(self):
287287
0`
288288
"""
289289
n = self.degree
290+
if n <= 1:
291+
return np.array([]), np.array([])
290292
Cj = self.polynomial_coefficients
291293
dCj = np.arange(1, n+1)[:, None] * Cj[1:]
292-
if len(dCj) == 0:
293-
return np.array([]), np.array([])
294294
dims = []
295295
roots = []
296296
for i, pi in enumerate(dCj.T):

0 commit comments

Comments
 (0)