@@ -496,7 +496,11 @@ def transformed(self, transform):
496
496
497
497
def contains_point (self , point , transform = None , radius = 0.0 ):
498
498
"""
499
- Return whether the (closed) path contains the given point.
499
+ Return whether the area enclosed by the path contains the given points.
500
+
501
+ The path is always treated as closed; i.e. if the last code is not
502
+ CLOSEPOLY an implicit segment connecting the last vertex to the first
503
+ vertex is assumed.
500
504
501
505
Parameters
502
506
----------
@@ -517,6 +521,17 @@ def contains_point(self, point, transform=None, radius=0.0):
517
521
Returns
518
522
-------
519
523
bool
524
+
525
+ Notes
526
+ -----
527
+ The current algorithm has some limitations:
528
+
529
+ - The result is undefined for points exactly at the boundary
530
+ (including *radius*).
531
+ - The result is undefined if there is no enclosed area, i.e. all
532
+ vertices are on a straight line.
533
+ - If bounding lines start to cross each other due to *radius* shift,
534
+ the result is not guaranteed to be correct.
520
535
"""
521
536
if transform is not None :
522
537
transform = transform .frozen ()
@@ -531,7 +546,11 @@ def contains_point(self, point, transform=None, radius=0.0):
531
546
532
547
def contains_points (self , points , transform = None , radius = 0.0 ):
533
548
"""
534
- Return whether the (closed) path contains the given point.
549
+ Return whether the area enclosed by the path contains the given point.
550
+
551
+ The path is always treated as closed; i.e. if the last code is not
552
+ CLOSEPOLY an implicit segment connecting the last vertex to the first
553
+ vertex is assumed.
535
554
536
555
Parameters
537
556
----------
@@ -541,7 +560,7 @@ def contains_points(self, points, transform=None, radius=0.0):
541
560
If not ``None``, *points* will be compared to ``self`` transformed
542
561
by *transform*; i.e. for a correct check, *transform* should
543
562
transform the path into the coordinate system of *points*.
544
- radius : float, default: 0.
563
+ radius : float, default: 0
545
564
Add an additional margin on the path in coordinates of *points*.
546
565
The path is extended tangentially by *radius/2*; i.e. if you would
547
566
draw the path with a linewidth of *radius*, all points on the line
@@ -552,6 +571,17 @@ def contains_points(self, points, transform=None, radius=0.0):
552
571
Returns
553
572
-------
554
573
length-N bool array
574
+
575
+ Notes
576
+ -----
577
+ The current algorithm has some limitations:
578
+
579
+ - The result is undefined for points exactly at the boundary
580
+ (including *radius*).
581
+ - The result is undefined if there is no enclosed area, i.e. all
582
+ vertices are on a straight line.
583
+ - If bounding lines start to cross each other due to *radius* shift,
584
+ the result is not guaranteed to be correct.
555
585
"""
556
586
if transform is not None :
557
587
transform = transform .frozen ()
0 commit comments