Embossed Ribbon Edge Color MATLAB

In a streamribbon graphic, how do you draw the edges of the tape itself, as opposed to the edges of each face?

For instance:

figure
load wind
[sx sy sz] = meshgrid(80,20:10:50,0:5:15);
h = streamribbon(x,y,z,u,v,w,sx,sy,sz);
axis tight
shading interp;
view(3);
camlight
lighting gouraud

It produces: Raw output

If I add set(h,'edgecolor','k')

I get: Output with edge turned to 'k'

While what I'm looking for is something like this (the top and left sides of the image were edited with gimp to understand what I'm chasing): Edited with gimp

+4
source share
1 answer

As stated in the commentary, there is no easy way to illuminate some edges of the tape surfaces, not others.

, , ( ), . , .

, handles , , , plot3. , :

, , ( h), :

hs = StreamEdges( h , 'k','Linewidth',1 ) ;

:
streamborder

, :

set(hs,'LineWidth',1,'Color','c')
%// or
set(hs,'LineWidth',2,'Color','r','Marker','none')

other edges


StreamEdges.m:

function hs = StreamEdges(hribbon,varargin)

wasOnHold = ishold ;            %// save hold state
hold on

hs = zeros( size(hribbon) ) ;   %// initialize output handle array
for ih=1:numel( hribbon ) ;
    %// retrieve X, Y, and Z data of each surface
    hsurf = handle( hribbon(ih)) ;  %// for pre-HG2 (2014a) versions
    xx = hsurf.XData ;
    yy = hsurf.YData ;
    zz = hsurf.ZData ;

    %// reoder coordinates to linearise surface profile (edge)
    xx = [xx(:,1) ; flipud(xx(:,2)) ; xx(1)] ;
    yy = [yy(:,1) ; flipud(yy(:,2)) ; yy(1)] ;
    zz = [zz(:,1) ; flipud(zz(:,2)) ; zz(1)] ;

    %// return double to stay compatible with pre-HG2
    hs(ih) = double( plot3(xx(:),yy(:),zz(:), varargin{:} ) ) ;
end

if ~wasOnHold ; hold off ; end      %// restore hold state
hs = handle(hs) ;                   %// convert "double" handle back to HG2 handles

pre-HG2 (= pre 2014b) post-HG2. , , HG2 (= , double). pre-HG2. , (, , hs = double(hs))


axes

hold, , axes (gca) , .
, axes , :

hs = StreamEdges( h , 'Parent','target_axes_handle' , 'Color','k','Linewidth',1) ;
+2

All Articles