If I plot two overlaid patches in 2D with the same color, the overlapping section is twice as dark:
figure(1), clf, hold on, box on
patch([0 0 1 1],[0 1 1 0],'b','facealpha',0.5)
patch([0 0 1 1]+0.5,[0 1 1 0]+0.5,'b','facealpha',0.5)
xlim([-1 2])
ylim([-1 2])
In contrast, if I plot two overlaid patches in 3D, the overlapping section is no darker. The following code creates a cone with a base using the patch command:
Res = 50;
% Define the angles that will create the cylinder in polar coordinates
theta = linspace(0,2*pi,Res);
% Define the radius of the cylinder
r = 1;
% Create the end of the cylinders
h = 3;
x_end = r.*cos(theta);
y_end = r.*sin(theta);
z_end = 0.*x_end-h/2;
figure(1), clf; hold on, grid on
% axis vis3d
FA = 0.3;
% Plot the cone
P = patch(x_end,y_end,z_end,'b'); set(P,'edgecolor','k','facealpha',FA) % The cone base
for f = 1:Res-1
P = patch([0 x_end([f+1 f])],[0 y_end([f+1 f])],[h/2 -h/2 -h/2],'b');
set(P,'edgecolor',0.3.*ones(1,3),'facealpha',FA)
end
xlabel('X')
ylabel('Y')
zlabel('Z')
w = 1;
xlim([-w w])
ylim([-w w])
zlim([-2 2])
% axis off
view([-37.5 30])
What am I missing? Thanks!

1 Comment

I find figure to be normal.....which region you are talking about?

Sign in to comment.

 Accepted Answer

Michael Bode
Michael Bode on 30 Jul 2018
From this perspective, when we look at the region circled in red, we're looking through two surfaces. I would expect to see the base of the cone in a darker shade than ...
Ohhh. We're always looking through two surfaces. My mistake!

More Answers (0)

Community Treasure Hunt

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

Start Hunting!