2013-07-16 56 views
0

我已经使用在Matlab R2010b中计算了Delaunay三角剖分。现在我想将三角形​​的一个子集(即12200个三角形)刻录到矩阵(Raster)中。有没有快速/有效的方式来做到这一点?在Matlab中光栅化Delaunay三角剖分

我已经尝试使用poly2mask()inpolygon()来选择三角形内的像素,但这很慢。

回答

0

我实现了这个快速的解决方案:

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;