Minimum viable example:
% Define a simple 6 sided cube with dimensions 0-1 in X, Y, and Z
vertices = [0,0,1; % 1 Front-Top-Left (FTL)
1,0,1; % 2 Front-Top-Right (FTR)
1,0,0; % 3 Front-Bottom-Right (FBoR)
0,0,0; % 4 Front-Bottom-Left (FBoL)
0,1,1; % 5 Back-Top-Left (BaTL)
1,1,1; % 6 Back-Top-Right (BaTR)
1,1,0; % 7 Back-Bottom-Right (BaBoR)
0,1,0]; % 8 Back-Bottom-Left (BaBoL)
faces = [1,2,3,4; % 1 Front
2,6,7,3; % 2 Right
6,5,8,7; % 3 Back
5,1,4,8; % 4 Left
1,5,6,2; % 5 Top
4,3,7,8]; % 6 Bottom
temps = [5;10;15;20;25;30]; % One temperature per face
% Plot the cube
fig1 = figure;
ax1 = axes(fig1);
patch('Faces',faces,'Vertices',vertices,'FaceColor','flat','EdgeColor','none','FaceVertexCData',temps,'Parent',ax1);
% Rotate to an isometric type of view angle
ax1.View = [-42.5 28];
% Turn off axes
ax1.XAxis.Visible = 'off';
ax1.YAxis.Visible = 'off';
ax1.ZAxis.Visible = 'off';
% Set data aspect ratio to 1 1 1
daspect(ax1,[1 1 1]);
I then need code that will produce a matrix that looks something like this (for the above code):
% -------------------------------------------------------------------------
% Code goes here that should produce a 2D matrix that looks something like:
% (15x15 as example, but would need to be more like 1024x1024 up to
% 4096x4096 in real world use cases)
% 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
% 1 % 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
% 2 % 00 00 00 00 00 00 25 00 00 00 00 00 00 00 00
% 3 % 00 00 00 00 00 25 25 25 00 00 00 00 00 00 00
% 4 % 00 00 00 00 25 25 25 25 25 00 00 00 00 00 00
% 5 % 00 00 00 25 25 25 25 25 25 25 00 00 00 00 00
% 6 % 00 00 20 25 25 25 25 25 25 10 00 00 00 00 00
% 7 % 00 00 20 20 20 25 25 25 10 10 00 00 00 00 00
% 8 % 00 00 20 20 20 20 25 10 10 10 00 00 00 00 00
% 9 % 00 00 20 20 20 20 20 10 10 10 00 00 00 00 00
% 10 % 00 00 20 20 20 20 20 10 10 10 00 00 00 00 00
% 11 % 00 00 00 20 20 20 20 10 10 00 00 00 00 00 00
% 12 % 00 00 00 00 20 20 20 10 00 00 00 00 00 00 00
% 13 % 00 00 00 00 00 20 20 10 00 00 00 00 00 00 00
% 14 % 00 00 00 00 00 00 20 00 00 00 00 00 00 00 00
% 15 % 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Real world use cases would include projection from multiple different angles onto complex 3D geometries containing in excess of 100k polygons. There will also be cases where part of the geometry overlaps other parts of the geometry, and the solution needs to account for only the visible geometry from the specific look angle and ignore all other facets out of sight behind the ‘closest to the camera’ faces. The current plotting solution plots one patch object per body as children of an hgtransform and there can be hundreds of bodies in a model.
Any help would be appreciated!