| 655 | } |
| 656 | |
| 657 | public Paths64 Execute(Paths64 paths) |
| 658 | { |
| 659 | Paths64 result = new Paths64(); |
| 660 | if (rect_.IsEmpty()) return result; |
| 661 | foreach (Path64 path in paths) |
| 662 | { |
| 663 | if (path.Count < 3) continue; |
| 664 | pathBounds_ = Clipper.GetBounds(path); |
| 665 | if (!rect_.Intersects(pathBounds_)) |
| 666 | continue; // the path must be completely outside fRect |
| 667 | if (rect_.Contains(pathBounds_)) |
| 668 | { |
| 669 | // the path must be completely inside rect_ |
| 670 | result.Add(path); |
| 671 | continue; |
| 672 | } |
| 673 | ExecuteInternal(path); |
| 674 | CheckEdges(); |
| 675 | for (int i = 0; i < 4; ++i) |
| 676 | TidyEdgePair(i, edges_[i * 2], edges_[i * 2 + 1]); |
| 677 | |
| 678 | foreach (OutPt2? op in results_) |
| 679 | { |
| 680 | Path64 tmp = GetPath(op); |
| 681 | if (tmp.Count > 0) result.Add(tmp); |
| 682 | } |
| 683 | |
| 684 | //clean up after every loop |
| 685 | results_.Clear(); |
| 686 | for (int i = 0; i < 8; i++) |
| 687 | edges_[i].Clear(); |
| 688 | } |
| 689 | return result; |
| 690 | } |
| 691 | |
| 692 | private void CheckEdges() |
| 693 | { |