function changenorm_BKP(Empty_Button, AxesAFS,AxesSOL)

data = get(Empty_Button,'UserData');

if (isfield(data,'isafs') == 0) || (data.isafs == 0)

    return
end



V1=data.V_scal;



if data.Borgen==1
    singv = diag(data.Sraw);
    if singv(2)/singv(1)-1 > -1.E-15
        str = ['No change of scaling possible: matrix D^TD reducible.'];
        set(Footnote,'String',str,'ForegroundColor','red');
        
        plot(AxesAFS2,0,0,'w');
        plot(AxesSOL,1,0,'w');
        
        return;
    end
    
    VTV = V1'*data.Vraw;
    
    s1=data.sum_v1;
    s2=data.sum_v2;
    s3=data.sum_v3;
    
    [m,n] = size(data.FP_B);
    for i=1:m
        t(2:3)=data.FP_B(i,1:2);
        t(1)=(1-t(2)*s2-t(3)*s3)/s1;
        s=t*VTV;
        s=s/s(1);
        data.FP_SV(i,1:2)=s(2:3);
    end
    
    [m,n] = size(data.IP_B);
    for i=1:m
        t(2:3)=data.IP_B(i,1:2);
        t(1)=(1-t(2)*s2-t(3)*s3)/s1;
        s=t*VTV;
        s=s/s(1);
        data.IP_SV(i,1:2)=s(2:3);
    end
    
    [m,n] = size(data.Fbnd_B);
    for i=1:m
        t(2:3)=data.Fbnd_B(i,1:2);
        t(1)=(1-t(2)*s2-t(3)*s3)/s1;
        s=t*VTV;
        s=s/s(1);
        data.Fbnd_SV(i,1:2)=s(2:3);
    end
    
    [m,n] = size(data.Tbnd_B);
    for i=1:m
        t(2:3)=data.Tbnd_B(i,1:2);
        t(1)=(1-t(2)*s2-t(3)*s3)/s1;
        s=t*VTV;
        s=s/s(1);
        data.Tbnd_SV(i,1:2)=s(2:3);
    end
    
    for j=1:data.numb_seg
        [m,n] = size(data.segments_B{j});
        for i=1:m
            t(2:3)=data.segments_B{j}(i,1:2);
            t(1)=(1-t(2)*s2-t(3)*s3)/s1;
            s=t*VTV;
            s=s/s(1);
            data.segments_SV{j}(i,1:2)=s(2:3);
        end
    end
else
    [m,n]=size(data.FP_SV);
    [h,n]=size(data.Vraw);
    e=ones(h,1);
    for i=1:m
        t1=[1,data.FP_SV(i,1),data.FP_SV(i,2)];
       
        h=t1*data.Vraw(:,1:3)';
        s=h*e;
 
        t2=h*V1/s;
        data.FP_B(i,1:2)=t2(2:3);
    end
    
    [m,n]=size(data.IP_SV);
    for i=1:m
        t1=[1,data.IP_SV(i,1),data.IP_SV(i,2)];
        h=t1*data.Vraw(:,1:3)';
        s=h*e;
        t2=h*V1/s;
        data.IP_B(i,1:2)=t2(2:3);
    end
    
    [m,n]=size(data.Tbnd_SV);
    for i=1:m
        t1=[1,data.Tbnd_SV(i,1),data.Tbnd_SV(i,2)];
        h=t1*data.Vraw(:,1:3)';
        s=h*e;
        t2=h*V1/s;
        data.Tbnd_B(i,1:2)=t2(2:3);
    end
    
    [m,n]=size(data.Fbnd_SV);
    for i=1:m
        t1=[1,data.Fbnd_SV(i,1),data.Fbnd_SV(i,2)];
       h=t1*data.Vraw(:,1:3)';
        s=h*e;
        t2=h*V1/s;
        data.Fbnd_B(i,1:2)=t2(2:3);
    end
    
    
    for j=1:data.numb_seg
        [m,n]=size(data.segments_SV{j});
        for i=1:m
            t1=[1,data.segments_SV{j}(i,1),data.segments_SV{j}(i,2)];
            h=t1*data.Vraw(:,1:3)';
            s=h*e;
            t2=h*V1/s;
            data.segments_B{j}(i,1:2)=t2(2:3);
        end
    end
end


if data.numb_seg>1
     
            for i=1:data.numb_seg
                    if data.Borgen==1
                        data.mima_SV(i,:) = [min(data.segments_SV{i}(:,1)), max(data.segments_SV{i}(:,1)), min(data.segments_SV{i}(:,2)), max(data.segments_SV{i}(:,2)),...
                        min(min([ones(size(data.segments_SV{i},1),1) data.segments_SV{i}]*data.Vraw(:,1:3)')), max(max([ones(size(data.segments_SV{i},1),1) data.segments_SV{i}]*data.Vraw(:,1:3)'))];
                    else
                        a=zeros(size(data.segments_B{i},1),1);
                        for j=1:size(data.segments_B{i},1);
                            a(j)=(1-data.sum_v2*data.segments_B{i}(j,1)-data.sum_v3*data.segments_B{i}(j,2))/data.sum_v1;
                        end
                        
                        data.mima_B(i,:) = [min(data.segments_B{i}(:,1)), max(data.segments_B{i}(:,1)), min(data.segments_B{i}(:,2)), max(data.segments_B{i}(:,2)),...
                        min(min([a data.segments_B{i}]*data.V_scal(:,1:3)')), max(max([a data.segments_B{i}]*data.V_scal(:,1:3)'))];

                   end
            end
end

  if data.numb_seg==1
     if data.Borgen==1
         data.mima_SV(1,:) = [min(data.segments_SV{1}(:,1)), max(data.segments_SV{1}(:,1)), min(data.segments_SV{1}(:,2)), max(data.segments_SV{1}(:,2)),...
             min(min([ones(size(data.segments_SV{1},1),1) data.segments_SV{1}]*data.Vraw(:,1:3)')), max(max([ones(size(data.segments_SV{1},1),1) data.segments_SV{1}]*data.Vraw(:,1:3)'))];
     else
         a=zeros(size(data.segments_B{1},1),1);
         for j=1:size(data.segments_B{1},1);
             a(j)=(1-data.sum_v2*data.segments_B{1}(j,1)-data.sum_v3*data.segments_B{1}(j,2))/data.sum_v1;
         end
         
         data.mima_B(1,:) = [min(data.segments_B{1}(:,1)), max(data.segments_B{1}(:,1)), min(data.segments_B{1}(:,2)), max(data.segments_B{1}(:,2)),...
             min(min([a data.segments_B{1}]*data.V_scal(:,1:3)')), max(max([a data.segments_B{1}]*data.V_scal(:,1:3)'))];     
     end
     
     if data.Borgen==1
         data.mima_SV(1,:) = [min(data.FP_SV(:,1)), max(data.FP_SV(:,1)), min(data.FP_SV(:,2)), max(data.FP_SV(:,2)),...
             min(min([ones(size(data.FP_SV,1),1) data.FP_SV]*data.Vraw(:,1:3)')), max(max([ones(size(data.FP_SV,1),1) data.FP_SV]*data.Vraw(:,1:3)'))];
     else
         a=zeros(size(data.FP_B,1),1);
         for j=1:size(data.FP_B,1);
             a(j)=(1-data.sum_v2*data.FP_B(j,1)-data.sum_v3*data.FP_B(j,2))/data.sum_v1;
         end
         
         data.mima(1,:) = [min(data.FP_B(:,1)), max(data.FP_B(:,1)), min(data.FP_B(:,2)), max(data.FP_B(:,2)),...
             min(min([a data.FP_B]*data.V_scal(:,1:3)')), max(max([a data.FP_B]*data.V_scal(:,1:3)'))];     
     end
     
 end


set(Empty_Button,'UserData',data)


hold(AxesSOL,'off');
plot(AxesSOL,1,0,'w');






