function varargout = workspaceSTEWSIM(varargin)
% WORKSPACESTEWSIM MATLAB code for workspaceSTEWSIM.fig
%      WORKSPACESTEWSIM, by itself, creates a new WORKSPACESTEWSIM or raises the existing
%      singleton*.
%
%      H = WORKSPACESTEWSIM returns the handle to a new WORKSPACESTEWSIM or the handle to
%      the existing singleton*.
%
%      WORKSPACESTEWSIM('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in WORKSPACESTEWSIM.M with the given input arguments.
%
%      WORKSPACESTEWSIM('Property','Value',...) creates a new WORKSPACESTEWSIM or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before workspaceSTEWSIM_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to workspaceSTEWSIM_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help workspaceSTEWSIM

% Last Modified by GUIDE v2.5 20-Apr-2011 06:36:27

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @workspaceSTEWSIM_OpeningFcn, ...
                   'gui_OutputFcn',  @workspaceSTEWSIM_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before workspaceSTEWSIM is made visible.
function workspaceSTEWSIM_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to workspaceSTEWSIM (see VARARGIN)

% Choose default command line output for workspaceSTEWSIM
handles.output = hObject;

setappdata(0, 'hWorkspace' , gcf );

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes workspaceSTEWSIM wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = workspaceSTEWSIM_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;



function edit7_Callback(hObject, eventdata, handles)
% hObject    handle to edit7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit7 as text
%        str2double(get(hObject,'String')) returns contents of edit7 as a double


% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit8_Callback(hObject, eventdata, handles)
% hObject    handle to edit8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit8 as text
%        str2double(get(hObject,'String')) returns contents of edit8 as a double


% --- Executes during object creation, after setting all properties.
function edit8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit9_Callback(hObject, eventdata, handles)
% hObject    handle to edit9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit9 as text
%        str2double(get(hObject,'String')) returns contents of edit9 as a double


% --- Executes during object creation, after setting all properties.
function edit9_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit10_Callback(hObject, eventdata, handles)
% hObject    handle to edit10 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit10 as text
%        str2double(get(hObject,'String')) returns contents of edit10 as a double


% --- Executes during object creation, after setting all properties.
function edit10_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit10 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in checkbox1.
function checkbox1_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox1


% --- Executes on button press in checkbox2.
function checkbox2_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox2


% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)



function PxFrom_Callback(hObject, eventdata, handles)
% hObject    handle to PxFrom (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of PxFrom as text
%        str2double(get(hObject,'String')) returns contents of PxFrom as a double


% --- Executes during object creation, after setting all properties.
function PxFrom_CreateFcn(hObject, eventdata, handles)
% hObject    handle to PxFrom (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function PzFrom_Callback(hObject, eventdata, handles)
% hObject    handle to PzFrom (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of PzFrom as text
%        str2double(get(hObject,'String')) returns contents of PzFrom as a double


% --- Executes during object creation, after setting all properties.
function PzFrom_CreateFcn(hObject, eventdata, handles)
% hObject    handle to PzFrom (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes during object creation, after setting all properties.
function alphaFrom_CreateFcn(hObject, eventdata, handles)
% hObject    handle to alphaFrom (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function betaFrom_Callback(hObject, eventdata, handles)
% hObject    handle to betaFrom (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of betaFrom as text
%        str2double(get(hObject,'String')) returns contents of betaFrom as a double


% --- Executes during object creation, after setting all properties.
function betaFrom_CreateFcn(hObject, eventdata, handles)
% hObject    handle to betaFrom (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function gammaFrom_Callback(hObject, eventdata, handles)
% hObject    handle to gammaFrom (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of gammaFrom as text
%        str2double(get(hObject,'String')) returns contents of gammaFrom as a double


% --- Executes during object creation, after setting all properties.
function gammaFrom_CreateFcn(hObject, eventdata, handles)
% hObject    handle to gammaFrom (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)



function PyFrom_Callback(hObject, eventdata, handles)
% hObject    handle to PyFrom (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of PyFrom as text
%        str2double(get(hObject,'String')) returns contents of PyFrom as a double


% --- Executes during object creation, after setting all properties.
function PyFrom_CreateFcn(hObject, eventdata, handles)
% hObject    handle to PyFrom (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in OK.
function OK_Callback(hObject, eventdata, handles)
% hObject    handle to OK (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
Base = getappdata( 0 , 'Base' );
Platform = getappdata( 0 , 'Platform' );
ConMatrix = getappdata( 0 , 'ConMatrix' );
LegLimits = getappdata( 0 , 'LegLimits' );
JointLimits = getappdata( 0 , 'JointLimits' );
Thickness_Base = getappdata( 0 , 'Thickness_Base' );
Thickness_Moving = getappdata( 0 , 'Thickness_Moving' );

if ( isempty(Base) == 1 )
    msgbox( 'Before workspace calculation, you must start Analysis GSP');
    delete(gcf);
    AnalysisGSP;
end    

%store axes handle for ploting workspace because progressbar can alter
%currernt axes
hStewSIM = getappdata(0, 'hStewSIM' );
setappdata( 0, 'hAxesWorkspace',  gca );

grid on;rotate3d on;zlabel('Z');ylabel('Y');xlabel('X');

px_start = str2num( get(handles.PxFrom, 'String' ));   px_end = str2num( get(handles.PxTo, 'String' ));
py_start = str2num( get(handles.PyFrom, 'String' ));   py_end = str2num( get(handles.PyTo, 'String' ));
pz_start = str2num( get(handles.PzFrom, 'String' ));   pz_end = str2num( get(handles.PzTo, 'String' ));

step_sizeX = str2num ( get(handles.step_sizeX, 'String') ); 
step_sizeY = str2num ( get(handles.step_sizeY, 'String') ); 
step_sizeZ = str2num ( get(handles.step_sizeZ, 'String') ); 

alpha_From  = str2num( get(handles.alphaFrom, 'String' )); 
beta_From  = str2num( get(handles.betaFrom, 'String' ));
gamma_From  = str2num( get(handles.gammaFrom, 'String' )); 

alpha_To = str2num( get(handles.alphaTo, 'String' ));
beta_To  = str2num( get(handles.betaTo, 'String' ));
gamma_To = str2num( get(handles.gammaTo, 'String' ));  

step_sizeALPHA = str2num ( get(handles.step_sizeALPHA, 'String') ); 
step_sizeBETA = str2num ( get(handles.step_sizeBETA, 'String') ); 
step_sizeGAMMA = str2num ( get(handles.step_sizeGAMMA, 'String') ); 

% if angle_sign==8
%                         plot([px],[py], 'Color','k', 'LineWidth',.1,'marker','.',...
%                                'MarkerFaceColor',[color1 color2 color3],'MarkerEdgeColor',[0.271 .34 .45]);          
%                     else
%           
%                         plot([px],[py], 'Color','k', 'LineWidth',.1,'marker','.',...
%                                'MarkerFaceColor',[color1 color2 color3],'MarkerEdgeColor',[color1 color2 color3]);          
%                     end

%return

totalX = ceil ( ( px_end - px_start ) / step_sizeX );
totalY = ceil( ( py_end - py_start ) / step_sizeY ); 
totalZ = ceil( ( pz_end - pz_start ) / step_sizeZ);

UNreachable = zeros(totalX*totalY*totalZ,3); %zeros( ( px_end - px_start ) / step_size  , 3 );
reachable = zeros(totalX*totalY*totalZ,3); %zeros( ( px_end - px_start ) / step_size  , 3 );

iUnreacheable = 1;
ireachable = 1 ;

n = 1000; 

progressbar('Pz Workspace Calculation','Py Workspace Calculation','Px Workspace Calculation') % Create figure and set starting time 

ix=0;iy=0;iz=0;
  
for z=pz_start : step_sizeZ : pz_end
    iz=iz+1;
    progressbar([],0) % reset 2nd bar
    iy=0;
    
    for y=py_start : step_sizeY : py_end
        iy = iy +1;
        progressbar([],[],0) % reset 3rd bar
        ix=0;
        
        for x=px_start : step_sizeX : px_end
            ix=ix+1; 
            Platform.currentPx = x;
            Platform.currentPy = y;
            Platform.currentPz = z;       
        
            T_step =[Platform.currentPx; Platform.currentPy;Platform.currentPz; ];
            Translation = T_step;
           
            %Fix orientation
            alpha = degtorad( alpha_From );  
            beta  = degtorad( beta_From ); 
            gamma = degtorad( gamma_From );             
          
            
            Rotation =[ cos(alpha)*cos(beta) , cos(alpha)*sin(beta)*sin(gamma)-sin(alpha)*cos(gamma)...
     , cos(alpha)*sin(beta)*cos(gamma)+sin(alpha)*sin(gamma) ;
       sin(alpha)*cos(beta) , sin(alpha)*sin(beta)*sin(gamma)+cos(alpha)*cos(gamma) ,  sin(alpha)*sin(beta)*cos(gamma)-cos(alpha)*sin(gamma) ;
       -sin(beta)           ,        cos(beta)*sin(gamma)                         ,  cos(beta)*cos(gamma)     ;
       ];   
            
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %       TERS KINEMATIK
        %  Ustteki harakettli platformun her bir kö?esinin konumu alttaki
        %  koordinat eksenine göre yaz?lmaktad?r. 
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %platform coordinates according to the base coordinate frame   
        %NaN as a number doesnt cause a problem. But NaN as an index is a fatal
        %error.
        for index = 1:1:6

                Platform.PBase(index,:) = ...
                    Rotation * Platform.PTable(index,:)' + Translation;
        end

        %yap? sorunlumu diye kontrol etmek için
        yapi_sorunlumu = false;
        %hangi bacaklarda sorun oldu?unu tutan sat?r vektörü, (index) eri?imi için
        %sat?r vektörü olarak seçilmi?tir.
        yapi_sorunlari = ones(6,1)*NaN;
        
        Leg.L = ones(6,1);

        for index = 1:1:6
            if ~isnan(ConMatrix(1,index)) && ~isnan(ConMatrix(2,index))  
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                   
        %Leg length        
                Leg.L(index) = norm ( Platform.PBase(ConMatrix(2,index),:)...
                                            - Base.BTable(ConMatrix(1,index),:) );
    
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%        
        %   BACAK limit kontrollerinin yapılması
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%        
            if Leg.L(index) >= LegLimits(index,2)
                yapi_sorunlumu = true;
                yapi_sorunlari(index) = index;
                
                

                %yapi sorunlu oldu?unda bacaklar için birim vektörler hesaplanmal?d?r.
                %Lvektor = Platform.PBase(ConMatrix(2,index),:) - Base.B(ConMatrix(1,index),:);     
                %unit_Lvektor =  Lvektor / norm( Lvektor );

                %birim vektör ile LMAX çarp?l?nca baca??n olabilecek en büyük
                %de?eri vektörel olarak hesaplanm?? olacakt?r.
                %Lvektor = unit_Lvektor * Leg.LMax+Base.B(ConMatrix(1,index),:);

                %set ( Leg.Leg_handle(index) , ...
                %    'XData',[Base.B(ConMatrix(1,index),1); Lvektor( 1 ) ],...
                %    'YData',[Base.B(ConMatrix(1,index),2); Lvektor( 2 ) ],...
                %    'ZData',[Base.B(ConMatrix(1,index),3); Lvektor( 3 ) ] );

            elseif Leg.L(index)<= LegLimits(index,1)
                yapi_sorunlumu = true;
                yapi_sorunlari(index) = index;

                %ulaşılamayan noktalara arasına x,y,z değerlerini ekle.
                %yönelimde ilave edilebilir.    
                
                %UNreachable = [ UNreachable ; x , y , z ];

                %yapi sorunlu oldu?unda bacaklar için birim vektörler hesaplanmal?d?r.
                %Lvektor = Platform.PBase(ConMatrix(2,index),:) - Base.B(ConMatrix(1,index),:);     
                %unit_Lvektor =  Lvektor / norm( Lvektor );

                %birim vektör ile LMAX çarp?l?nca baca??n olabilecek en büyük
                %de?eri vektörel olarak hesaplanm?? olacakt?r.
                %Lvektor = unit_Lvektor * Leg.LMin+Base.B(ConMatrix(1,index),:);

                %set ( Leg.Leg_handle(index) , ...
                %    'XData',[Base.B(ConMatrix(1,index),1); Lvektor( 1 ) ],...
                %    'YData',[Base.B(ConMatrix(1,index),2); Lvektor( 2 ) ],...
                %    'ZData',[Base.B(ConMatrix(1,index),3); Lvektor( 3 ) ] );

       
            end
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                       
        %set editbox with Leg lengths
                %eval( sprintf( 'set(textL%d, ''String'', %f)',index, Leg.L(index) ) );

            end
        end
        
        if ( yapi_sorunlumu == true ) 
            %ulaşılamayan noktalara arasına x,y,z değerlerini ekle.
                %yönelimde ilave edilebilir. 
                UNreachable(iUnreacheable,:) = [ x , y , z ];
                iUnreacheable = iUnreacheable + 1 ;
        else
             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                   
        % Erişilebilir Çalışma Uzayına eklenebilir
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                           
                %x y z değerleri erişilebilir çalışma uzayına eklenir.
                reachable( ireachable, : ) = [ x , y , z ];
                ireachable = ireachable + 1 ;
        end
                
           progressbar([],[],ix/totalX) % update 3rd bar
        end %z
       progressbar([],iy/totalY) % update 2nd bar         
    end%y
    progressbar(iz/totalZ) % update 1st bar
end%x

progressbar(1);
disp('WorkspaceSTEWSIM içinde hesaplama tamamlandı....');
%UNreachable
%plot3(UNreachable(:,1),UNreachable(:,2),UNreachable(:,3));
reachable;
%plot3(reachable(:,1),reachable(:,2),reachable(:,3));
hAxesWorkspace = getappdata(0, 'hAxesWorkspace');
axes( hAxesWorkspace );

grid on;rotate3d on;zlabel('Z');ylabel('Y');xlabel('X');
scatter3( reachable(1:ireachable,1) , reachable(1:ireachable,2),reachable(1:ireachable,3) );



function step_sizeX_Callback(hObject, eventdata, handles)
% hObject    handle to step_sizeX (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of step_sizeX as text
%        str2double(get(hObject,'String')) returns contents of step_sizeX as a double


% --- Executes during object creation, after setting all properties.
function step_sizeX_CreateFcn(hObject, eventdata, handles)
% hObject    handle to step_sizeX (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function step_sizeY_Callback(hObject, eventdata, handles)
% hObject    handle to step_sizeY (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of step_sizeY as text
%        str2double(get(hObject,'String')) returns contents of step_sizeY as a double


% --- Executes during object creation, after setting all properties.
function step_sizeY_CreateFcn(hObject, eventdata, handles)
% hObject    handle to step_sizeY (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function step_sizeZ_Callback(hObject, eventdata, handles)
% hObject    handle to step_sizeZ (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of step_sizeZ as text
%        str2double(get(hObject,'String')) returns contents of step_sizeZ as a double


% --- Executes during object creation, after setting all properties.
function step_sizeZ_CreateFcn(hObject, eventdata, handles)
% hObject    handle to step_sizeZ (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function step_sizeALPHA_Callback(hObject, eventdata, handles)
% hObject    handle to step_sizeALPHA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of step_sizeALPHA as text
%        str2double(get(hObject,'String')) returns contents of step_sizeALPHA as a double


% --- Executes during object creation, after setting all properties.
function step_sizeALPHA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to step_sizeALPHA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function step_sizeBETA_Callback(hObject, eventdata, handles)
% hObject    handle to step_sizeBETA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of step_sizeBETA as text
%        str2double(get(hObject,'String')) returns contents of step_sizeBETA as a double


% --- Executes during object creation, after setting all properties.
function step_sizeBETA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to step_sizeBETA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function step_sizeGAMMA_Callback(hObject, eventdata, handles)
% hObject    handle to step_sizeGAMMA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of step_sizeGAMMA as text
%        str2double(get(hObject,'String')) returns contents of step_sizeGAMMA as a double


% --- Executes during object creation, after setting all properties.
function step_sizeGAMMA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to step_sizeGAMMA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function PxTo_Callback(hObject, eventdata, handles)
% hObject    handle to PxTo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of PxTo as text
%        str2double(get(hObject,'String')) returns contents of PxTo as a double



function PyTo_Callback(hObject, eventdata, handles)
% hObject    handle to PyTo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of PyTo as text
%        str2double(get(hObject,'String')) returns contents of PyTo as a double



function PzTo_Callback(hObject, eventdata, handles)
% hObject    handle to PzTo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of PzTo as text
%        str2double(get(hObject,'String')) returns contents of PzTo as a double



function alphaTo_Callback(hObject, eventdata, handles)
% hObject    handle to alphaTo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of alphaTo as text
%        str2double(get(hObject,'String')) returns contents of alphaTo as a double



function betaTo_Callback(hObject, eventdata, handles)
% hObject    handle to betaTo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of betaTo as text
%        str2double(get(hObject,'String')) returns contents of betaTo as a double



function gammaTo_Callback(hObject, eventdata, handles)
% hObject    handle to gammaTo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of gammaTo as text
%        str2double(get(hObject,'String')) returns contents of gammaTo as a double


% --- Executes during object creation, after setting all properties.
function hAxesWorkspace_CreateFcn(hObject, eventdata, handles)
% hObject    handle to hAxesWorkspace (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: place code in OpeningFcn to populate hAxesWorkspace
setappdata(0, 'axesW', hObject );
