0
我在xy平面中有两条相交路径,请参阅图像。 从两条相交路径中获取三条合成路径
路径由一系列点定义,以便每两个连续的点形成路径边。路径总是关闭。点标记以指示它们是否来自边缘或曲线。 我想写一个函数来获得如下三个路径。
我尝试了以下方法。
create temp path Object path_C
go through every edge in path_A
go through every edge in path_B
if current edge of path_A intersects edge of path_B
find the intersection
store the intersection point in path_C
inner loop ends here
outer loop ends here
go through every point in path_A
if a point lies within the path_B
add it to the path_C
and remove it from path_A
end of loop
go through every point in path_B
if a point lies within the path_A
add it to the path_C
and remove it from path_B
end the loop
在我运行它之前,我的一位朋友指出,并不能保证path_C按照正确的顺序得到了点。现在我无法弄清楚如何解决这个问题。 如果你可以建议一些更好的优化。
附注:我其实想实现在Adobe Illustrator中的探路者面板鸿沟功能。
你知道结果可能超过3个地区 –
哦!我怎么错过了。顺便说一句,谢谢你指出。 –