How to cut a polygonal mesh by a line? (Tips needed)
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Vimal Rathod
il 28 Gen 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Elementary Polygons in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!