Iso-surface with two plots only plots in one color

1 vue (au cours des 30 derniers jours)
Nathaniel Werner
Nathaniel Werner le 12 Août 2016
Modifié(e) : Geoff Hayes le 13 Août 2016
I have the following function, that I use to plot two iso-surfaces from data collected in CFD. The only problem is that it does not plot both colors, only gray. This works perfectly in newer versions of MatLab so my guess is that that is the main problem.
Here is my function.
function [ p ] = draw_isosurface(xBox,yBox,zBox,component,iso_plus,iso_minus,plus_color,minus_color)
%Draw 2 isosurfaces about the input values in the same figure
% <Input>
% xBox, yBox, zBox: X,Y,Z in 3D
% component: The thing you want to look at
% iso_plus, iso_minus: Positive and Negative value of iso-value.
% plus_color, minus_color: Name of the color or RGB code of isosurfaces
p=patch(isosurface(xBox,yBox,zBox,squeeze(component),iso_plus));
p.FaceColor = plus_color; p.EdgeColor = 'none';
alpha(.5)
camlight
lighting gouraud
hold on
p=patch(isosurface(xBox,yBox,zBox,squeeze(component),iso_minus));
p.FaceColor = minus_color;
p.EdgeColor = 'none';
alpha(.5)
camlight
lighting gouraud
grid on
axis equal
end
I am currently using version 2012a but I'm curious if there is a problem with my function.
%

Réponses (0)

Catégories

En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by