How to cut a polygonal mesh by a line? (Tips needed)
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Luca M
am 24 Jan. 2021
Beantwortet: Vimal Rathod
am 28 Jan. 2021
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 Kommentare
Akzeptierte Antwort
Vimal Rathod
am 28 Jan. 2021
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Elementary Polygons finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!