How to grab field data from the intersection of two slices

1 visualizzazione (ultimi 30 giorni)
Hi,
I have velocity field data in a NxMxP array, and I would like to find the values of the data at the intersection of two surfaces. For now, I am working with a plane and a cylinder, but in the future I would like to use other shapes and find the data on the intersecting arc.
Below is the picture of plane and the cylinder, and my code to make them.
AR = 5; R = 2.5;
Ny = 200;
% generate plane
[x, y] = meshgrid(-(AR+1):(AR+1)/Ny:0, ...
-0.7344:(0.7031- -0.7344)/Ny:0.7031); % Generate x and y data
z = zeros(size(x, 1)); % Generate z data
% I needed to rotate the plane by an angle about y-axis for my purposes
V1 = [reshape(x,1,(Ny+1)^2);
reshape(y,1,(Ny+1)^2);
reshape(z,1,(Ny+1)^2)];
dphi = 7.5; % angle to rotate in degrees
MR = [cosd(dphi) 0 -sind(dphi);...
0 1 0;...
sind(dphi) 0 cosd(dphi)];
% slice going through the center of the wing
VR1 = MR*V1;
xR = reshape(VR1(1,:),Ny+1,Ny+1);
yR = reshape(VR1(2,:),Ny+1,Ny+1);
zR = reshape(VR1(3,:),Ny+1,Ny+1);
% generate cylinder
Nt = floor(2.1*Ny*R); % specify the number of nodes along the tangential axis
[Xc,Zc,Yc] = cylinder(R*ones(1,Ny),Nt);
% matrix for correcting the height of cylindrical slice
ty = -0.7344;
sy = 0.7031 - -0.7344;
Mt = [1 0 0 0;
0 1 0 ty; % vertical translation
0 0 1 0;
0 0 0 1];
Ms = [1 0 0 0;
0 sy 0 0; % vertical stretching
0 0 1 0;
0 0 0 1];
H = Mt*Ms*[ones(1,Ny);Yc(:,1)';ones(1,Ny);ones(1,Ny)];
Yc = repmat(H(2,1:Ny)',1,Nt+1);
I can try and include some data if necessary
% draw figure
figure
hold on
h1 = slice(Xw,Yw,Zw,ur,xR,yR,zR,'linear');
plane_sli = h1.CData;
set(plane_sli,'edgecolor','none')
h2 = slice(Xw,Yw,Zw,ur,Xc,Yc,Zc,'linear');
cyl_sli = h2.CData;
set(cyl_sli,'edgecolor','none')
axis equal
I want to try and find the data on the red arc (line) in the image below. Is there a way I can do that?
  2 Commenti
jahanzaib ahmad
jahanzaib ahmad il 22 Feb 2019
is 2d allowed ? a cirlce or any shape with a line ?
Nathaniel H Werner
Nathaniel H Werner il 22 Feb 2019
I'm not sure what you're asking.
In this case, I want the data along the intersecting the arc, the red line. If possible I would like to make this work for the intersection of other shapes like a sphere intersecting a plane, giving a curved line.

Accedi per commentare.

Risposte (0)

Prodotti


Release

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by