Overview
Comment:Initial revision
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: fd47e5d964733976d699345a33a12ec57bb15887df7f843de7bb141ed6110ff3
User & Date: gawthrop@users.sourceforge.net on 1996-08-24 18:02:25
Other Links: branch diff | manifest | tags
Context
1996-08-24
19:21:26
More specific error messages. check-in: 4c529e09b3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
18:02:25
Initial revision check-in: fd47e5d964 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
18:00:33
Fixed bug with finding ports. check-in: 328344eb50 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/bin/trans/m/adjbond.m version [266020f198].























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function [index,distance] = adjbond(point,arrow_end,other_end);
% adjbond:  Determines the bond closest to the point 
%  [index,distance] = adjbond(point,arrow_end,other_end);


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


[n,m] = size(other_end);
one = ones(n,1);
arrow_distance = length2d(one*point - arrow_end);
min_arrow_distance = min(arrow_distance);

other_distance = length2d(one*point - other_end);
min_other_distance = min(other_distance);

min_distance = min([arrow_distance; other_distance]);

adjacent = [arrow_distance, other_distance] == min_distance*[one one];
[index,n] = getindex(adjacent,1);
distance = min_distance;

Added mttroot/mtt/bin/trans/m/adjcomp.m version [142766d077].



































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function indices = adjcomp(arrow_end,other_end,components);
% adjcomp: Determines the two components at each end of the bond



% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


[n,m] = size(components);
one = ones(n,1);

arrow_distance = length2d(one*arrow_end - components(:,1:2));
min_arrow_distance = min(arrow_distance);

other_distance = length2d(one*other_end - components(:,1:2));
min_other_distance = min(other_distance);

arrow_adjacent = arrow_distance==min_arrow_distance*one;
other_adjacent = other_distance==min_other_distance*one;
[index,n] = getindex([arrow_adjacent,other_adjacent],1);

if index(1,2)==1
  indices = index(1:2,1)';
else
  indices = index(2:-1:1,1)';
end;


Added mttroot/mtt/bin/trans/m/getindex.m version [b17581b243].





























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function [index, n, otherindex, m] = getindex(array,value);
% Finds the n indices of the elements of array equal to value
% otherindex contains indeces of the the m other  elements.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[N,M] = size(array);
n=0; m=0;
for i=1:N
  for j = 1:M
    if array(i,j)==value
      n=n+1;
      index(n,:) = [i j];
    else
      m=m+1;
      otherindex(m,:) = [i j];
    end;
  end;
end;


if (M==1)&(n>0)
  index = index(:,1);
end;

if (M==1)&(m>0)
  otherindex = otherindex(:,1);
end;

% Octave doesn't like empty matrices
if n==0
  index=0;
end;

if m==0
  otherindex=0;
end;




MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]