From: Ross Anderson on 26 Mar 2010 20:54 And what about plotting a surface on top of another surface? Try the following code, then rotate the window. The bar doesn't keep a constant texture for some reason. figure; hold on; %first a background load trees texture=flipUD(X); bounds = [-50 150 -100 100]'; npoints=100; [XX YY] = meshgrid(linspace(bounds(1),bounds(2),npoints),linspace(bounds(3),bounds(4),npoints)); ZZ = zeros(size(XX)); surf(XX,YY,ZZ,texture,'FaceColor','texturemap','EdgeColor','none'); axis tight %now a bar from (0,0) to (0,100) load clown texture = flipUD(X); lines = [0 100 0 0]; radius=9; dy = lines(4)-lines(3); dx = lines(2)-lines(1); angle=atan2(dy,dx); theta = linspace(-pi,pi,100)'; pts = [lines(1) - radius*sin(angle) lines(3) + radius*cos(angle); lines(1) + radius*cos(theta), lines(3) + radius*sin(theta); lines(2) - radius*sin(angle) lines(4) + radius*cos(angle); lines(2) + radius*cos(theta), lines(4) + radius*sin(theta); lines(2) + radius*sin(angle) lines(4) - radius*cos(angle)]; rangeX = linspace(floor(min(pts(:,1))),ceil(max(pts(:,1))),100); rangeY = linspace(floor(min(pts(:,2))),ceil(max(pts(:,2))),100); [XX YY] = meshgrid(rangeX,rangeY); Z = griddata(pts(:,1),pts(:,2),zeros(size(pts,1),1),XX,YY,'linear',{'Qt'}); surf(XX,YY,Z,texture,'FaceColor','texturemap','EdgeColor','none'); |