How to cut a polygonal mesh by a line? (Tips needed)
6 次查看(过去 30 天)
显示 更早的评论
Hi, I have got this kind of problem that maybe solved with matalb but I am unsure how:
I have a mesh in its simplest form, a set of (x, y) node coordinates, and a connectivity cell array, for example:
N = [0 0; 0 2; 2 2; 2 0; 1 1];
E = {[1 2 5]; [2 3 5]; [3 4 5]; [4 1 5]}; % all anti-clockwise oriented
Then I have a line given by two points:
x1 = [0.1 0]
x2 = [1.1, 1.2]
What I need to do is to cut the existing mesh and get a new mesh with the new nodes added and the new element to node connectivity cell array.
My idea is to loop over all elements and find the intersections of the line with the boundary of the elements, then add these new nodes and split each polygon accordingly. If a line tip is inside an element (i.e. only one intersection is found) just cut the element in an arbitrary way.
I am looking for tips on how to approach this kind of problem, for example which Matlab functions are best to cut, find intersections etc.? Thanks a lot for reading through.
0 个评论
采纳的回答
Vimal Rathod
2021-1-28
Hi,
You could use 'polyxpoly' function to find the intersection points of the line on the polygon edges which would probably help to solve your issue.
Refer to the following link for more information on the function polyxpoly
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Elementary Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!