Iso-surface with two plots only plots in one color

조회 수: 1 (최근 30일)
Nathaniel Werner
Nathaniel Werner 2016년 8월 12일
편집: Geoff Hayes 2016년 8월 13일
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.
%

답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by