# multiple 3D plane plotting

16 visualizaciones (últimos 30 días)
BeeTiaw el 1 de Abr. de 2024
Editada: Catalytic el 1 de Abr. de 2024
Hi I have the following code to plot a 2D plane in 3D space.
the plane is describe by their dip angle and azimuth and the center point is at [x,y] = [0,0]
I intend to modify this code so that it can plot 3 planes in the same axis. However, the location for each plane will be varies depending on the x and y location.
planedip = 30;
planeazim = 120;
% Define normal vector of plane
% Define two vectors in plane
v1 = [1, 0, (-normal(1)/normal(3))];
v2 = cross(normal, v1);
% Plot plane
x = linspace(-1,1,10);
y = linspace(-1,1,10);
[X,Y] = meshgrid(x,y);
Z = (-normal(1)*X - normal(2)*Y)/normal(3);
surf(X,Y,Z,'FaceColor',[0.5,0.5,0.5],'FaceAlpha',0.5,'EdgeColor','none');
hold on
quiver3(0, 0, 0, normal(1), normal(2), normal(3));
projection = [normal(1), normal(2), 0];
quiver3(0, 0, 0, projection(1), projection(2), projection(3));
plot3([normal(1), projection(1)], [normal(2), projection(2)], [normal(3), projection(3)], '--k');
view(45,30);
axis equal
xlabel('x');
ylabel('y');
zlabel('z');
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Matt J el 1 de Abr. de 2024
Editada: Matt J el 1 de Abr. de 2024
planedip = 30;
planeazim = 120;
% Define normal vector of plane
ezplane([normal,0],'FaceColor','r'); grid on; hold on
ezplane([normal,+1],'FaceColor','g');
ezplane([normal,-1],'FaceColor','b'); hold off; axis auto; view(35,10)
##### 8 comentariosMostrar 6 comentarios más antiguosOcultar 6 comentarios más antiguos
BeeTiaw el 1 de Abr. de 2024
Hi, thanks! this is not what I am looking for based on the original code.
In the original code, the location Z is determined from the following lines in the code:
% Plot plane
x = linspace(-1,1,10);
y = linspace(-1,1,10);
[X,Y] = meshgrid(x,y);
Z = (-normal(1)*X - normal(2)*Y)/normal(3);
surf(X,Y,Z,'FaceColor',[0.5,0.5,0.5],'FaceAlpha',0.5,'EdgeColor','none');
whereas now, I want Z to be fix at 0.
Matt J el 1 de Abr. de 2024
Editada: Matt J el 1 de Abr. de 2024
You cannot have Z=0 everywhere and also have the plane oriented according to freely chosen planedip and planeazim. Those things contradict each other. If Z=0 everywhere, then the plane normal must be [0,0,1].

Iniciar sesión para comentar.

### Más respuestas (1)

Catalytic el 1 de Abr. de 2024
Editada: Catalytic el 1 de Abr. de 2024
planedip = [30, 60 90]';
planeazim = [120, 90, 270]';
center=[2,3,0;
6,8,0;
10 15,0];
% Define normal vector of plane
box=[-1 -1; -1 +1; +1 +1; +1 -1];
colors=["m","b","g"];
for i=1:numel(planedip)
P=box*null(Normals(i,:))' + center(i,:);
patch(P(:,1), P(:,2), P(:,3),colors(i));
end; hold off
axis auto; view(-65,40); grid on; axis equal
xlabel X; ylabel Y; zlabel Z;
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre Graphics Object Properties 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!

Translated by