How to cut a polygonal mesh by a line? (Tips needed)

20 visualizaciones (últimos 30 días)
Luca M
Luca M el 24 de En. de 2021
Respondida: Vimal Rathod el 28 de En. de 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.

Respuesta aceptada

Vimal Rathod
Vimal Rathod el 28 de En. de 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

Más respuestas (0)

Categorías

Más información sobre Elementary Polygons en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by