platonic_solid

Below is a demonstration of the features of the platonic_solid function

clear all; close all; clc;

% Plot settings
fig_color='w'; fig_colordef='white';
fontSize=15;
faceColor='b';
faceAlpha=0.75;
edgeColor='k';
edgeWidth=2;
markerSize=5;
hf=figuremax(fig_color,fig_colordef); % Open figure for plotting
labelCell={'Tetrahedron','Cube','Octahedron','Icosahedron','Dodecahedron'};

%Defining geodesic dome
r=1; %circum-sphere radius
pColors=autumn(5);
for q=1:1:5;

    %Defining the faces (F) and vertices (V) of a platonic solid
    [V,F]=platonic_solid(q,r); %q indicates solid type, r is the radius

    %Plotting the platonic solids
    subplot(2,3,q); hold on;
    title(labelCell{q},'FontSize',fontSize);
    xlabel('X','FontSize',fontSize); ylabel('Y','FontSize',fontSize); zlabel('Z','FontSize',fontSize);
    hp=patch('Faces',F,'Vertices',V);
    set(hp,'FaceColor',pColors(q,:),'FaceAlpha',faceAlpha,'lineWidth',edgeWidth,'edgeColor',edgeColor);

    %Plotting face normals
    [hn]=patchNormPlot(F,V,0.5);

    set(gca,'FontSize',fontSize);
    view(3); axis tight;  axis equal;  axis vis3d; axis off;
    camlight('headlight'); lighting flat;
end

GIBBON

Kevin M. Moerman (kevinmoerman@hotmail.com)