【发布时间】:2023-03-30 04:40:01
【问题描述】:
我在Matlab R2010b 中使用DelaunayTri() 计算了Delaunay 三角剖分。现在我想将三角形的一个子集(即 12200 个三角形)烧成一个矩阵(光栅)。有什么快速/有效的方法吗?
我尝试使用poly2mask() 和inpolygon() 来选择三角形内的像素,但这相当慢。
【问题讨论】:
标签: matlab triangulation delaunay rasterizing
我在Matlab R2010b 中使用DelaunayTri() 计算了Delaunay 三角剖分。现在我想将三角形的一个子集(即 12200 个三角形)烧成一个矩阵(光栅)。有什么快速/有效的方法吗?
我尝试使用poly2mask() 和inpolygon() 来选择三角形内的像素,但这相当慢。
【问题讨论】:
标签: matlab triangulation delaunay rasterizing
我实现了这个快速解决方案:
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;
【讨论】: