function stla_display ( input_stla_filename ) %% STLA_DISPLAY displays the faces of a shape defined by an ASCII STL file. % % Usage: % % stla_display ( 'file.stla' ) % % Modified: % % 15 February 2007 % % Author: % % John Burkardt % timestamp ( ); fprintf ( 1, '\n' ); fprintf ( 1, 'STLA_DISPLAY\n' ); fprintf ( 1, ' MATLAB version\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' Reads an object in an ASCII STL file.\n' ); fprintf ( 1, ' Display it as a MATLAB shape.\n' ); % % If at least one command line argument, it's the input file name. % if ( nargin < 1 ) fprintf ( 1, '\n' ); fprintf ( 1, 'STLA_DISPLAY:\n' ); input_stla_filename = input ( 'Enter the name of the input file:' ); end % % Get sizes. % [ solid_num, node_num, face_num, text_num ] = stla_size ( ... input_stla_filename ); % % Print the sizes. % stla_size_print ( input_stla_filename, solid_num, node_num, face_num, ... text_num ); % % Get the data. % [ node_xyz, face_node, face_normal, ierror ] = stla_read ( ... input_stla_filename, node_num, face_num ); if ( ierror ~= 0 ) fprintf ( 1, '\n' ); fprintf ( 1, 'STLA_DISPLAY - Fatal error!\n' ); fprintf ( 1, ' STLA_READ returned IERROR = %d\n', ierror ); return end % % Display the shape. % h3 = trisurf ( face_node', node_xyz(1,:), node_xyz(2,:), node_xyz(3,:), ... 'FaceColor', 'Interp' ); axis equal; xlabel ( '--X axis--' ) ylabel ( '--Y axis--' ) zlabel ( '--Z axis--' ) % % The TITLE function will interpret underscores in the title. % We need to unescape such escape sequences! % title_string = s_escape_tex ( input_stla_filename ); title ( title_string ) fprintf ( 1, '\n' ); fprintf ( 1, 'STLA_DISPLAY:\n' ); fprintf ( 1, ' Normal end of execution.\n' ); fprintf ( 1, '\n' ); timestamp ( );