dt = DelaunayTri(X, Y, C);
I have a column vector 'tri', where each number corresponds to triangle ID in dt.Triangulation, e.g.:
tri(:,1) = [1; 12; 14; 16]; % corresponds to dt.Triangulation(1,:), dt.Triangulation(12,:), dt.Triangulation(14,:), etc.
Now I'd like to create a triplot, where only triangles specified in 'tri' would have a blue background. How could I do that?
Thank you for all your help!
Hi Bruno!
Thank you. I'm trying the following:
% Get vertices of each triangle in 'tri', where k is total number of triangles in 'tri'
V1t = x(handles.dt(tri(1:k,1),1),:);
V2t = x(handles.dt(tri(1:k,1),2),:);
V3t = x(handles.dt(tri(1:k,1),3),:);
Vertices = V1t + V2t + V3t;
fill(Vertices(1:k,1), Vertices(1:k,2), 'b')
However, this code does not provide a correct result. Thanks for any help.
x =randn(100,1);
y =randn(100,1);
dt = DelaunayTri(x,y)
T = dt.Triangulation;
patch(x(T)',y(T)','b','EdgeColor','w');
Please adapt it to you need.
Bruno
Thanks a lot! One more question just to be sure that I am on the right way. I have a constrained Delaunay Triangulation specified as follows:
dt = DelaunayTri(vertices,edges);
isInside = inOutStatus(dt);
faces = dt(isInside,:);
Do I understand correctly that the logic of 'patch' will remain the same?
Your code does exactly what I need, if Delaunay Triangulation is specified by x & y:
x =randn(100,1); y =randn(100,1); dt = DelaunayTri(x,y);
However, I still can't figure it out for a constrained DT...
I solved this problem. It was quite simple. It seems that I just had incomplete understanding of 'dt' structure.