【发布时间】:2018-01-29 23:47:14
【问题描述】:
使用 Matlab,我正在尝试计算和绘制包含在这种形状的 z 切片中的点:
这是一个45度角的金字塔,顶部被移除。
当我在 z=198 处(略低于上面的数据提示)进行切片时,我得到了一个奇怪的工件:
这是我的代码 sn-p 进行检查:
% Setup alphaShape as "alpha" ....
points = 1e3 * [0.3223 0.1761 0.3299
0.5752 1.2034 -0.0618
-0.0172 1.2034 -0.0618
0.2357 0.1761 0.3299
0.3223 0.0671 0.2209
0.5752 0.4588 -0.8064
-0.0172 0.4588 -0.8064
0.2357 0.0671 0.2209];
alpha = alphaShape(points);
% Then, check if coordinates on slice are in or outside alpha
z = 198;
width = 550;
depth = 450;
inout = zeros(width,depth);
for qx = 1:width
for qy = 1:depth
in = inShape(alpha,qx,qy,z);
if (in)
inout(qx,qy) = 1;
end
end
end
% Plot
figure; contourf(inout.'); % Not sure why conjugate needed?
谁能指出是什么导致我的切片结果中出现了额外的“挂钩”?或者如何修复我的代码以将其删除?
编辑:使用plot(alpha),方形顶部没有像我想象的那样连接到底座:
我最初的情节是这样完成的:
K = convhull(points);
figure;trisurf(K,points(:,1),points(:,2),points(:,3),'Facecolor','red','FaceAlpha',0.1);
【问题讨论】:
-
您的
alpha正确吗?什么是qz,你的意思是z?请创建MCVE,它将帮助您获得帮助。
标签: matlab