Difference and intersection of paths in SVG using Snap.path.intersection

I am trying to find the intersection between them, then using the same result to get the difference between the first and the second. I am trying to use Snap.path.intersection feature in Snap.svg.

here is the link to the function http://snapsvg.io/docs/#Snap.path.intersection

and here is my example code

var p1='M 185.90092404385516 250 m -170.90092404385516 0 a 170.90092404385516 170.90092404385516 0 1 0 341.8018480877103 0 a 170.90092404385516 170.90092404385516 0 1 0 -341.8018480877103 0';
var p2='M 336.8744227648239 250 m -148.12557723517602 0 a 148.12557723517602 148.12557723517602 0 1 0 296.25115447035205 0 a 148.12557723517602 148.12557723517602 0 1 0 -296.25115447035205 0';
var PAPER=Snap(document.getElementById('svg'));
var path1=PAPER.path(p1);
path1.attr({'fill-opacity':0.3})

var path2=PAPER.path(p2);
path2.attr({'fill-opacity':0.3})
var intersection=Snap.path.intersection(p1, p2);

      

Now after that I get and an array which has 2 intersection points but also has risk-free curve information with t values. I cannot use this information to create a new path.

+3


source to share





All Articles