% Script/Function Filename:
%     plotEllipsoidGUI.m
% Purpose:
%     Enter the purpose of the function/file here
%     
% Record of modifications:
%     Programmer(s): {Your Name}
%     Date Due: YYYY-MM-DD
%     Date Submitted: YYYY-MM-DD
%     References: ????
%     Help Received: ????
%     
% Variables Used:
%     Enter the other variables that you use here}

figure;
set( 1 , 'NumberTitle' , 'off' );
a = rand() * 100;
b = rand() * 100;
c = rand() * 100;
aSlider = uicontrol( 'style' , 'slider' , 'units' , 'normalized' , ...
    'position' , [ 0 0.10 1 0.05 ] , 'min' , 0 , ...
    'max' , 100 , 'value' , a );
bSlider = uicontrol( 'style' , 'slider' , 'units' , 'normalized' , ...
    'position' , [ 0 0.05 1 0.05 ] , 'min' , 0 , ...
    'max' , 100 , 'value' , b );
cSlider = uicontrol( 'style' , 'slider' , 'units' , 'normalized' , ...
    'position' , [ 0 0.00 1 0.05 ] , 'min' , 0 , ...
    'max' , 100 , 'value' , c );
shapeT = uicontrol( 'style' , 'toggle' , 'units' , 'normalized' , ...
    'position' , [ 0 0.15 0.10 0.10 ] , 'min' , 0 , ...
    'max' , 1 , 'value' , 1 , 'string' , 'Ellipsoid' , ...
    'callback' , { @shapeToggle } );
infoT = uicontrol( 'style' , 'toggle' , 'units' , 'normalized' , ...
    'position' , [ 0 0.25 0.10 0.10 ] , 'min' , 0 , ...
    'max' , 1 , 'value' , 1 , 'string' , 'Volume/Area' , ...
    'callback' , { @infoToggle } );
addlistener( aSlider , 'ContinuousValueChange' , @updateA );
addlistener( bSlider , 'ContinuousValueChange' , @updateB );
addlistener( cSlider , 'ContinuousValueChange' , @updateC );

[ X , Y , Z ] = ellipsoid( 0 , 0 , 0 , a , b , c , 100 );
surf( X , Y , Z , 'EdgeColor' , [ 0 0 0 ] , 'FaceColor' , [ 0 0 1 ] );
ourAxes = gca;
set( ourAxes , 'XLim' , [ -100 100 ] );
set( ourAxes , 'ZLim' , [ -100 100 ] );
set( ourAxes , 'YLim' , [ -100 100 ] );
set( ourAxes , 'XLimMode' , 'Manual' );
set( ourAxes , 'YLimMode' , 'Manual' );
set( ourAxes , 'ZLimMode' , 'Manual' );
set( ourAxes , 'NextPlot' , 'ReplaceChildren' );
set( 1 , 'UserData' , { aSlider , bSlider , cSlider , ourAxes , shapeT , infoT } );
[ volume , surfaceArea ] = ellipsoidInfo( a , b , c );
set( 1 , 'NumberTitle' , 'off' );
set( 1 , 'Name' , sprintf( ...
    'a: %.2f b: %.2f c: %.2f Volume: %.2f Area: %.2f' , ...
    a , b , c , volume , surfaceArea ) );
axis square