Matlab:从轮廓线创建3D图形时的工件

问题描述 投票:2回答:1

我需要绘制3级幅度并将其映射到另一个距离以获得锥形3D图形。这是一张原始图片,其最高水平为90%,80%和70%:enter image description here

这是轮廓线的数据:https://pastebin.com/NUaJJbpt

我选择使用shapeAlpha()绘制3D多边形:

clear;
c11 = load('cntr1.txt', '-ascii');
c21 = load('cntr2.txt', '-ascii');
c31 = load('cntr3.txt', '-ascii');
c11(:, 1:2) = c11(:, 1:2)-100.;
c21(:, 1:2) = c21(:, 1:2)-100.;
c31(:, 1:2) = c31(:, 1:2)-100.;
c12(:, 1:2) = c11(:, 1:2).*804./540.;
c22(:, 1:2) = c21(:, 1:2).*804./540.;
c32(:, 1:2) = c31(:, 1:2).*804./540.;
c11(:, 3) = 540.;
c21(:, 3) = 540.;
c31(:, 3) = 540.;
c11 = [c11; c21];
c21 = [c21; c31];
c12(:, 3) = 804.;
c22(:, 3) = 804.;
c32(:, 3) = 804.;
c12 = [c12; c22];
c22 = [c22; c32];
P1 = [c11(:,1), c11(:,2), c11(:,3); c12(:,1), c12(:,2), c12(:,3)];
P2 = [c21(:,1), c21(:,2), c21(:,3); c22(:,1), c22(:,2), c22(:,3)];
P3 = [c31(:,1), c31(:,2), c31(:,3); c32(:,1), c32(:,2), c32(:,3)];
P1 = unique(P1, 'rows');
P2 = unique(P2, 'rows');
P3 = unique(P3, 'rows');
figure;
hold on;
axis equal;
shp1 = alphaShape(P1(:,1), P1(:,2), P1(:,3), Inf);
shp2 = alphaShape(P2(:,1), P2(:,2), P2(:,3), Inf);
shp3 = alphaShape(P3(:,1), P3(:,2), P3(:,3), Inf);
h3 = shp3.plot;
h2 = shp2.plot;
h1 = shp1.plot;
set(h1,'edgecolor', 'none', 'facealpha', 0.2, 'facecolor', 'green');
set(h2,'edgecolor', 'none', 'facealpha', 0.2, 'facecolor', 'blue');
set(h3,'edgecolor', 'none', 'facealpha', 0.4, 'facecolor', 'red');
view(3);
hold off;

这就是我得到的:

enter image description here

据我所知,颜色干扰正在发生,因为每个图形都是实心的,没有孔,我需要内圆是实心的,两个外层是“环”。我已经尝试了HoleThresholdRegionThreshold的各种值,但后来我得到了错误或不完整的渲染。

我的问题:如何创建具有各种颜色和透明度的三个振幅水平的图,以便它们不会相互干扰?

matlab matlab-figure
1个回答
5
投票

一个简单的方法是避免顶部和底部的丑陋颜色渲染,使qazxsw poi,qazxsw poi和qazxsw poi的z值相互略微偏移:

P1

但是,这种体积仍然是固体,因此透明体积仍然重叠。

© www.soinside.com 2019 - 2024. All rights reserved.