8000 better name for interior_extrema and docs · matplotlib/matplotlib@692c20c · GitHub
[go: up one dir, main page]

Skip to content

Commit 692c20c

Browse files
committed
better name for interior_extrema and docs
1 parent 1b12e91 commit 692c20c

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

lib/matplotlib/bezier.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,10 @@ def polynomial_coefficients(self):
271271
Returns
272272
-------
273273
coefs : float, (n+1, d) array_like
274-
coefficients after expanding in polynomial basis, where n is the
275-
degree of the bezier curve
274+
Coefficients after expanding in polynomial basis, where `n` is the
275+
degree of the bezier curve and `d` its dimension.
276+
These are the numbers (:math:`C_j`) such that the curve can be
277+
written :math:`\sum_{j=0}^n C_j t^j`.
276278
277279
Notes
278280
-----
@@ -282,6 +284,7 @@ def polynomial_coefficients(self):
282284
283285
{n \choose j} \sum_{i=0}^j (-1)^{i+j} {j \choose i} P_i
284286
287+
where :math:`P_i` are the control points of the curve.
285288
"""
286289
n = self.degree
287290
# matplotlib uses n <= 4. overflow plausible starting around n = 15.
@@ -299,18 +302,19 @@ def polynomial_coefficients(self):
299302
return coefs
300303

301304
@property
302-
def interior_extrema(self):
305+
def axis_aligned_extrema(self):
303306
"""
304307
Return the location along the curve's interior where its partial
305308
derivative is zero, along with the dimension along which it is zero for
306-
each instance.
309+
each such instance.
307310
308311
Returns
309312
-------
310313
dims : int, array_like
311-
dimension $i$ along which the corresponding zero occurs
314+
dimension :math:`i` along which the corresponding zero occurs
312315
dzeros : float, array_like
313-
of same size as dims. the $t$ such that $d/dx_i B(t) = 0$
316+
of same size as dims. the :math:`t` such that :math:`d/dx_i B(t) =
317+
0`
314318
"""
315319
n = self.degree
316320
Cj = self.polynomial_coefficients
@@ -325,7 +329,7 @@ def interior_extrema(self):
325329
dims.append(i*np.ones_like(r))
326330
roots = np.concatenate(roots)
327331
dims = np.concatenate(dims)
328-
in_range = np.isreal(roots) & (roots > 0) & (roots < 1)
332+
in_range = np.isreal(roots) & (roots >= 0) & (roots <= 1)
329333
return dims[in_range], np.real(roots)[in_range]
330334

331335

lib/matplotlib/path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ def get_exact_extents(self, **kwargs):
627627
_update_extents(extents, curve(0)) # start point
628628
_update_extents(extents, curve(1)) # end point
629629
# interior extrema where d/ds B(s) == 0
630-
_, dzeros = curve.interior_extrema
630+
_, dzeros = curve.axis_aligned_extrema
631631
if len(dzeros) == 0:
632632
continue
633633
for zero in dzeros:

0 commit comments

Comments
 (0)
0