% Function to allow user input of object vertex and edge arrays.

%

% USAGE:  [vert, edge, nvert, nedge] = objdef

%

%      vert = object vertex array  [4 x nvert]

%      edge = object edge connectivity [nedge x 2]

%     nvert = number of vertices

%     nedge = number of edges

%

% The (x,y,z) coordinates of vertices are stored in columns of the

% vertex array.  The last row is filled with 1's.

% Pairs of vertices forming edges are stored as rows of the edge

% array.

%

% Once created, the transformations may be applied to the object

% vertex array.  The edge array is used with function objplot

% to view the 3D wireframe of the defined edges.

%

% See also:  objplot, objlib



function [vert, edge, nvert, nedge] = objdef



nvert = input('Enter number of vertices : ')

nedge = input('Enter number of edges    : ')



vert = ones(4, nvert);

edge = ones(nedge, 2);



for i=1:nvert

  fprintf('\nVertex %3.0f -',i)

  p = input('  Enter coordinate vector [x, y, z] :');

  vert(1:3,i) = p';

end



% for debugging:

%fprintf('Vertex array is : \n')

%vert



for i=1:nedge

  fprintf('\nEdge %3.0f -',i)

  p = input('  Enter vertex numbers [v1, v2] :');

  edge(i,:) = p;

end



% For debugging:

%fprintf('Edge array is : \n')

%edge



end



