Get Bbox of the path. Parameters ---------- transform : `~matplotlib.transforms.Transform`, optional Transform to apply to path before computing extents, if any. **kwargs Forwarded to `.iter_bezier`. Returns -------
(self, transform=None, **kwargs)
| 624 | return _path.path_in_path(self, None, path, transform) |
| 625 | |
| 626 | def get_extents(self, transform=None, **kwargs): |
| 627 | """ |
| 628 | Get Bbox of the path. |
| 629 | |
| 630 | Parameters |
| 631 | ---------- |
| 632 | transform : `~matplotlib.transforms.Transform`, optional |
| 633 | Transform to apply to path before computing extents, if any. |
| 634 | **kwargs |
| 635 | Forwarded to `.iter_bezier`. |
| 636 | |
| 637 | Returns |
| 638 | ------- |
| 639 | matplotlib.transforms.Bbox |
| 640 | The extents of the path Bbox([[xmin, ymin], [xmax, ymax]]) |
| 641 | """ |
| 642 | from .transforms import Bbox |
| 643 | if transform is not None: |
| 644 | self = transform.transform_path(self) |
| 645 | if self.codes is None: |
| 646 | xys = self.vertices |
| 647 | elif len(np.intersect1d(self.codes, [Path.CURVE3, Path.CURVE4])) == 0: |
| 648 | # Optimization for the straight line case. |
| 649 | # Instead of iterating through each curve, consider |
| 650 | # each line segment's end-points |
| 651 | # (recall that STOP and CLOSEPOLY vertices are ignored) |
| 652 | xys = self.vertices[np.isin(self.codes, |
| 653 | [Path.MOVETO, Path.LINETO])] |
| 654 | else: |
| 655 | xys = [] |
| 656 | for curve, code in self.iter_bezier(**kwargs): |
| 657 | # places where the derivative is zero can be extrema |
| 658 | _, dzeros = curve.axis_aligned_extrema() |
| 659 | # as can the ends of the curve |
| 660 | xys.append(curve([0, *dzeros, 1])) |
| 661 | xys = np.concatenate(xys) |
| 662 | if len(xys): |
| 663 | return Bbox([xys.min(axis=0), xys.max(axis=0)]) |
| 664 | else: |
| 665 | return Bbox.null() |
| 666 | |
| 667 | def intersects_path(self, other, filled=True): |
| 668 | """ |