我有以下数据:
kx = 20;
ky = 20;
k = [kx ky];
PointsL = [
[ 32 0 0] % P1
[387 0 0]
[475 0 0]
[475 30 0]
[602 30 0] % P5
[602 220 0]
[475 220 0]
[475 737 0]
[387 737 0]
[ 32 737 0] % P10
[ 32 555 0]
[ 0 555 0]
[ 0 277 0]
[ 27 277 0]
[ 27 250 0] % P15
[ 0 250 0]
[ 0 57 0]
[ 32 57 0] % P18
];
PointsH = [
[ 32 0 270] % P1
[387 0 270]
[475 0 183]
[475 30 183]
[602 30 183] % P5
[602 220 183]
[475 220 183]
[475 737 183]
[387 737 270]
[ 32 737 270] % P10
[ 32 555 270]
[ 0 555 270]
[ 0 277 270]
[ 27 277 270]
[ 27 250 270] % P15
[ 0 250 270]
[ 0 57 270]
[ 32 57 270] % P18
];
PointsL
是下表面的点 - 都带有z=0
。
PointsH
是较高表面的点 - 在 z 轴上可更改。
它们都代表房间的点数。
以下代码绘制 3d 模型:
plength = size(PointsL,1);
for i=1:plength
if i == 1
pl1 = PointsL(plength,:);
ph1 = PointsH(plength,:);
else
pl1 = PointsL(i-1,:);
ph1 = PointsH(i-1,:);
end
pl2 = PointsL(i,:);
ph2 = PointsH(i,:);
line([pl1(1) pl2(1)], [pl1(2) pl2(2)], [pl1(3) pl2(3)]);
line([ph1(1) ph2(1)], [ph1(2) ph2(2)], [ph1(3) ph2(3)]);
line([pl1(1) ph1(1)], [pl1(2) ph1(2)], [pl1(3) ph1(3)]);
end
p1 = PointsH(2,:);
p2 = PointsH(9,:);
line([p1(1) p2(1)], [p1(2) p2(2)], [p1(3) p2(3)]);
p1 = PointsH(4,:);
p2 = PointsH(7,:);
line([p1(1) p2(1)], [p1(2) p2(2)], [p1(3) p2(3)]);
是否可以获得z
给定x,y
值的高度(值)?