MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / axis_aligned_extrema

Method axis_aligned_extrema

lib/matplotlib/bezier.py:368–402  ·  view source on GitHub ↗

Return the dimension and location of the curve's interior extrema. The extrema are the points along the curve where one of its partial derivatives is zero. Returns ------- dims : array of int Index :math:`i` of the partial derivative whi

(self)

Source from the content-addressed store, hash-verified

366 return _get_coeff_matrix(n) @ self.control_points
367
368 def axis_aligned_extrema(self):
369 """
370 Return the dimension and location of the curve's interior extrema.
371
372 The extrema are the points along the curve where one of its partial
373 derivatives is zero.
374
375 Returns
376 -------
377 dims : array of int
378 Index :math:`i` of the partial derivative which is zero at each
379 interior extrema.
380 dzeros : array of float
381 Of same size as dims. The :math:`t` such that :math:`d/dx_i B(t) =
382 0`
383 """
384 n = self.degree
385 if n <= 1:
386 return np.array([]), np.array([])
387 Cj = self.polynomial_coefficients
388 dCj = np.arange(1, n + 1)[:, None] * Cj[1:]
389
390 all_dims = []
391 all_roots = []
392
393 for i, pi in enumerate(dCj.T):
394 r = _real_roots_in_01(pi)
395 if len(r) > 0:
396 all_roots.append(r)
397 all_dims.append(np.full(len(r), i))
398
399 if not all_roots:
400 return np.array([]), np.array([])
401
402 return np.concatenate(all_dims), np.concatenate(all_roots)
403
404
405def split_bezier_intersecting_with_closedpath(

Callers 2

get_extentsMethod · 0.80
_update_patch_limitsMethod · 0.80

Calls 1

_real_roots_in_01Function · 0.85

Tested by

no test coverage detected