How do i find the intersection between two torus ?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Duc Le
el 18 de Feb. de 2020
Comentada: Duc Le
el 20 de Feb. de 2020
I have 2 torus in three-dimensional space, and i need to find the intersection between them
R=9; % outer radius of torus
r=3; % inner tube radius
th=linspace(0,2*pi,36); % e.g. 36 partitions along perimeter of the tube
phi=linspace(0,2*pi,18); % e.g. 18 partitions along azimuth of torus
% we convert our vectors phi and th to [n x n] matrices with meshgrid command:
[Phi,Th]=meshgrid(phi,th);
% now we generate n x n matrices for x,y,z according to eqn of torus
x1= (R+r.*cos(Th)).*cos(Phi) +9;
y1= r.*sin(Th) ;
z1= (R+r.*cos(Th)).*sin(Phi);
daspect([1 1 1]) % preserves the shape of torus
colormap('jet') % change color appearance
hold on
x2= ((R+r.*cos(Th)).*cos(Phi))*cos(2*pi/3) - (r.*sin(Th))*sin(2*pi/3) - 4.5;
y2= ((R+r.*cos(Th)).*cos(Phi))*sin(2*pi/3) + (r.*sin(Th))*cos(2*pi/3) + 9*sin(pi/3);
z2= (R+r.*cos(Th)).*sin(Phi);
surf(x1,y1,z1); % plot surface
surf(x2,y2,z2);
daspect([1 1 1]) % preserves the shape of torus
colormap('jet') % change color appearance
title('Torus')
xlabel('X');ylabel('Y');zlabel('Z');
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!