function PLOTTER(Coords,objprop)
for index = 1:length(Coords.Lo.X(:))
plotcube([Coords.dX;Coords.dY;Coords.dZ]'...
,[Coords.Lo.X(index);Coords.Lo.Y(index);Coords.Lo.Z(index)]',...
.5,objprop(index)); hold on;
end
end
function plotcube(varargin)
inArgs = { ...
[10 56 100] , ...
[10 10 10] , ...
.7 , ...
[1 0 0] ...
};
inArgs(1:nargin) = varargin;
[edges,origin,alpha,clr] = deal(inArgs{:});
XYZ = { ...
[0 0 0 0] [0 0 1 1] [0 1 1 0] ; ...
[1 1 1 1] [0 0 1 1] [0 1 1 0] ; ...
[0 1 1 0] [0 0 0 0] [0 0 1 1] ; ...
[0 1 1 0] [1 1 1 1] [0 0 1 1] ; ...
[0 1 1 0] [0 0 1 1] [0 0 0 0] ; ...
[0 1 1 0] [0 0 1 1] [1 1 1 1] ...
};
XYZ = mat2cell(...
cellfun( @(x,y,z) x*y+z , ...
XYZ , ...
repmat(mat2cell(edges,1,[1 1 1]),6,1) , ...
repmat(mat2cell(origin,1,[1 1 1]),6,1) , ...
'UniformOutput',false), ...
6,[1 1 1]);
cellfun(@patch,XYZ{1},XYZ{2},XYZ{3},...
repmat({clr},6,1),...
repmat({'FaceAlpha'},6,1),...
repmat({alpha},6,1)...
);
view(3);
0 Comments
Sign in to comment.