1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
function [bonds,components] = rbg2abg(rbonds,rstrokes,rcomponents,rports,infofile)
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.9 1996/12/31 11:25:57 peterg
% %% Clearer error messages for incorrect ports.
% %%
% %% Revision 1.8 1996/12/04 21:52:39 peterg
% %% Now uses fopen.
% %%
% %% Revision 1.7 1996/11/01 18:01:57 peterg
|
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
function [bonds,components] = rbg2abg(rbonds,rstrokes,rcomponents,rports,infofile)
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.10 1997/03/17 13:45:42 peterg
% %% Added more error info.
% %%
% %% Revision 1.9 1996/12/31 11:25:57 peterg
% %% Clearer error messages for incorrect ports.
% %%
% %% Revision 1.8 1996/12/04 21:52:39 peterg
% %% Now uses fopen.
% %%
% %% Revision 1.7 1996/11/01 18:01:57 peterg
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
arrow_vector = ( which_end.*other_end_2 + (one-which_end).*other_end_1 ) - ...
arrow_end;
% Locate the bond end nearest to each port
% col 1 of port_near_bond contains a signed bond number (+ for arrow end)
% col 2 of port_near_bond contains the corresponding port number
for i = 1:n_ports
near_bond = adjbond(rports(i,1:2),arrow_end,other_end);
signed_bond = near_bond(1)*sign(1.5-near_bond(2))
port_near_bond(i,:) = [signed_bond, rports(i,3)];
end;
% Locate the components at the ends of each bond
% col 1 of comp_near_bond contain the component nearest to the arrow end
% col 2 of comp_near_bond contain the component nearest to the other end
for i = 1:n_bonds
|
>
|
>
>
>
>
>
>
|
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
arrow_vector = ( which_end.*other_end_2 + (one-which_end).*other_end_1 ) - ...
arrow_end;
% Locate the bond end nearest to each port
% col 1 of port_near_bond contains a signed bond number (+ for arrow end)
% col 2 of port_near_bond contains the corresponding port number
for i = 1:n_ports
[i rports(i,1:2)/scale rports(i,3)]
near_bond = adjbond(rports(i,1:2),arrow_end,other_end)
[rows,cols]=size(near_bond);
if rows>1
error(sprintf ...
("A port is near to more than one bond at coordinates %g,%g\n", ...
rports(i,1)/scale, rports(i,2)/scale));
end;
signed_bond = near_bond(1)*sign(1.5-near_bond(2));
port_near_bond(i,:) = [signed_bond, rports(i,3)];
end;
% Locate the components at the ends of each bond
% col 1 of comp_near_bond contain the component nearest to the arrow end
% col 2 of comp_near_bond contain the component nearest to the other end
for i = 1:n_bonds
|