@@ -617,28 +617,19 @@ pub fn bezpath_is_inside_bezpath(bezpath1: &BezPath, bezpath2: &BezPath, accurac
617
617
let inner_bbox = bezpath1. bounding_box ( ) ;
618
618
let outer_bbox = bezpath2. bounding_box ( ) ;
619
619
620
- // Eliminate bezpath1 if its bounding box is not completely inside the bezpath2's bounding box.
621
- // Reasoning:
622
- // If the inner bezpath bounding box is larger than the outer bezpath bounding box in any direction
623
- // then the inner bezpath is intersecting with or outside the outer bezpath.
624
- if !outer_bbox. contains_rect ( inner_bbox) {
625
- return false ;
626
- }
627
-
628
- // Eliminate bezpath1 if any of its anchor points are outside the bezpath2.
629
- if !bezpath1. elements ( ) . iter ( ) . filter_map ( |el| el. end_point ( ) ) . all ( |point| bezpath2. contains ( point) ) {
620
+ // Eliminate 'bezpath1' if its bounding box is completely outside the bezpath2's bounding box
621
+ if !outer_bbox. contains_rect ( inner_bbox) && outer_bbox. intersect ( inner_bbox) . is_zero_area ( ) {
630
622
return false ;
631
623
}
632
624
633
625
// Eliminate this subpath if it intersects with the other subpath.
634
- if !bezpath_intersections ( bezpath1, bezpath2, accuracy, minimum_separation) . is_empty ( ) {
626
+ if !bezpath_intersections ( bezpath1, & bezpath2, accuracy, minimum_separation) . is_empty ( ) {
635
627
return false ;
636
628
}
637
629
638
630
// At this point:
639
- // (1) This subpath's bounding box is inside the other subpath's bounding box,
640
- // (2) Its anchors are inside the other subpath, and
641
- // (3) It is not intersecting with the other subpath.
631
+ // (1) The 'bezpath1' bounding box either intersect or is inside the 'bezpath2's bounding box,
632
+ // (2) The 'bezpath1' is not intersecting with the 'bezpath2'.
642
633
// Hence, this subpath is completely inside the given other subpath.
643
634
true
644
635
}
0 commit comments