# How to plot a subset of triangles after DelaunayTri

4 visualizzazioni (ultimi 30 giorni)
Amani il 9 Dic 2013
Commentato: Amani il 23 Dic 2013
I have computed a Delaunay triangulation using DelaunayTri(). Then I extracted big triangles based on a threshold, how can I reconstruct these triangles and plot it in a figure ?
thanks
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Simon il 9 Dic 2013
Hi!
If you have a triangulation you can of course plot specific triangles (if you know them) with
TRI = dt.Triangulation;
X = dt.X;
ind = [1,2,3,4,5];
triplot(TRI(ind, :), X(:, 1), X(:, 2));
##### 5 CommentiMostra 3 commenti meno recentiNascondi 3 commenti meno recenti
Amani il 12 Dic 2013
I got this error
Error using == Matrix dimensions must agree.
Simon il 12 Dic 2013
I used the code:
x = rand(20,1);
y = rand(20,1);
dt = DelaunayTri(x,y);
figure(1)
triplot(dt);
ID = 1;
TRI = dt.Triangulation;
X = dt.X;
[ind, ~] = ind2sub(size(TRI), find(TRI==ID));
figure(2)
triplot(TRI(ind, :), X(:, 1), X(:, 2));
Works without problems.

Accedi per commentare.

### Più risposte (1)

Amani il 9 Dic 2013
how can I calculate the distance between two connected vertices (only Y coordinate) TRI = dt.Trangulation for q=1:size(dt,1) for u=1:size(dt,1) j = isConnected(k,q,u); if (j == true) % retrive q and u (y coordinate) and calculate the distance between them end
end
thanks
##### 14 CommentiMostra 12 commenti meno recentiNascondi 12 commenti meno recenti
Simon il 19 Dic 2013
I used gimp for conversion. But I think you should not divide by 255. Images in matlab are uint8 with values between 0 and 255, in contrast to color values for e.g plotting with values between 0 and 1.
Amani il 23 Dic 2013
I remove \255 but still did not work .. is there any other way for conversion to rgb?
thanks

Accedi per commentare.

### Categorie

Scopri di più su Image Filtering and Enhancement 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!

Translated by