I have many finite-length curves in XY domain. These curves are represented as collections of points.
I need to discretize my area by rectangles (or triangles) so that each rectangle (or triangle) is crossed by more than 2 curves and less than 5 curves for example. Even if there is no point in any rectangle but the interpolated curve is in that rectangle, then this curve crosses that rectangle. Edges of neighbor rectangles should stand close to each other (touch each other) and these rectangles should cover all the area where curves exist.
As an output I need to get XY coordinate of each rectangle (triangle). I tried to explain my problem in the picture below. So maybe somebody knows how to solve this problem or the problem is already solved. I would appreciate any information! I'm tryng to implement this in Matlab and I'm wondering is it possible to solve this with linprog() function in Matlab?
Thank you!
To plot curves use:
clearvars -except Gpath
clc
nG = size(Gpath,1);
mG = size(Gpath,2);
figure;
for n = 1:nG*mG
if ~isempty(Gpath{n})
plot(Gpath{n}(2,:),Gpath{n}(1,:));
hold on;
end
end
grid on;
Image: 2D Area with rectangles
File with curves: .mat file