//
2、DDA法圆弧插补
开始 初始化,输入起点坐标(xr03,y03),终点坐标(x04,y04) 半径R步长b和寄存器位数j N 二一象限顺圆? Y 计算圆心坐标(xx,yy) xj=x03,yj=y03 jvx=0;jvy=0 m=2^j xm=fix((xx-x03)/b); ym=fix((yy+R-y03)/b) N xm>0? Y jvx=jvx+yj-yy ym>0? Y jvy=jvy+xx-xj +X前进一步 xm=xm-1 Y jvx溢出? +Y前进一步 ym=ym-1 jvy溢出? Y xm>0||ym>0? N //
N xn=fix((x04-xx)/b); yn=fix((yy+R-y04)/b); N xn>0? Y jvx=jvx+yj-yy yn>0? Y jvy=jvy+xj-xx +X前进一步 xn=xn-1 Y jvx溢出? -Y前进一步 yn=yn-1 jvy溢出? Y xn>0||yn>0? N 结束 //
五.程序及变量说明(Matlab)
function varargout = cxy_050910610(varargin) gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @cxy_050910610_OpeningFcn, ... 'gui_OutputFcn', @cxy_050910610_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
function cxy_050910610_OpeningFcn(hObject, eventdata, handles, varargin) global u u=0;
global fla; fla=0;
handles.output = hObject;
guidata(hObject, handles);
function varargout = cxy_050910610_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
function x1_Callback(hObject, eventdata, handles) global x01;
x01=str2double(get(handles.x1,'string'));
function x1_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');
//
end
function x2_Callback(hObject, eventdata, handles) global x02;
x02=str2double(get(handles.x2,'string'));
function x2_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
function y1_Callback(hObject, eventdata, handles) global y01;
y01=str2double(get(handles.y1,'string'));
function y1_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
function y2_Callback(hObject, eventdata, handles) global y02;
y02=str2double(get(handles.y2,'string'));
function y2_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
function x3_Callback(hObject, eventdata, handles) global x03;
x03=str2double(get(handles.x3,'string'));
function x3_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
//
function y3_Callback(hObject, eventdata, handles) global y03;
y03=str2double(get(handles.y3,'string'));
function y3_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
function x4_Callback(hObject, eventdata, handles) global x04;
x04=str2double(get(handles.x4,'string'));
function x4_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
function y4_Callback(hObject, eventdata, handles) global y04;
y04=str2double(get(handles.y4,'string'));
function y4_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
function r_Callback(hObject, eventdata, handles) global R;
R=str2double(get(handles.r,'string'));
function r_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end