www.pudn.com > 3.rar > cover_compute.m, change:2008-03-06,size:1317b


function [C]=cover_compute(rs,rc,V,symb) 
% compute the node  
 
global b_max b_min k ; 
%compute the x and y range 
temp=min(V); 
x_min=temp(1); 
y_min=temp(2); 
 
temp=max(V); 
x_max=temp(1); 
y_max=temp(2); 
 
%compute the step length 
step=rs+sqrt(rs*rs-rc*rc/4); 
disp(num2str(step)); 
%k=2(rs+sqrt(rs*rs-rc*rc/4))/rc; 
 
y=y_min; 
%x=x_min; 
k1=0; 
k2=0; 
count_node=1; 
disp('hello'); 
 
while (y<=y_max) 
    x=(y-b_max)/k; 
    while (x<=(y-b_min)/k) 
        
        %C=[x,y]; 
        C(count_node,1)=x; 
        C(count_node,2)=y; 
        %k2=k2+1;  
        x=x+rc; 
        count_node=count_node+1; 
    end 
    %k1=k1+1; 
    y=y+step; 
end 
C 
 
if symb 
    colordef none,  whitebg 
    figure(1); 
    axis equal 
    hold on; 
    box on; 
    plot([V(1,1) V(2,1)],[V(1,2) V(2,2)],'-k'); 
    hold on; 
    plot([V(2,1) V(3,1)],[V(2,2) V(3,2)],'-k'); 
    hold on; 
    plot([V(3,1) V(4,1)],[V(3,2) V(4,2)],'-k'); 
    hold on; 
    plot([V(4,1) V(1,1)],[V(4,2) V(1,2)],'-k'); 
    hold on; 
     
    plot(C(:, 1), C(:, 2), 'k.', 'MarkerSize', 5); 
     
    title('Parallelogram'); 
    xlabel('X'); 
    ylabel('Y'); 
    x_lable=max(V); 
    axis([0,x_lable(1)+10, 0, y_max+10]);    
    set(gca, 'XTick', [0; x_lable(1)+10]); 
    set(gca, 'YTick', [y_max+10]); 
     
end