Revolution of 2D geometry to create a torus-like shape (I'm getting distortion?)

8 views (last 30 days)
I am trying to revolve a somewhat complex shape around a circle with radius R. The same idea as a taurus, but with arbitrary cross sectional geometry. However, I am getting distortion in multiple axis. I've included a code showing the problem and a picture of what is wrong.
%%Problem script
R = 1;
N_phi = 80;
% Grab arbitrary disk coords in cartesian (example is a circle)
th = 0:pi/50:2*pi;
shape(:,1) = .25 * cos(th);
shape(:,2) = .25 * sin(th);
shape(:,3) = 0;
% Shift disk coords over by R
shape(:,1) = shape(:,1)+R;
% Convert back to spherical coords
[THdisk,PHIdisk,Rdisk] = cart2sph(shape(:,1),shape(:,2),shape(:,3));
% Make ring from individual disks
d_phi = 2*pi/N_phi;
THdisk2 = THdisk;
Rdisk2 = Rdisk;
for i = 1:N_phi
PHIdisk2 = PHIdisk + d_phi*i-d_phi;
% Convert back to cartesian coordinates.
[ring(:,1,i),ring(:,2,i),ring(:,3,i)] = sph2cart(THdisk2,PHIdisk2,Rdisk2);
end
hold on
for i = 1:N_phi
plot3(ring(:,1,i),ring(:,2,i),ring(:,3,i),'ro')
end
grid on
axis equal
xlabel('x')
ylabel('y')
zlabel('z')

Answers (0)

Categories

Find more on Propagation and Channel Models 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!