From b8a31a1dfc30d67e7f87b34ebceab5123f94d80f Mon Sep 17 00:00:00 2001 From: Andreas Husch Date: Thu, 3 Aug 2017 14:06:08 +0200 Subject: [PATCH] Fix surfaces with single color for all faces/vertices Fix surfaces with single color for all faces/vertices that still have an indexed color set that is not used by Matlab due to specified single solid color. (Example: create streamtube, apply color to streamtube, matlab plots stream tube (correctly) in the set color but fig2idtf generates an index color stream tube cycling through the complete colormap without this fix) --- fig2idtf/preprocess/u3d_pre_surface.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fig2idtf/preprocess/u3d_pre_surface.m b/fig2idtf/preprocess/u3d_pre_surface.m index 9dc5fc9..cbc6246 100644 --- a/fig2idtf/preprocess/u3d_pre_surface.m +++ b/fig2idtf/preprocess/u3d_pre_surface.m @@ -168,6 +168,14 @@ ax = get(h, 'Parent'); realcolor = scaled_ind2rgb(cdata, ax); +%% single rgb-color triplet set (to be applied for the complete surface) HA +if(length(facecolor) == 3) + realcolor = zeros(size(cdata,1),size(cdata,2),3); + realcolor(:,:,1) = facecolor(1); + realcolor(:,:,2) = facecolor(2); + realcolor(:,:,3) = facecolor(3); +end + function [realcolor] = scaled_ind2rgb(cdata, ax) [n, m] = size(cdata); cdata = double(cdata);