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

馋奶兔 提交于 2019-12-23 16:20:21

问题


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

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

and here is my sample 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 doing this I am getting and array which has 2 points of intersection, but it also has bezier curve information with t values. I am unable to use this information to create a new path

来源:https://stackoverflow.com/questions/43179268/difference-and-intersection-of-paths-in-svg-using-snap-path-intersection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!