function princstruct = CalcPrincipals(fighandle)
% PRINCSTRUCT=CalcPrincipals(FIGHANDLE)
%
% This function accepts the handle FIGHANDLE to the main GUI and returns
% the in-plane principal stresses and strain in the structure PRINCSTRUCT 
% with fields:
%   PRINCSTRUCT.princstress    : principal stress (numels x 2) 
%                               = [1st princ. stress , 2nd princ. stress ]
%   PRINCSTRUCT.princstrain    : principal strain (numels x 2)
%                               = [1st princ. strain , 2nd princ. strain ]
%   PRINCSTRUCT.sigrange    : maximum absolute value of principal stress
%   PRINCSTRUCT.epsrange    : maximum absolute value of principal strain
%
% The field sigeps in the main GUI data structure must already exist (i.e.
% the function CalcStrainStress must have successfully run) before this 
% function will work.

% get data structure
handles=guidata(fighandle);

% unpack necessary variables

% for each element, calculate the eigenvalues and 
% eigenvectors of stress and strain

% find ranges

% save results to the output structure
princstruct = struct();