简体   繁体   中英

Rasterizing Delaunay triangulation in Matlab

I have computed a Delaunay triangulation using DelaunayTri() in Matlab R2010b . Now I would like to burn a subset of the triangles (ie 12200 triangles) into a matrix (Raster). Is there any fast/efficient way of doing this?

I have tried using both poly2mask() and inpolygon() to select pixels inside the triangles, but this is rather slow.

I implemented this fast solution:

qrypts=[xgridcoords, ygridccords]; %grid x and y coordinates
triids = pointLocation(dt, qrypts); %associate each grid point to its Delaunay triangle
Lia = ismember(triids,dtsubset); %keep subset of points contained in the desired triangles (dtsubset contains the indices of desired triangles)
IM=false(size(grid)); 
IM(Lia)=1;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM