Draw contourslice on patch surface

12 views (last 30 days)
I am trying to get the XData and YData on a contourslice in matlab. I want this contourline to be on a patch that I have already made in 3D. The patch corresponds to a rectangular plane orthogonal to the -x axis rotated about the y axis from -x by some angle dphi. I have provided some of my code below with images.
AoAd = 45;
Ty = 1/2*cosd(AoAd); % wing position in y
Tz = 1/2*sind(AoAd); % wing position in z
yslice = [Ty, Ty, -Ty, -Ty]+[1/2, 1/2, -1/2, -1/2];
zslice = [-Tz, Tz, Tz, -Tz]+[-1/2, 1/2, 1/2, -1/2];
xslice = -.15;
S = [xslice*ones(size(yslice));
yslice;
zslice];
dphi = 7.5; % degrees
MR = [[cosd(dphi) 0 -sind(dphi) 0];...
[0 1 0 0];...
[sind(dphi) 0 cosd(dphi) 0];...
[0 0 0 1]];
S_prime = MR*[S,[0,0,0]';
[0,0,0,0],1];
x = S_prime(1,1:4);
y = S_prime(2,1:4);
z = S_prime(3,1:4);
figure
hold on
patch(x,y,z,'r')
cc = contourslice(Xw,Yw,Zw,D_ta,z,y,x,[-3,-3],'linear');
Now, I expect the there two be a single iso-line on the red patch. But instead I get several iso-lines that look orthogonal to the red patch. Can I get some help figuring out what I'm doing wrong here.
It seems to me that the smaller region is at least on a parallel plane but I don't know why the others aren't.
Addendum:
I also tried using the XYZ data from patch and this was the result. Still not on the plane, and there are some slices on different planes.
figure
hold on
p = patch(x,y,z,'r');
xp = p.XData;
yp = p.YData;
zp = p.ZData;
cc = contourslice(Xw,Yw,Zw,D_ta,xp,yp,zp,[-3,-3],'linear');
  2 Comments
darova
darova on 3 Aug 2019
Just to clarify: you want to project your data onto red plane?
Nathaniel H Werner
Nathaniel H Werner on 3 Aug 2019
Edited: Nathaniel H Werner on 3 Aug 2019
Yes, I am trying to get a volume slice of the data on the red patch. If you can't run the code try using the built in flow or peaks.

Sign in to comment.

Accepted Answer

darova
darova on 3 Aug 2019
Try to refine mesh of your plane
I attached a simple example (help example modified)
Can you attach your data
  16 Comments
darova
darova on 6 Aug 2019
Maybe you wanted slice of XZ plane? I like it more
img2.png img3.png
Nathaniel H Werner
Nathaniel H Werner on 6 Aug 2019
The right image looks exactly like what I need, the red planes are XY or YZ planes rotated around the Y axis. Does the new Untitled3 script make that figure?

Sign in to comment.

More Answers (0)

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!