Plotting a closed volume by connecting my points together
2 次查看(过去 30 天)
显示 更早的评论
*I have coordinates of some points and by connecting them in 3D, I want matlab gives me a closed volume, not just connecting the points together by lines. How can I do that?
This is my coding.*
x=[-2.03759998750000,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000,46.8795999980000,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000,-1.53839999775000,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000,46.8795999980000,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000,14.1450000037500,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000,46.8795999980000,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000,-1.53839999775000,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000,46.8795999980000,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000]';
y=[-1.47299999962500,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500,-81.3849999943750,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500,-89.1150000028750,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500,-81.3849999943750,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500,-45.8089999963750,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500,-81.3849999943750,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500,-89.1150000028750,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500,-81.3849999943750,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500]';
z=[-61.5049999987500,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500,0.0130000062499988,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500,-20.4589999845000,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500,0.0130000062499988,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500,-40.9549999897500,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500,0.0130000062499988,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500,-20.4589999845000,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500,0.0130000062499988,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500]';
F = TriScatteredInterp(x,y,z);
ti = -100:0.5:100;
[qx,qy] = meshgrid(ti,ti);
qz = F(qx,qy);
mesh(qx,qy,qz);
hold on;
plot3(x,y,z,'o');
xlabel('x')
ylabel('y')
zlabel('z')
0 个评论
回答(2 个)
KSSV
2017-10-18
Other method is using delaunayTriangulation.
dt = delaunayTriangulation(x,y,z) ;
tetramesh(dt)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 3-D Volumetric Image Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!