Return whether the area enclosed by the path contains the given points. The path is always treated as closed; i.e. if the last code is not `CLOSEPOLY` an implicit segment connecting the last vertex to the first vertex is assumed. Parameters --------
(self, points, transform=None, radius=0.0)
| 569 | return _path.point_in_path(point[0], point[1], radius, self, transform) |
| 570 | |
| 571 | def contains_points(self, points, transform=None, radius=0.0): |
| 572 | """ |
| 573 | Return whether the area enclosed by the path contains the given points. |
| 574 | |
| 575 | The path is always treated as closed; i.e. if the last code is not |
| 576 | `CLOSEPOLY` an implicit segment connecting the last vertex to the first |
| 577 | vertex is assumed. |
| 578 | |
| 579 | Parameters |
| 580 | ---------- |
| 581 | points : (N, 2) array |
| 582 | The points to check. Columns contain x and y values. |
| 583 | transform : `~matplotlib.transforms.Transform`, optional |
| 584 | If not ``None``, *points* will be compared to ``self`` transformed |
| 585 | by *transform*; i.e. for a correct check, *transform* should |
| 586 | transform the path into the coordinate system of *points*. |
| 587 | radius : float, default: 0 |
| 588 | Additional margin on the path in coordinates of *points*. |
| 589 | The path is extended tangentially by *radius/2*; i.e. if you would |
| 590 | draw the path with a linewidth of *radius*, all points on the line |
| 591 | would still be considered to be contained in the area. Conversely, |
| 592 | negative values shrink the area: Points on the imaginary line |
| 593 | will be considered outside the area. |
| 594 | |
| 595 | Returns |
| 596 | ------- |
| 597 | length-N bool array |
| 598 | |
| 599 | Notes |
| 600 | ----- |
| 601 | The current algorithm has some limitations: |
| 602 | |
| 603 | - The result is undefined for points exactly at the boundary |
| 604 | (i.e. at the path shifted by *radius/2*). |
| 605 | - The result is undefined if there is no enclosed area, i.e. all |
| 606 | vertices are on a straight line. |
| 607 | - If bounding lines start to cross each other due to *radius* shift, |
| 608 | the result is not guaranteed to be correct. |
| 609 | """ |
| 610 | if transform is not None: |
| 611 | transform = transform.frozen() |
| 612 | result = _path.points_in_path(points, radius, self, transform) |
| 613 | return result.astype('bool') |
| 614 | |
| 615 | def contains_path(self, path, transform=None): |
| 616 | """ |