Pipe elbow creation using MATLAB code
14 ビュー (過去 30 日間)
表示 古いコメント
Hi
I am done with my MATLAB code which creates as many straight pipes I want. However, I want to connect them using pipe elbow looks like below. Any idea how to create this elbow in MATLAB?


採用された回答
John D'Errico
2023 年 1 月 25 日
編集済み: John D'Errico
2023 年 1 月 25 日
What is not working? Why do you think it is not working?
I would conjecture that one problem you have is you cannot model a 90 degree elbow as you tried to do. Your circles are drawn always parallel to each other. And that MUST be incorrect.
A second problem is you are drawing only circles. They will have no connection to each other along the length of the elbow. And that two will be a problem. So do this better by drawing a true surface, as what I would call a 2-manifold. Setting it up to follow a curve in space is a good idea.
The nice thing is, this makes it also trivial to generate a series of pipes, because the cylinder code I wrote does not care if the centerline path is a linear segment or a circular arc. For example
[pipe1x,pipe1y,pipe1z] = generalCylinder([-1 1 0;0 1 0],0.25,50);
[pipe2x,pipe2y,pipe2z] = generalCylinder([1 0 0;1 -1 0],0.25,50);
phi = linspace(0,pi/2)';
elbowarcxyz = 1*[cos(phi),sin(phi),zeros(numel(phi),1)];
[elbowx,elbowy,elbowz] = generalCylinder(elbowarcxyz,0.25,50);
H1 = surf(pipe1x,pipe1y,pipe1z);
hold on
H2 = surf(pipe2x,pipe2y,pipe2z);
H3 = surf(elbowx,elbowy,elbowz);
H1.FaceColor = 'b';
H2.FaceColor = 'g';
H3.FaceColor = 'r';
box on
hold off
axis equal
I attached generalCylinder to this answer.
Now all you need do is create a centerline path through space, and then use the cylinder code to build the cylinder as a surface that follows that path.
その他の回答 (0 件)
参考
カテゴリ
Find more on General Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!