MATLAB intersection of 2 surfaces
Posted
by caglarozdag
on Stack Overflow
See other posts from Stack Overflow
or by caglarozdag
Published on 2010-04-23T23:10:16Z
Indexed on
2010/04/23
23:13 UTC
Read the original article
Hit count: 511
matlab
Hi everyone,
I consider myself a beginner in MATLAB so bear with me if the answer to my question is an obvious one.
Phi=0:pi/100:2*pi;
Theta=0:pi/100:2*pi;
[PHI,THETA]=meshgrid(Phi,Theta);
R=(1 + cos(PHI).*cos(PHI)).*(1 + cos(THETA).*cos(THETA));
[X,Y,Z]=sph2cart(THETA,PHI,R);
surf(X,Y,Z); %display
hold on;
x1=-4:.1:4;
[X1,Y1] = meshgrid(x1);
a=1.8; b=0; c=3; d=0;
Z1=(d- a * X1 - b * Y1)/c;
shading flat;
surf(X1,Y1,Z1);
I have written this code which plots a 3d cartesian plot of a plane intersecting a peanut shaped object at an angle.
I need to get the intersection of these on 2D (going to be the outline of a peanut, but a bit skewed since the intersection happens at an angle), but don't know how.
Thanks
© Stack Overflow or respective owner