How to convert a spring plotted in plot3 into a mesh
이전 댓글 표시
Currently I am trying to create a 3D surface model of a clutch plate in MatLab's mesh/surf environment.
I have the springs plotted via the plot3 command. Master springs are generated as follows:
%Spring Generation
NumberOfTurns= 15; % How many turns in each spring?
SpringLength=15; %How long is the spring in mm
SpringRadius=(CentralDiskThickness)/2; % Coil radius of each spring?
NumberOfSprings=4; %Number of springs in the clutch plate?
%Creation of master springs, first in x-direction, then in y-direction
t = 0:0.001:1; % each spring is 1001 points
Xs1=t; %x-coordinates (this sets the spring to be created in the x-direction)
Ys1=SpringRadius*cos(t*2*pi*NumberOfTurns); % y-coordinates
Zs1=SpringRadius*sin(t*2*pi*NumberOfTurns); % z-coordinates
Xs2=SpringRadius*sin(t*2*pi*NumberOfTurns) %x-coordinates
Ys2=t %y-coordinates (this sets the spring to be created in the y-direction)
Zs2=SpringRadius*cos(t*2*pi*NumberOfTurns) %z-coordinates
This code is based off Amitava Biswas' "Spring Demo" code.
The plotting of the springs is as follows:
for k=1:2 % each spring at a time
% log xyz coordinates of two end points for this spring
dX=x2(k)-x1(k); % extent of this spring along x-axis
dY=y2(k)-y1(k); % extent of this spring along y-axis
dZ=z2(k)-z1(k); % extent of this spring along z-axis
p=[Xs1'*dX,Ys1',Zs1'] % "Xs1*dX" stretches the spring in the x-direction to the correct length
sX=p(:,1)+x1(k); % shift x-coordinates
sY=p(:,2)+y1(k); % shift y-coordinates
sZ=p(:,3)+z1(k); % shift z-coordinates
plot3(sX,sY,sZ,'linewidth',2,'color', rand(1,3))
hold on % to add next spring
end
And another for loop is used for the y-direction springs
I want to plot this data as a mesh instead, so that I am able to create an overall mesh with both the springs and the rest of the clutch plate.
Any ideas?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Surfaces, Volumes, and Polygons에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


