【文章內(nèi)容簡介】
s. % See ISPC and COMPUTER. if ispc amp。amp。 isequal(get(hObject,39。BackgroundColor39。), get(0,39。defaultUicontrolBackgroundColor39。)) 12 set(hObject,39。BackgroundColor39。,39。white39。)。 end function edit6_Callback(hObject, eventdata, handles) % hObject handle to edit6 (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,39。String39。) returns contents of edit6 as text % str2double(get(hObject,39。String39。)) returns contents of edit6 as a double % Executes during object creation, after setting all properties. function edit6_CreateF(hObject, eventdata, handles) % hObject handle to edit6 (see GCBO) % eventdata reserved to be defined in a future version of MATLAB % handles empty handles not created until after all CreateFs called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc amp。amp。 isequal(get(hObject,39。BackgroundColor39。), get(0,39。defaultUicontrolBackgroundColor39。)) set(hObject,39。BackgroundColor39。,39。white39。)。 end 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,39。String39。) returns contents of edit7 as text % str2double(get(hObject,39。String39。)) returns contents of edit7 as a double % Executes during object creation, after setting all properties. function edit7_CreateF(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 CreateFs called % Hint: edit controls usually have a white background on Windows. 13 % See ISPC and COMPUTER. if ispc amp。amp。 isequal(get(hObject,39。BackgroundColor39。), get(0,39。defaultUicontrolBackgroundColor39。)) set(hObject,39。BackgroundColor39。,39。white39。)。 end % Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) %直線單步插補(bǔ) % 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) global x1 y1 x2 y2 L N x y Mx My Jvx Jrx1 Jrx2 Jrx3 Jvy Jry1 Jry2 Jry3 X Y。 if (get(,39。Value39。)==0)... amp。(get(,39。Value39。)==0)... amp。(get(,39。Value39。)==0) set(,39。string39。,39。請(qǐng)選擇插補(bǔ)方式 39。)。 else if (Mx=0)amp。(My=0) set(,39。string39。,39。插補(bǔ)結(jié)束 39。)。 else Jrx1=Jvx+Jrx1。 Jry1=Jvy+Jry1。 Jrx2=Jvx+Jrx2。 Jry2=Jvy+Jry2。 Jrx3=Jvx+Jrx3。 Jry3=Jvy+Jry3。 if get(,39。Value39。)==1 %普通 DDA if (x1=x2)amp。(y1=y2) %轉(zhuǎn)化后直線在第一象限 if (Jrx1=2^N) Jrx1=Jrx12^N。 X=X+L。 x=linspace(XL,X,100)。 Mx=Mx1。 else x=zeros(1,100)+X。 end if (Jry1=2^N) Jry1=Jry12^N。 y=linspace(YL,Y,100)。 My=My1。 else y=zeros(1,100)+Y。 end plot(x,y,39。r39。)。 14 hold on。 elseif (x1x2)amp。(y1=y2) %轉(zhuǎn)化后直線在第二象限 if (Jrx1=2^N) Jrx1=Jrx12^N。 X=XL。 x=linspace(X+L,X,100)。 Mx=Mx1。 else x=zeros(1,100)+X。 end if (Jry1=2^N) Jry1=Jry12^N。 Y=Y+L。 y=linspace(YL,Y,100)。 My=My1。 else y=zeros(1,100)+Y。 end plot(x,y,39。r39。)。 hold on。 elseif (x1x2)amp。(y1y2) %轉(zhuǎn)化后直線在第三象限 if (Jrx1=2^N) Jrx1=Jrx12^N。 X=XL。 x=linspace(X+L,X,100)。 Mx=Mx1。 else x=zeros(1,100)+X。 end if (Jry1=2^N) Jry1=Jry12^N。 Y=YL。 y=linspace(Y+L,Y,100)。 My=My1。 y=zeros(1,100)+Y。 end plot(x,y,39。r39。)。 hold on。 else %轉(zhuǎn)化后直線在第四象限 if (Jrx1=2^N) Jrx1=Jrx12^N。 X=X+L。 x=linspace(XL,X,100)。 Mx=Mx1。 15 else x=zeros(1,100)+X。 end if (Jry1=2^N) Jry1=Jry12^N。 Y=YL。 y=linspace(Y+L,Y,100)。 My=My1。 else y=zeros(1,100)+Y。 end plot(x,y,39。r39。)。 hold on。 end elseif get(,39。Value39。)==1 %全加載 if (x1=x2)amp。(y1=y2) if (Jrx2=2^N) Jrx2=Jrx22^N。 X=X+L。 x=linspace(XL,X,100)。 Mx=Mx1。 else x=zeros(1,100)+X。 end if (Jry2=2^N) Jry2=Jry22^N。 Y=Y+L。