How can I find intersection of a cylinder and helical isosurface.
Show older comments
[x3, y3,z3] = meshgrid(linspace(-1, 1),linspace(-1, 1),linspace(0, 4*pi)); f1=x3.^2+y3.^2-1; f2=y3-x3.*tan(z3); [x2, y2] = meshgrid(linspace(-1,1)); z2=atan2(y2,x2);
% Visualize the two surfaces. % patch(isosurface(x3, y3, z3, f1, 0), 'FaceColor', [0.5 1.0 0.5], 'EdgeColor', 'none'); patch(isosurface(x3, y3, z3, f2, 0), 'FaceColor', [1.0 0.5 0.0], 'EdgeColor', 'none'); view(3); camlight; axis vis3d; hold on
Df3=f1-f2;
Df3s = interp3(x3, y3, z3, Df3, x2, y2, z2);
% Find the contour where the difference (on the surface) is zero. C = contours(x2, y2, Df3s, [0 0]);
% Extract the x- and y-locations from the contour matrix C. xL = C(1, 2:end); yL = C(2, 2:end);
% Interpolate on the first surface to find z-locations for the intersection % line. zL = interp2(x2, y2, z2, xL, yL); % Visualize the line. line(xL,yL,zL,'Color','g','LineWidth',100);
Accepted Answer
More Answers (0)
Categories
Find more on Surface and Mesh Plots 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!
