function triangulation_plot ( input_node_filename, ... input_triangulation_filename, node_show, triangle_show ) %% TRIANGULATION_PLOT plots a triangulated set of nodes. % % Discussion: % % All arguments may be given on the command line. Arguments may be omitted, % from right to left, in which case the program will prompt for the values. % % Modified: % % 13 May 2005 % % Author: % % John Burkardt % % Usage: % % triangulation_plot node_file tri_file triangle_show node_show % % Parameters: % % Input, character INPUT_NODE_FILENAME, the name of the node file. % % Input, character INPUT_TRIANGULATION_FILENAME, the name of % the triangulation file. % % Input, integer NODE_SHOW, controls node visibility: % 0, do not show nodes. % 1, show nodes. % 2, show and label nodes. % % Input, integer TRIANGLE_SHOW, controls triangle visibility: % 0, do not show triangles. % 1, show triangles. % 2, show and label triangles. % fprintf ( 1, '\n' ); timestamp; fprintf ( 1, '\n' ); fprintf ( 1, 'TRIANGULATION_PLOT\n' ); fprintf ( 1, ' MATLAB version\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' Read a node dataset of NODE_NUM points in 2 dimensions.\n' ); fprintf ( 1, ' Read an associated triangulation dataset of TRI_NUM\n' ); fprintf ( 1, ' triangles using 3 or 6 nodes.\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' Make an EPS plot of the triangulated data.\n' ); % % First argument is the node file. % if ( nargin < 1 ) fprintf ( 1, '\n' ); fprintf ( 1, 'TRIANGULATION_PLOT:\n' ); input_node_filename = input ( ' Enter the name of the node file.' ); end % % Second argument is the triangulation file. % if ( nargin < 2 ) fprintf ( 1, '\n' ); fprintf ( 1, 'TRIANGULATION_PLOT:\n' ); input_triangulation_filename = input ( ... ' Enter the name of the triangulation file.' ); end % % Third argument is node visibility. % if ( nargin < 3 ) fprintf ( 1, '\n' ); fprintf ( 1, ' Options for node visibility:\n' ); fprintf ( 1, ' 0: do not show the nodes;\n' ); fprintf ( 1, ' 1: show the nodes;\n' ); fprintf ( 1, ' 2: show the nodes, and label them.\n' ); node_show = input ( ' Enter the node visibility option:' ); end % % Fourth argument is triangle visibility. % if ( nargin < 4 ) fprintf ( 1, '\n' ); fprintf ( 1, ' Options for triangle visibility:\n' ); fprintf ( 1, ' 0: do not show the triangles;\n' ); fprintf ( 1, ' 1: show the triangles;\n' ); fprintf ( 1, ' 2: show the triangles, and label them.\n' ); triangle_show = input ( ' Enter the triangle visibility option:' ); end % % Create the output file name from the triangulation filename. % output_filename = file_name_ext_swap ( input_triangulation_filename, 'eps' ); [ dim_num, node_num ] = dtable_header_read ( input_node_filename ); fprintf ( 1, '\n' ); fprintf ( 1, ' Read the header of "%s".\n', input_node_filename ); fprintf ( 1, '\n' ); fprintf ( 1, ' Spatial dimension DIM_NUM = %d\n', dim_num ); fprintf ( 1, ' Number of nodes NODE_NUM = %d\n', node_num ); node_xy = dtable_data_read ( input_node_filename, dim_num, node_num ); fprintf ( 1, '\n' ); fprintf ( 1, ' Read the data in "%s".\n', input_node_filename ); r8mat_print_some ( dim_num, node_num, node_xy, 1, 1, 5, 5, ... ' 5 by 5 portion of data read from file:' ); % % Read the triangulation data. % [ tri_order, tri_num ] = itable_header_read ( input_triangulation_filename ); fprintf ( 1, '\n' ); fprintf ( 1, ' Read the header of "%d".\n', input_triangulation_filename ); fprintf ( 1, '\n' ); fprintf ( 1, ' Triangle order TRI_ORDER = %d\n', tri_order ); fprintf ( 1, ' Number of triangles TRI_NUM = %d\n', tri_num ); triangle_node = itable_data_read ( input_triangulation_filename, ... tri_order, tri_num ); fprintf ( 1, '\n' ); fprintf ( 1, ' Read the data in "%s".\n', input_triangulation_filename ); i4mat_print_some ( tri_order, tri_num, triangle_node, 1, 1, 5, 5, ... ' 5 by 5 portion of data read from file:' ); % % Create the output file. % if ( tri_order == 3 ) triangulation_order3_plot ( output_filename, node_num, node_xy, ... tri_num, triangle_node, node_show, triangle_show ); elseif ( tri_order == 6 ) triangulation_order6_plot ( output_filename, node_num, node_xy, ... tri_num, triangle_node, node_show, triangle_show ); end fprintf ( 1, '\n' ); fprintf ( 1, ' Created the EPS file "%s".\n', output_filename ); fprintf ( 1, '\n' ); fprintf ( 1, 'TRIANGULATION_PLOT\n' ); fprintf ( 1, ' Normal end of execution.\n' ); fprintf ( 1, '\n' ); timestamp;