 function show_truss(nodes,links)
% Three-dimensional plot of a triangular truss array
%
% plot the nodal points
%
plot3(0,0,0); hold on
for jj=1:size(nodes,2)
    plot3(nodes(jj).x(1),nodes(jj).x(2),nodes(jj).x(3),...
          'o','MarkerFaceColor','r','MarkerEdgeColor','k','MarkerSize',12)
end
%
% Now draw the links
%
for kk=1:size(links,2)
    n_i = nodes(links(kk).nodes(1)).x; 
    n_j = nodes(links(kk).nodes(2)).x;
    c_str = set_color(links(kk).prop);
    plot3([n_i(1) n_j(1)],...
          [n_i(2) n_j(2)],...
          [n_i(3) n_j(3)],...
           c_str,'LineWidth',3)
end
%
axis('equal'); grid on
%
% internal subfunctions
function c_str = set_color(link_type)
%
switch link_type
    case 'b' % batten
        c_str = '-g';
    case 'l' % longeron
        c_str = '-k';
    case 'd' % diagonal
        c_str = '-m';
    otherwise
        disp(['unknown link type ',link_typ])
end