adamwulf / ClippingBezier

ClippingBezier calculates intersection points, paths, and shapes between two UIBezierPaths
http://getlooseleaf.com/opensource/
MIT License
254 stars 34 forks source link

Intersection path error #29

Closed Adenc closed 1 year ago

Adenc commented 1 year ago

Modify the Demo code as follows Step1: Line 39 in MMClipView.m

 path1 = [UIBezierPath complexShape1];
 path2 = [UIBezierPath splitterPath];

Step2: Line 87 in MMClipView.m

 [[UIColor blackColor] setStroke];
 [path1 setLineWidth:3 / scale];
 [path1 stroke];

 [[UIColor greenColor] setStroke];
 [path2 setLineWidth:3 / scale];
 [path2 stroke];

  NSArray *intersections = [path1 intersectionWithPath:path2];
  for (UIBezierPath *path in intersections) {
      [[UIColor redColor] setStroke];
      [path setLineWidth:4 / scale];
      [path stroke];
   }

The result is difference path but intersection path.

Adenc commented 1 year ago

I have solved the problem, both paths must be in the same direction.