Differences From Artifact [7ce9c7bd9b]:

To Artifact [3db2dd64e3]:


20
21
22
23
24
25
26



27
28
29
30
31
32
33
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36







+
+
+







  ## Copyright (c) P.J.Gawthrop, 1996.

  ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  ## %% Version control history
  ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  ## %% $Id$
  ## %% $Log$
  ## %% Revision 1.12  2000/09/14 08:07:00  peterg
  ## %% Reformated as an Octave function
  ## %%
  ## %% Revision 1.11  2000/01/18 14:52:02  peterg
  ## %% Removed recursion --- maybe put back via a flag later
  ## %%
  ## %% Revision 1.10  1998/12/14 15:27:32  peterg
  ## %% Added separate handling of ports ( poss zero)
  ## %%
  ## %% Revision 1.9  1998/08/25 06:43:02  peterg
158
159
160
161
162
163
164
165
166
167
168






169
170
171
172
173
174
175
161
162
163
164
165
166
167




168
169
170
171
172
173
174
175
176
177
178
179
180







-
-
-
-
+
+
+
+
+
+







  distance_2 = length2d(other_end_2 - arrow_end);
  which_end = (distance_1>distance_2)*[1 1];
  one = ones(size(which_end));
  other_end = which_end.*other_end_1 + (one-which_end).*other_end_2;
  arrow_barb = which_end.*other_end_2 + (one-which_end).*other_end_1;
  arrow_vector =  arrow_barb-arrow_end;
  unit_arrow_vector = arrow_vector./(length2d(arrow_vector)*[1 1]);
  bond_vector = (arrow_end - other_end);
  unit_bond_vector = bond_vector./(length2d(bond_vector)*[1 1]);
  unit_stroke_vector = (rot*unit_bond_vector')';
  
  
  ## Extract directional information
  arrow_end_direction = [rbonds(:,7), rbonds(:,8)];
  other_end_direction = [rbonds(:,9), rbonds(:,10)];


  ## Get indices of bonds with changed causality -- but ignore the extra bonds
  ## due to vector bond expansion
  changed_e = bonds(1:n_bonds,1)~=cbonds(1:n_bonds,1);
  changed_f = bonds(1:n_bonds,2)~=cbonds(1:n_bonds,2);
  changed = changed_e|changed_f;
  ## Don't do port bonds
				#if n_ports>0
184
185
186
187
188
189
190

191
192

193
194
195
196
197







198
199
200
201
202
203
204
205
206
207
208
209
210
211
212

213
214

215
216
217




218
219


220
221
222
223
224
225
226
227
189
190
191
192
193
194
195
196
197
198
199
200
201



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234


235
236

237
238
239
240
241
242
243







+


+


-
-
-
+
+
+
+
+
+
+















+


+



+
+
+
+
-
-
+
+
-







  index_ef  = getindex(changed,1)';

  ## Print the new strokes in fig format
  if index_ef(1,1)>0
    for i = index_e		# Do the effort stroke - opp. side to arrow

      if cbonds(i,1)==1		# Stroke at arrow end
	bond_vector = arrow_end_direction(i,:); # Directional vector
	stroke_end_1 = arrow_end(i,:);
      else
	bond_vector = other_end_direction(i,:); # Directional vector
	stroke_end_1 = other_end(i,:);
      end;
      
      sig = sign(unit_arrow_vector(i,:)*unit_stroke_vector(i,:)');
      stroke_end_2 = stroke_end_1 - stroke_length*sig*unit_stroke_vector(i,:);

      ## Work out the direction for the stroke (right angles to bond)
      unit_bond_vector = bond_vector./(length2d(bond_vector)*[1 1]);
      unit_stroke_vector = (rot*unit_bond_vector')';
      
      sig = sign(unit_arrow_vector(i,:)*unit_stroke_vector');
      stroke_end_2 = stroke_end_1 - stroke_length*sig*unit_stroke_vector;
      

      ## print the fig3 format firstline spec.
      polyline = 2; 
      firstline = fig3(polyline,stroke_thickness,stroke_colour);
      fprintf(filenum, '%s\n', firstline);

      fprintf(filenum, '	%4.0f %4.0f %4.0f %4.0f \n', ...
	      stroke_end_1(1), stroke_end_1(2), ...
	      stroke_end_2(1), stroke_end_2(2) );
    end;

    for i = index_f		# Do the flow stroke - same side as arrow

      if cbonds(i,2)==1		# Stroke at arrow end
	bond_vector = arrow_end_direction(i,:); # Directional vector
	stroke_end_1 = arrow_end(i,:);
      else
	bond_vector = other_end_direction(i,:); # Directional vector
	stroke_end_1 = other_end(i,:);
      end;
      
      ## Work out the direction for the stroke (right angles to bond)
      unit_bond_vector = bond_vector./(length2d(bond_vector)*[1 1]);
      unit_stroke_vector = (rot*unit_bond_vector')';
      
      sig = sign(unit_arrow_vector(i,:)*unit_stroke_vector(i,:)');
      stroke_end_2 = stroke_end_1 + stroke_length*sig*unit_stroke_vector(i,:);
      sig = sign(unit_arrow_vector(i,:)*unit_stroke_vector');
      stroke_end_2 = stroke_end_1 + stroke_length*sig*unit_stroke_vector;
      

      ## print the fig3 format firstline spec.
      polyline = 2; 
      firstline = fig3(polyline,stroke_thickness,stroke_colour);
      fprintf(filenum, '%s\n', firstline);

      fprintf(filenum, '	%4.0f %4.0f %4.0f %4.0f \n', ...

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