summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-01-12 01:51:25 +0000
committerKarl Berry <karl@freefriends.org>2010-01-12 01:51:25 +0000
commit692e44b74537cef74af1a4b12f28de5a9a21ca43 (patch)
tree43e57a7a3b4e8dbbf9a94eb5bfac1999a03e0776 /Master/texmf-dist/metapost
parentfbb62bc0c2f3b0ff5d46e784a6f95f2d22dd3f63 (diff)
drv 0.95 (11jan10)
git-svn-id: svn://tug.org/texlive/trunk@16678 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r--Master/texmf-dist/metapost/drv/drv.mp1007
1 files changed, 865 insertions, 142 deletions
diff --git a/Master/texmf-dist/metapost/drv/drv.mp b/Master/texmf-dist/metapost/drv/drv.mp
index 69f2f9f72c7..a5791649f82 100644
--- a/Master/texmf-dist/metapost/drv/drv.mp
+++ b/Master/texmf-dist/metapost/drv/drv.mp
@@ -1,5 +1,5 @@
-%% drv.mp 0.94
-%% Copyright 2009 Laurent M\'ehats
+%% drv 0.95
+%% Copyright 2010 Laurent M\'ehats
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -16,6 +16,9 @@
%
% This work consists of the file drv.mp
+newinternal drv_version;
+drv_version:=0.95;
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -142,8 +145,9 @@
% <str> LaTeX math-style command
%
% drv_scale (<id>, <float>)
-% <id> scale identifier (clr, prm, jdg or ilb)
+% <id> scale identifier (clr, crv, prm, jdg or ilb)
% clr nice explanation soon (see examples)
+% crv nice explanation soon (see examples)
% prm nice explanation soon (see examples)
% jdg nice explanation soon (see examples)
% ilb nice explanation soon (see examples)
@@ -217,6 +221,15 @@
% on
% off
%
+% drv_radial_mode <id>
+% <id> status identifier (on or off)
+% on
+% off
+%
+% drv_azimuth <float>
+% <float> azimuth degree
+%
+%
% * Derivation tree pictures
% ==========================
%
@@ -234,6 +247,12 @@
% <path> MetaPost path expression
% <id> path style identifier (0, 1, 2, 3, 4, 5 or 6)
%
+% drv_root (<nat>, <id>)
+% <nat> root index
+% <id> position identifier (t or b)
+% t top
+% b bottom
+%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -250,9 +269,8 @@ vardef drv_format (expr str, fst_len, nxt_len, dbl_pcs)=
% fst_len: first line length
% nxt_len: following lines length
% dbl_pcs (boolean): occurrences of the percent character must be doubled
- save str_len, sub_len, aux_len, chr_rnk, occ_num;
+ save str_len, sub_len, aux_len, chr_rnk, occ_num, aux_str, chr;
numeric str_len, sub_len, aux_len, chr_rnk, occ_num;
- save aux_str, chr;
string aux_str, chr;
str_len:=length str;
sub_len:=0;
@@ -315,6 +333,8 @@ vardef drv_errmessage expr str=
errmessage drv_format (drv_context&str, 77, 79, false);
enddef;
+drv_message "version "&decimal drv_version&".";
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -488,11 +508,23 @@ picture tt_dgt[][];
numeric min_clr[], prm_skp[], jdg_skp[], ilb_skp[], plb_skp[];
+%vardef drv_fontdimen[] expr font=
+% save dim_pct;
+% picture dim_pct;
+% dim_pct:=drv_tex[0] ("\rule{\the\fontdimen"&(decimal @)&font&"}{0bp}");
+% width dim_pct
+%enddef;
+
vardef drv_fontdimen[] expr font=
- save dim_pct;
+ save dim_pct, dim_str;
picture dim_pct;
- dim_pct:=drv_tex[0] ("\rule{\the\fontdimen"&(decimal @)&font&"}{0bp}");
- width dim_pct
+ string dim_str;
+ dim_pct:=drv_tex[0] ("\mbox{\the\fontdimen"&(decimal @)&font&"}");
+ dim_str:="0";
+ for tok within dim_pct:
+ dim_str:=dim_str&(textpart tok);
+ endfor
+ scantokens dim_str
enddef;
vardef drv_font_size expr size_str=
@@ -530,11 +562,11 @@ vardef drv_font_size expr size_str=
min_clr[2]:=1*rul_thk[2]; % Rule 15d.
min_clr[3]:=1*rul_thk[3]; %
for mth_sty:=0 upto 3:
- sp_pct:=drv_tex[mth_sty] "\,";
+ sp_pct:=drv_tex[mth_sty] "\thinspace";
thn_sp[mth_sty]:=width sp_pct;
- sp_pct:=drv_tex[mth_sty] "\>";
+ sp_pct:=drv_tex[mth_sty] "\medspace";
med_sp[mth_sty]:=width sp_pct;
- sp_pct:=drv_tex[mth_sty] "\;";
+ sp_pct:=drv_tex[mth_sty] "\thickspace";
thk_sp[mth_sty]:=width sp_pct;
pdt_pct:=drv_tex[mth_sty] "\ldotp";
pdt_hg[mth_sty]:=height pdt_pct;
@@ -588,6 +620,7 @@ vardef drv_box text STR=
expandafter pair scantokens str.r;
expandafter numeric scantokens str.hg;
expandafter numeric scantokens str.dp;
+ drv_arc str;
endfor
enddef;
@@ -606,6 +639,119 @@ enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
+% drv-arcs
+%
+
+vardef drv_arc text STR=
+ for str=STR:
+ expandafter numeric scantokens str.rad;
+ expandafter numeric scantokens str.lng;
+ expandafter numeric scantokens str.cng;
+ expandafter numeric scantokens str.rng;
+ expandafter pair scantokens str.org;
+ endfor
+enddef;
+
+vardef arc_init @# (expr pct, ngl)=
+ @#:=pct;
+ @#.rng-@#.lng=ngl;
+ @#.cng=(@#.lng+@#.rng)/2;
+enddef;
+
+vardef arc_freeze @#=
+ @#:=@# rotated @#.lng shifted @#.org;
+ @#.l:=(dir @#.lng) scaled @#.rad shifted @#.org;
+ @#.c:=(dir @#.cng) scaled @#.rad shifted @#.org;
+ @#.r:=(dir @#.rng) scaled @#.rad shifted @#.org;
+enddef;
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Polar coordinates, angles & text torsion
+%
+
+vardef rad_part expr ppt=
+ xpart ppt
+enddef;
+
+vardef ngl_part expr ppt=
+ ypart ppt
+enddef;
+
+vardef minrad (expr ppt_a, ppt_b)=
+ min (rad_part ppt_a, rad_part ppt_b)
+enddef;
+
+% "tnum" (turning number) argument:
+% -1: clockwise
+% 1: counterclockwise
+
+vardef lmost_ppt (expr ppt_a, ppt_b) expr tnum=
+ if tnum*(ngl_part ppt_a)<tnum*(ngl_part ppt_b):
+ ppt_a
+ else:
+ ppt_b
+ fi
+enddef;
+
+vardef rmost_ppt (expr ppt_a, ppt_b) expr tnum=
+ if tnum*(ngl_part ppt_a)>tnum*(ngl_part ppt_b):
+ ppt_a
+ else:
+ ppt_b
+ fi
+enddef;
+
+vardef arc_angle (expr rad, arc_len) expr tnum=
+ if rad>0:
+ save pth;
+ path pth;
+ pth:=fullcircle scaled (2*rad);
+ tnum*(angle point (arctime arc_len of pth) of pth)
+ else:
+ 0
+ fi
+enddef;
+
+vardef circ_path (expr rad, ngl) expr tnum=
+ save pth;
+ path pth;
+ pth:=if tnum=-1: reverse fi fullcircle scaled (2*rad);
+ subpath (0, directiontime (dir (ngl+tnum*90)) of pth) of pth
+enddef;
+
+vardef text_arc (expr pct, rad) expr tnum=
+ save arc_pct, tok_str, tok_trn, tok_ngl, hlf_wd, chr_pct;
+ picture arc_pct, chr_pct;
+ numeric tok_ngl, hlf_wd;
+ string tok_str;
+ arc_pct:=nullpicture;
+ for tok within pct:
+ transform tok_trn;
+ tok_str:=textpart tok;
+ (0, 0) transformed tok_trn=(0, 0);
+ (0, 1) transformed tok_trn=(xypart tok, yypart tok);
+ (1, 0) transformed tok_trn=(xxpart tok, yxpart tok);
+ tok_ngl:=arc_angle (rad, xpart tok) tnum;
+ for chr_rnk=0 upto (length tok_str-1):
+ chr_pct:=substring (chr_rnk, chr_rnk+1) of tok_str infont (fontpart tok)
+ transformed tok_trn;
+ hlf_wd:=(width chr_pct)/2;
+ tok_ngl:=tok_ngl+arc_angle (rad, hlf_wd) tnum;
+ addto arc_pct also chr_pct
+ shifted (-hlf_wd, 0)
+ rotated (tok_ngl+tnum*90)
+ shifted ((dir tok_ngl) scaled (rad-tnum*(ypart tok)));
+ tok_ngl:=tok_ngl+arc_angle (rad, hlf_wd) tnum;
+ endfor
+ endfor
+ arc_pct
+enddef;
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
% beginfig & endfig
%
@@ -637,14 +783,17 @@ vardef drv_beginfig=
% iln_sty[i] inference line style
% l_prm[i] leftmost `graphical' premise index
% r_prm[i] rightmost `graphical' premise index
+ % bot_jdg[i] boolean
%
numeric prm_num[], prm[][], ccl[];
numeric jct_sty[];
string alg_sty[];
numeric iln_sty[];
numeric l_prm[], r_prm[];
+ boolean bot_jdg[];
%
% nfr_min_x[i] inference minimal x
+ % nfr_lmost_ppt[i] inference leftmost polar point
% l_dlb[i] left delimiter label drv-box
% l_dlm[i] left delimiter drv-box
% l_ilb[i] left label drv-box
@@ -653,22 +802,31 @@ vardef drv_beginfig=
% r_dlm[i] right delimiter drv-box
% r_dlb[i] right delimiter label drv-box
% nfr_max_x[i] inference maximal x
+ % nfr_rmost_ppt[i] inference rightmost polar point
%
numeric nfr_min_x[];
+ pair nfr_lmost_ppt[];
drv_box "l_dlb[]", "l_dlm[]", "l_ilb[]";
drv_box "iln[]";
drv_box "r_ilb[]", "r_dlm[]", "r_dlb[]";
numeric nfr_max_x[];
+ pair nfr_rmost_ppt[];
%
% Sub-trees
%
% sub_min_x[i] sub-tree minimal x
+ % sub_lmost_ppt[i] sub-tree leftmost polar point
% sub_max_x[i] sub-tree maximal x
+ % sub_rmost_ppt[i] sub-tree rightmost polar point
% sub_min_y[i] sub-tree minimal y
+ % sub_min_rad[i] sub-tree minimal radius
% sub_max_y[i] sub-tree maximal y
+ % sub_max_rad[i] sub-tree maximal radius
% boxed[i] boolean
%
numeric sub_min_x[], sub_max_x[], sub_min_y[], sub_max_y[];
+ pair sub_lmost_ppt[], sub_rmost_ppt[];
+ numeric sub_min_rad[], sub_max_rad[];
boolean boxed[];
%
% Pen initialization
@@ -953,8 +1111,8 @@ vardef NFR[] (text PRM) (expr lilb, rilb, ldlb, rdlb)
%
% PRM: list of premise indices
%
- save prm_rnk;
- numeric prm_rnk;
+ save prm_rnk, root_rnk;
+ numeric prm_rnk, root_rnk;
prm_rnk:=0;
for prm_idx=PRM:
if prm_idx=@:
@@ -971,8 +1129,6 @@ vardef NFR[] (text PRM) (expr lilb, rilb, ldlb, rdlb)
%
% roots list update
%
- save root_rnk;
- numeric root_rnk;
root_rnk:=0;
forever:
exitif root[root_rnk]=prm_idx;
@@ -1324,24 +1480,46 @@ string drv_rdlm_str; % right delimiter LaTeX code
% 2. Macros
%
-vardef minmax_y[]=(
- if drv_bot_roots:
+vardef min_y[]=
+ if bot_jdg[@]:
if known ccl[@]:
ypart jdg[@].c-num_hg+iln_hg[(iln_sty[ccl[@]])]
+min_clr_scl*min_clr[drv_sty]/2
else:
sub_min_y[@]-min_clr_scl*min_clr[drv_sty]
- fi,
+ fi
+ else:
+ sub_min_y[@]-min_clr_scl*min_clr[drv_sty]
+ fi
+enddef;
+
+vardef max_y[]=
+ if bot_jdg[@]:
sub_max_y[@]+min_clr_scl*min_clr[drv_sty]
else:
- sub_min_y[@]-min_clr_scl*min_clr[drv_sty],
if known ccl[@]:
ypart jdg[@].c-den_dp+iln_dp[(iln_sty[ccl[@]])]
-min_clr_scl*min_clr[drv_sty]/2
else:
sub_max_y[@]+min_clr_scl*min_clr[drv_sty]
fi
- fi)
+ fi
+enddef;
+
+vardef min_rad[]=
+ if known ccl[@]:
+ if bot_jdg[@]:
+ jdg[@].rad-num_hg+iln_hg[(iln_sty[ccl[@]])]
+ else:
+ jdg[@].rad+den_dp-iln_dp[(iln_sty[ccl[@]])]
+ fi+min_clr_scl*min_clr[drv_sty]/2
+ else:
+ sub_min_rad[@]-min_clr_scl*min_clr[drv_sty]
+ fi
+enddef;
+
+vardef max_rad[]=
+ sub_max_rad[@]+min_clr_scl*min_clr[drv_sty]
enddef;
vardef delim @# expr dlm_len=
@@ -1394,6 +1572,10 @@ boolean drv_boxmode_on; %
boolean drv_fractionmode_on; %
string drv_axis_ref; %
+boolean drv_radialmode_on; %
+numeric crv_scl; %
+numeric azimuth_ngl; %
+
%
% 2. Macros
%
@@ -1410,7 +1592,7 @@ vardef fraction_inference[]=
and drv_fractionmode_on
enddef;
-vardef drv_check_root[]=
+vardef drv_bot_check[]=
if unknown jdg[@]:
drv_errhelp "An index must be used to declare a both a judgment and an"&
" inference.";
@@ -1425,29 +1607,56 @@ vardef drv_check_root[]=
save i_sty, prm_idx;
numeric i_sty, prm_idx;
i_sty:=iln_sty[@];
+ bot_jdg[@]:=true;
for prm_rnk=0 upto prm_num[@]-1:
prm_idx:=prm[@][prm_rnk];
- drv_check_root[prm_idx];
+ drv_bot_check[prm_idx];
%
% numerators and denominators clearances
% The TEXbook, Appendix G, Rule 15d.
%
- if drv_bot_roots:
- num_hg:=max(num_hg,
- iln_hg[i_sty]+min_clr_scl*min_clr[drv_sty]-jdg[prm_idx].dp);
- else:
- den_dp:=min(den_dp,
- iln_dp[i_sty]-min_clr_scl*min_clr[drv_sty]-jdg[prm_idx].hg);
- fi
+ num_hg:=max (num_hg,
+ iln_hg[i_sty]+min_clr_scl*min_clr[drv_sty]-jdg[prm_idx].dp);
endfor
if not fraction_inference[@]:
- if drv_bot_roots:
- den_dp:=min(den_dp,
- iln_dp[i_sty]-min_clr_scl*min_clr[drv_sty]-jdg[@].hg);
- else:
- num_hg:=max(num_hg,
- iln_hg[i_sty]+min_clr_scl*min_clr[drv_sty]-jdg[@].dp);
- fi
+ den_dp:=min (den_dp,
+ iln_dp[i_sty]-min_clr_scl*min_clr[drv_sty]-jdg[@].hg);
+ fi
+ if unknown boxed[@]:
+ boxed[@]:=drv_boxmode_on;
+ fi
+ fi
+enddef;
+
+vardef drv_top_check[]=
+ if unknown jdg[@]:
+ drv_errhelp "An index must be used to declare a both a judgment and an"&
+ " inference.";
+ drv_errmessage (decimal @)&" has been used as an inference index but not"&
+ " as a judgment index";
+ elseif unknown prm_num[@]:
+ drv_errhelp "An index must be used to declare a both a judgment and an"&
+ " inference.";
+ drv_errmessage (decimal @)&" has been used as a judgment index but not"&
+ " as an inference index";
+ else:
+ save i_sty, prm_idx;
+ numeric i_sty, prm_idx;
+ i_sty:=iln_sty[@];
+ bot_jdg[@]:=false;
+ for prm_rnk=0 upto prm_num[@]-1:
+ prm_idx:=prm[@][prm_rnk];
+ drv_top_check[prm_idx];
+ %
+ % numerators and denominators clearances
+ % The TEXbook, Appendix G, Rule 15d.
+ %
+ den_dp:=min (den_dp,
+ iln_dp[i_sty]-min_clr_scl*min_clr[drv_sty]-jdg[prm_idx].hg);
+ endfor
+ if not fraction_inference[@]:
+ num_hg:=max (num_hg,
+ iln_hg[i_sty]+min_clr_scl*min_clr[drv_sty]-jdg[@].dp);
fi
if unknown boxed[@]:
boxed[@]:=drv_boxmode_on;
@@ -1455,24 +1664,42 @@ vardef drv_check_root[]=
fi
enddef;
+vardef drv_root (expr idx) (suffix pos_sfx)=
+ save root_idx;
+ numeric root_idx;
+ root_idx:=idx;
+ forever:
+ exitif unknown ccl[root_idx];
+ root_idx:=ccl[root_idx];
+ endfor
+ if idx<>root_idx:
+ drv_message "warning, "&(decimal idx)&" is not a root index"&
+ " (the actual root index is "&(decimal root_idx)&").";
+ fi
+ bot_jdg[root_idx]:=check_position_bot (pos_sfx) (drv_bot_roots);
+enddef;
+
vardef drv_check=
if root_num=0:
drv_errhelp "Well ...";
drv_errmessage "no inference has been declared";
else:
- save root_idx;
+ save root_idx, root_str;
numeric root_idx;
- root_idx:=root[0];
- drv_check_root[root_idx];
+ string root_str;
+ for root_rnk=0 upto root_num-1:
+ root_idx:=root[root_rnk];
+ if unknown bot_jdg[root_idx]:
+ bot_jdg[root_idx]:=drv_bot_roots;
+ fi
+ if bot_jdg[root_idx]:
+ drv_bot_check[root_idx];
+ else:
+ drv_top_check[root_idx];
+ fi
+ root_str:=if root_rnk>0: root_str&", "& fi decimal root_idx;
+ endfor
if root_num>1:
- save root_str;
- string root_str;
- root_str:=decimal root_idx;
- for root_rnk=1 upto root_num-1:
- root_idx:=root[root_rnk];
- drv_check_root[root_idx];
- root_str:=root_str&", "&(decimal root_idx);
- endfor
drv_message "warning, multiple root indices ("&root_str&").";
fi
fi
@@ -1483,11 +1710,11 @@ enddef;
% Building
%
-vardef drv_build_root[]=
+vardef drv_lin_build[]=
%
% orientation
%
- if drv_bot_roots:
+ if bot_jdg[@]:
ypart iln[@].c=ypart jdg[@].c-den_dp;
sub_min_y[@]:=ypart jdg[@].c+jdg[@].dp;
sub_max_y[@]:=
@@ -1498,8 +1725,8 @@ vardef drv_build_root[]=
fi;
for prm_rnk=0 upto prm_num[@]-1:
ypart jdg[prm[@][prm_rnk]].c=ypart iln[@].c+num_hg;
- drv_build_root[prm[@][prm_rnk]];
- sub_max_y[@]:=max(sub_max_y[@], sub_max_y[prm[@][prm_rnk]]);
+ drv_lin_build[prm[@][prm_rnk]];
+ sub_max_y[@]:=max (sub_max_y[@], sub_max_y[prm[@][prm_rnk]]);
endfor
else:
ypart iln[@].c=ypart jdg[@].c-num_hg;
@@ -1512,18 +1739,16 @@ vardef drv_build_root[]=
sub_max_y[@]:=ypart jdg[@].c+jdg[@].hg;
for prm_rnk=0 upto prm_num[@]-1:
ypart jdg[prm[@][prm_rnk]].c=ypart iln[@].c+den_dp;
- drv_build_root[prm[@][prm_rnk]];
- sub_min_y[@]:=min(sub_min_y[@], sub_min_y[prm[@][prm_rnk]]);
+ drv_lin_build[prm[@][prm_rnk]];
+ sub_min_y[@]:=min (sub_min_y[@], sub_min_y[prm[@][prm_rnk]]);
endfor
fi
%
% premises junction (from left to right)
%
- for prm_rnk=1 upto prm_num[@]-1:
- save l_lmost, l_rmost, r_lmost, r_rmost;
- save l_max_x, r_min_x, min_skp;
- numeric l_lmost, l_rmost, r_lmost, r_rmost;
- numeric l_max_x, r_min_x, min_skp[];
+ save l_lmost, l_rmost, r_lmost, r_rmost, l_max_x, r_min_x, min_skp;
+ numeric l_lmost, l_rmost, r_lmost, r_rmost, l_max_x, r_min_x, min_skp[];
+ for prm_rnk=1 upto prm_num[@]-1:
l_lmost:=prm[@][0];
l_rmost:=prm[@][prm_rnk-1];
r_lmost:=prm[@][prm_rnk];
@@ -1537,9 +1762,9 @@ vardef drv_build_root[]=
l_rmost:=r_prm[l_rmost];
r_lmost:=l_prm[r_lmost];
r_rmost:=r_prm[r_rmost];
- l_max_x:=max(l_max_x, nfr_max_x[l_rmost]);
- r_min_x:=min(r_min_x, nfr_min_x[r_lmost]);
- min_skp[0]:=min(min_skp[0], nfr_min_x[r_lmost]-nfr_max_x[l_rmost]);
+ l_max_x:=max (l_max_x, nfr_max_x[l_rmost]);
+ r_min_x:=min (r_min_x, nfr_min_x[r_lmost]);
+ min_skp[0]:=min (min_skp[0], nfr_min_x[r_lmost]-nfr_max_x[l_rmost]);
endfor
min_skp[1]:=r_min_x-l_max_x;
if known r_prm[l_rmost]:
@@ -1583,8 +1808,8 @@ vardef drv_build_root[]=
elseif alg_sty[@]="r":
xpart jdg[@].r=r_xref;
fi
- nfr_min_x[@]:=min(xpart jdg[@].l, l_xref);
- nfr_max_x[@]:=max(xpart jdg[@].r, r_xref);
+ nfr_min_x[@]:=min (xpart jdg[@].l, l_xref);
+ nfr_max_x[@]:=max (xpart jdg[@].r, r_xref);
fi
%
% inference line
@@ -1612,14 +1837,14 @@ vardef drv_build_root[]=
if known l_ilb[@]:
l_ilb[@].r=iln[@].l shifted (-ilb_skp_scl*ilb_skp[drv_sty], 0);
nfr_min_x[@]:=xpart l_ilb[@].l;
- sub_min_y[@]:=min(sub_min_y[@], ypart l_ilb[@].c+l_ilb[@].dp);
- sub_max_y[@]:=max(sub_max_y[@], ypart l_ilb[@].c+l_ilb[@].hg);
+ sub_min_y[@]:=min (sub_min_y[@], ypart l_ilb[@].c+l_ilb[@].dp);
+ sub_max_y[@]:=max (sub_max_y[@], ypart l_ilb[@].c+l_ilb[@].hg);
fi
if known r_ilb[@]:
r_ilb[@].l=iln[@].r shifted (ilb_skp_scl*ilb_skp[drv_sty], 0);
nfr_max_x[@]:=xpart r_ilb[@].r;
- sub_min_y[@]:=min(sub_min_y[@], ypart r_ilb[@].c+r_ilb[@].dp);
- sub_max_y[@]:=max(sub_max_y[@], ypart r_ilb[@].c+r_ilb[@].hg);
+ sub_min_y[@]:=min (sub_min_y[@], ypart r_ilb[@].c+r_ilb[@].dp);
+ sub_max_y[@]:=max (sub_max_y[@], ypart r_ilb[@].c+r_ilb[@].hg);
fi
%
% phantom steps
@@ -1628,29 +1853,29 @@ vardef drv_build_root[]=
save bot_y, top_y, phm_pct;
numeric bot_y, top_y;
picture phm_pct;
- if drv_bot_roots:
- bot_y:=xpart minmax_y[@]+min_clr_scl*min_clr[drv_sty]/2;
- top_y:=xpart minmax_y[tgt[@]];
+ if bot_jdg[@]:
+ bot_y:=min_y[@]+min_clr_scl*min_clr[drv_sty]/2;
+ top_y:=min_y[tgt[@]];
else:
- bot_y:=ypart minmax_y[tgt[@]];
- top_y:=ypart minmax_y[@]-min_clr_scl*min_clr[drv_sty]/2;
+ bot_y:=max_y[tgt[@]];
+ top_y:=max_y[@]-min_clr_scl*min_clr[drv_sty]/2;
fi
phm_pct:=((0, (bot_y-top_y)/2)--(0, (top_y-bot_y)/2))
drv_styled phm_sty[@];
box_init phm[@] (phm_pct shifted ((width phm_pct)/2, 0));
phm[@].c=(xpart jdg[@].c, (top_y+bot_y)/2);
- nfr_min_x[@]:=min(nfr_min_x[@], xpart phm[@].l);
- nfr_max_x[@]:=max(nfr_max_x[@], xpart phm[@].r);
+ nfr_min_x[@]:=min (nfr_min_x[@], xpart phm[@].l);
+ nfr_max_x[@]:=max (nfr_max_x[@], xpart phm[@].r);
%
% phantom steps labels
%
if known l_plb[@]:
l_plb[@].r=phm[@].l shifted (-plb_skp[drv_sty], 0);
- nfr_min_x[@]:=min(nfr_min_x[@], xpart l_plb[@].l);
+ nfr_min_x[@]:=min (nfr_min_x[@], xpart l_plb[@].l);
fi
if known r_plb[@]:
r_plb[@].l=phm[@].r shifted ( plb_skp[drv_sty], 0);
- nfr_max_x[@]:=max(nfr_max_x[@], xpart r_plb[@].r);
+ nfr_max_x[@]:=max (nfr_max_x[@], xpart r_plb[@].r);
fi
fi
%
@@ -1659,28 +1884,26 @@ vardef drv_build_root[]=
sub_min_x[@]:=nfr_min_x[@];
sub_max_x[@]:=nfr_max_x[@];
for prm_rnk=0 upto prm_num[@]-1:
- sub_min_x[@]:=min(sub_min_x[@], sub_min_x[prm[@][prm_rnk]]);
- sub_max_x[@]:=max(sub_max_x[@], sub_max_x[prm[@][prm_rnk]]);
+ sub_min_x[@]:=min (sub_min_x[@], sub_min_x[prm[@][prm_rnk]]);
+ sub_max_x[@]:=max (sub_max_x[@], sub_max_x[prm[@][prm_rnk]]);
endfor
%
% delimiters
%
if known l_dlb[@] or known r_dlb[@]:
- save mmy, min_y, max_y;
- numeric min_y, max_y;
- pair mmy;
- mmy:=minmax_y[@];
- min_y:=xpart mmy;
- max_y:=ypart mmy;
+ save miny, maxy;
+ numeric miny, maxy;
+ miny:=min_y[@];
+ maxy:=max_y[@];
if known l_dlb[@]:
- box_init l_dlm[@] (delim l (max_y-min_y));
- l_dlm[@].r=(sub_min_x[@], (max_y+min_y)/2);
+ box_init l_dlm[@] (delim l (maxy-miny));
+ l_dlm[@].r=(sub_min_x[@], (maxy+miny)/2);
l_dlb[@].r=l_dlm[@].l;
sub_min_x[@]:=xpart l_dlb[@].l;
fi
if known r_dlb[@]:
- box_init r_dlm[@] (delim r (max_y-min_y));
- r_dlm[@].l=(sub_max_x[@], (max_y+min_y)/2);
+ box_init r_dlm[@] (delim r (maxy-miny));
+ r_dlm[@].l=(sub_max_x[@], (maxy+miny)/2);
r_dlb[@].l=r_dlm[@].r;
sub_max_x[@]:=xpart r_dlb[@].r;
fi
@@ -1707,13 +1930,372 @@ vardef drv_build_root[]=
fi
enddef;
+vardef drv_rad_build[]=
+ for sbj_rnk=0 upto (sbj_num[@]-1):
+ sbj[@][sbj_rnk].rad=jdg[@].rad;
+ sbj[@][sbj_rnk].org=jdg[@].org;
+ endfor
+ %
+ % orientation
+ %
+ if bot_jdg[@]:
+ iln[@].rad=jdg[@].rad-den_dp;
+ iln[@].org=jdg[@].org;
+ sub_min_rad[@]:=jdg[@].rad+jdg[@].dp;
+ sub_max_rad[@]:=
+ if iln_sty[@]=0:
+ jdg[@].rad+jdg[@].hg
+ else:
+ iln[@].rad+iln_hg[iln_sty[@]]
+ fi;
+ for prm_rnk=0 upto prm_num[@]-1:
+ jdg[prm[@][prm_rnk]].rad=iln[@].rad+num_hg;
+ jdg[prm[@][prm_rnk]].org=iln[@].org;
+ drv_rad_build[prm[@][prm_rnk]];
+ sub_max_rad[@]:=max (sub_max_rad[@], sub_max_rad[prm[@][prm_rnk]]);
+ endfor
+ else:
+ iln[@].rad=jdg[@].rad+num_hg;
+ iln[@].org=jdg[@].org;
+ sub_min_rad[@]:=jdg[@].rad-jdg[@].hg;
+ sub_max_rad[@]:=
+ if iln_sty[@]=0:
+ jdg[@].rad-jdg[@].dp
+ else:
+ iln[@].rad-iln_dp[iln_sty[@]]
+ fi;
+ for prm_rnk=0 upto prm_num[@]-1:
+ jdg[prm[@][prm_rnk]].rad=iln[@].rad-den_dp;
+ jdg[prm[@][prm_rnk]].org=iln[@].org;
+ drv_rad_build[prm[@][prm_rnk]];
+ sub_max_rad[@]:=max (sub_max_rad[@], sub_max_rad[prm[@][prm_rnk]]);
+ endfor;
+ fi
+ %
+ % inference labels
+ %
+ if known l_ilb[@]:
+ l_ilb[@].rad=iln[@].rad;
+ l_ilb[@].org=iln[@].org;
+ sub_max_rad[@]:=max (sub_max_rad[@],
+ l_ilb[@].rad if bot_jdg[@]: +l_ilb[@].hg else: -l_ilb[@].dp fi);
+ fi
+ if known r_ilb[@]:
+ r_ilb[@].rad=iln[@].rad;
+ r_ilb[@].org=iln[@].org;
+ sub_max_rad[@]:=max (sub_max_rad[@],
+ r_ilb[@].rad if bot_jdg[@]: +r_ilb[@].hg else: -r_ilb[@].dp fi);
+ fi
+ %
+ % phantom steps
+ %
+ if known tgt[@]:
+ save src_rad, tgt_rad;
+ numeric src_rad, tgt_rad;
+ src_rad:=min_rad[@]+min_clr_scl*min_clr[drv_sty]/2;
+ tgt_rad:=min_rad[tgt[@]];
+ phm[@].rad=(src_rad+tgt_rad)/2;
+ phm[@].org=jdg[@].org;
+ %
+ % phantom steps labels
+ %
+ if known l_plb[@]:
+ l_plb[@].rad=phm[@].rad;
+ l_plb[@].org=phm[@].org;
+ fi
+ if known r_plb[@]:
+ r_plb[@].rad=phm[@].rad;
+ r_plb[@].org=phm[@].org;
+ fi
+ fi
+ %
+ % delimiters
+ %
+ if known l_dlb[@] or known r_dlb[@]:
+ save minr, maxr;
+ numeric minr, maxr;
+ minr:=min_rad[@];
+ maxr:=max_rad[@];
+ if known l_dlb[@]:
+ l_dlm[@].rad=(minr+maxr)/2;
+ l_dlb[@].rad=l_dlm[@].rad;
+ l_dlb[@].org=l_dlm[@].org=jdg[@].org;
+ fi
+ if known r_dlb[@]:
+ r_dlm[@].rad=(minr+maxr)/2;
+ r_dlb[@].rad=r_dlm[@].rad;
+ r_dlb[@].org=r_dlm[@].org=jdg[@].org;
+ fi
+ fi
+enddef;
+
+vardef drv_ngl_build[]=
+ for prm_rnk=0 upto prm_num[@]-1:
+ drv_ngl_build[prm[@][prm_rnk]];
+ endfor
+ save tnum;
+ numeric tnum;
+ tnum:=if bot_jdg[@]: - fi 1; % turning number
+ %
+ % judgment arc
+ %
+ save jdg_pct, jdg_ngl;
+ picture jdg_pct;
+ numeric jdg_ngl;
+ jdg_pct:=nullpicture;
+ jdg_ngl:=0;
+ for sbj_rnk=0 upto (sbj_num[@]-1):
+ arc_init sbj[@][sbj_rnk]
+ (text_arc (sbj[@][sbj_rnk], sbj[@][sbj_rnk].rad) tnum,
+ arc_angle (sbj[@][sbj_rnk].rad, width sbj[@][sbj_rnk]) tnum);
+ if sbj_rnk>0: % non mandatory test
+ sbj[@][sbj_rnk-1].rng=sbj[@][sbj_rnk].lng;% irrelevant if rnk=0
+ fi
+ addto jdg_pct also sbj[@][sbj_rnk] rotated jdg_ngl;
+ jdg_ngl:=jdg_ngl+sbj[@][sbj_rnk].rng-sbj[@][sbj_rnk].lng;
+ endfor
+ arc_init jdg[@] (jdg_pct, jdg_ngl);
+ if sbj_num[@]>0: % non mandatory test
+ jdg[@].lng=sbj[@][0].lng; % irrelevant if sbj_num=0
+ fi
+ %
+ % premises junction (from left to right)
+ %
+ save l_lmost, l_rmost, r_lmost, r_rmost, l_rmost_ppt, r_lmost_ppt, ppt_skp;
+ numeric l_lmost, l_rmost, r_lmost, r_rmost;
+ pair l_rmost_ppt, r_lmost_ppt, ppt_skp[];
+ for prm_rnk=1 upto prm_num[@]-1:
+ l_lmost:=prm[@][0];
+ l_rmost:=prm[@][prm_rnk-1];
+ r_lmost:=prm[@][prm_rnk];
+ r_rmost:=prm[@][prm_rnk];
+ l_rmost_ppt:=nfr_rmost_ppt[l_rmost];
+ r_lmost_ppt:=nfr_lmost_ppt[r_lmost];
+ ppt_skp[0]:=(minrad (l_rmost_ppt, r_lmost_ppt),
+ (ngl_part r_lmost_ppt)-(ngl_part l_rmost_ppt));
+ forever:
+ exitif (unknown r_prm[l_rmost]) or (unknown l_prm[r_lmost]);
+ l_lmost:=l_prm[l_lmost];
+ l_rmost:=r_prm[l_rmost];
+ r_lmost:=l_prm[r_lmost];
+ r_rmost:=r_prm[r_rmost];
+ l_rmost_ppt:=rmost_ppt (l_rmost_ppt, nfr_rmost_ppt[l_rmost]) tnum;
+ r_lmost_ppt:=lmost_ppt (r_lmost_ppt, nfr_lmost_ppt[r_lmost]) tnum;
+ ppt_skp[0]:=rmost_ppt (ppt_skp[0], (minrad (l_rmost_ppt, r_lmost_ppt),
+ (ngl_part r_lmost_ppt)-(ngl_part l_rmost_ppt))) tnum;
+ endfor
+ ppt_skp[1]:=(minrad (l_rmost_ppt, r_lmost_ppt),
+ (ngl_part r_lmost_ppt)-(ngl_part l_rmost_ppt));
+ if known r_prm[l_rmost]:
+ r_prm[r_rmost]:=r_prm[l_rmost];
+ l_rmost_ppt:=sub_rmost_ppt[l_rmost];
+ elseif known l_prm[r_lmost]:
+ l_prm[l_lmost]:=l_prm[r_lmost];
+ r_lmost_ppt:=sub_lmost_ppt[r_lmost];
+ fi
+ ppt_skp[2]:=(minrad (l_rmost_ppt, r_lmost_ppt),
+ (ngl_part r_lmost_ppt)-(ngl_part l_rmost_ppt));
+ if jct_sty[@]<3:
+ (ngl_part ppt_skp[jct_sty[@]])=
+ arc_angle(rad_part ppt_skp[jct_sty[@]],
+ prm_skp_scl*prm_skp[drv_sty]) tnum;
+ fi
+ endfor
+ %
+ % judgment alignment
+ %
+ if prm_num[@]=0:
+ nfr_lmost_ppt[@]:=(jdg[@].rad, jdg[@].lng);
+ nfr_rmost_ppt[@]:=(jdg[@].rad, jdg[@].rng);
+ else:
+ l_prm[@]:=prm[@][0];
+ r_prm[@]:=prm[@][prm_num[@]-1];
+ save l_ngl_ref, r_ngl_ref;
+ numeric l_ngl_ref, r_ngl_ref;
+ l_ngl_ref=
+ if boxed[l_prm[@]]:
+ ngl_part sub_lmost_ppt[l_prm[@]]
+ else:
+ jdg[l_prm[@]].lng
+ fi;
+ r_ngl_ref=
+ if boxed[r_prm[@]]:
+ ngl_part sub_rmost_ppt[r_prm[@]]
+ else:
+ jdg[r_prm[@]].rng
+ fi;
+ if alg_sty[@]="l":
+ jdg[@].lng=l_ngl_ref;
+ elseif alg_sty[@]="c":
+ jdg[@].cng=(l_ngl_ref+r_ngl_ref)/2;
+ elseif alg_sty[@]="r":
+ jdg[@].rng=r_ngl_ref;
+ fi
+ nfr_lmost_ppt[@]:=(
+ jdg[@].rad,
+ tnum*min (tnum*jdg[@].lng, tnum*l_ngl_ref));
+ nfr_rmost_ppt[@]:=(
+ jdg[@].rad,
+ tnum*max (tnum*jdg[@].rng, tnum*r_ngl_ref));
+ fi
+ %
+ % inference line
+ %
+ save iln_ngl;
+ numeric iln_ngl;
+ iln_ngl:=2*(arc_angle(iln[@].rad,
+ jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]]) tnum)
+ +(ngl_part nfr_rmost_ppt[@])
+ -(ngl_part nfr_lmost_ppt[@]);
+ arc_init iln[@]
+ ((circ_path (iln[@].rad, iln_ngl) tnum) drv_styled iln_sty[@], iln_ngl);
+ iln[@].hg=iln_hg[iln_sty[@]];
+ iln[@].dp=iln_dp[iln_sty[@]];
+ iln[@].cng=((ngl_part nfr_lmost_ppt[@])+(ngl_part nfr_rmost_ppt[@]))/2;
+ if iln_sty[@]>0:
+ nfr_lmost_ppt[@]:=(iln[@].rad, iln[@].lng);
+ nfr_rmost_ppt[@]:=(iln[@].rad, iln[@].rng);
+ fi
+ %
+ % inference labels
+ %
+ if known l_ilb[@]:
+ arc_init l_ilb[@](
+ text_arc (l_ilb[@], l_ilb[@].rad) tnum,
+ arc_angle (l_ilb[@].rad, width l_ilb[@]) tnum);
+ l_ilb[@].rng=iln[@].lng
+ -arc_angle (l_ilb[@].rad, ilb_skp_scl*ilb_skp[drv_sty]) tnum;
+ nfr_lmost_ppt[@]:=(l_ilb[@].rad, l_ilb[@].lng);
+ fi
+ if known r_ilb[@]:
+ arc_init r_ilb[@](
+ text_arc (r_ilb[@], r_ilb[@].rad) tnum,
+ arc_angle (r_ilb[@].rad, width r_ilb[@]) tnum);
+ r_ilb[@].lng=iln[@].rng
+ +arc_angle (r_ilb[@].rad, ilb_skp_scl*ilb_skp[drv_sty]) tnum;
+ nfr_rmost_ppt[@]:=(r_ilb[@].rad, r_ilb[@].rng);
+ fi
+ %
+ % phantom steps
+ %
+ if known tgt[@]:
+ save phm_pct, src_rad, tgt_rad;
+ picture phm_pct;
+ numeric src_rad, tgt_rad;
+ src_rad:=min_rad[@]+min_clr_scl*min_clr[drv_sty]/2;
+ tgt_rad:=min_rad[tgt[@]];
+ phm_pct:=((0, (src_rad-tgt_rad)/2)--(0, (tgt_rad-src_rad)/2))
+ drv_styled phm_sty[@];
+ arc_init phm[@] (
+ phm_pct
+ rotated (tnum*90+arc_angle (phm[@].rad, (width phm_pct)/2) tnum)
+ shifted ((dir 0) scaled phm[@].rad),
+ arc_angle (phm[@].rad, width phm_pct) tnum);
+ phm[@].cng=jdg[@].cng;
+ nfr_lmost_ppt[@]:=lmost_ppt (nfr_lmost_ppt[@],
+ (phm[@].rad, phm[@].lng)) tnum;
+ nfr_rmost_ppt[@]:=rmost_ppt (nfr_rmost_ppt[@],
+ (phm[@].rad, phm[@].rng)) tnum;
+ %
+ % phantom steps labels
+ %
+ if known l_plb[@]:
+ arc_init l_plb[@](
+ text_arc (l_plb[@], l_plb[@].rad) tnum,
+ arc_angle (l_plb[@].rad, width l_plb[@]) tnum);
+ l_plb[@].rng=phm[@].lng
+ -arc_angle (l_plb[@].rad, plb_skp[drv_sty]) tnum;
+ nfr_lmost_ppt[@]:=
+ lmost_ppt(nfr_lmost_ppt[@], (l_plb[@].rad, l_plb[@].lng)) tnum;
+ fi
+ if known r_plb[@]:
+ arc_init r_plb[@](
+ text_arc (r_plb[@], r_plb[@].rad) tnum,
+ arc_angle (r_plb[@].rad, width r_plb[@]) tnum);
+ r_plb[@].lng=phm[@].rng
+ +arc_angle (r_plb[@].rad, plb_skp[drv_sty]) tnum;
+ nfr_rmost_ppt[@]:=
+ rmost_ppt(nfr_rmost_ppt[@], (r_plb[@].rad, r_plb[@].rng)) tnum;
+ fi
+ fi
+ %
+ % sub_lmost_ppt & sub_rmost_ppt
+ %
+ sub_lmost_ppt[@]:=nfr_lmost_ppt[@];
+ sub_rmost_ppt[@]:=nfr_rmost_ppt[@];
+ for prm_rnk=0 upto prm_num[@]-1:
+ sub_lmost_ppt[@]:=
+ lmost_ppt (sub_lmost_ppt[@], sub_lmost_ppt[prm[@][prm_rnk]]) tnum;
+ sub_rmost_ppt[@]:=
+ rmost_ppt (sub_rmost_ppt[@], sub_rmost_ppt[prm[@][prm_rnk]]) tnum;
+ endfor
+ %
+ % delimiters
+ %
+ if known l_dlb[@] or known r_dlb[@]:
+ save dlm_pct, minr, maxr;
+ picture dlm_pct;
+ numeric minr, maxr;
+ minr:=min_rad[@];
+ maxr:=max_rad[@];
+ if known l_dlb[@]:
+ dlm_pct:=delim l (maxr-minr);
+ arc_init l_dlm[@] (
+ dlm_pct
+ rotated (tnum*90+arc_angle (l_dlm[@].rad, (width dlm_pct)/2) tnum)
+ shifted ((dir 0) scaled l_dlm[@].rad),
+ arc_angle (l_dlm[@].rad, width dlm_pct) tnum);
+ l_dlm[@].rng=ngl_part sub_lmost_ppt[@];
+ arc_init l_dlb[@](
+ text_arc (l_dlb[@], l_dlb[@].rad) tnum,
+ arc_angle (l_dlb[@].rad, width l_dlb[@]) tnum);
+ l_dlb[@].rng=l_dlm[@].lng;
+ sub_lmost_ppt[@]:= (l_dlb[@].rad, l_dlb[@].lng);
+ fi
+ if known r_dlb[@]:
+ dlm_pct:=delim r (maxr-minr);
+ arc_init r_dlm[@] (
+ dlm_pct
+ rotated (tnum*90+arc_angle (r_dlm[@].rad, (width dlm_pct)/2) tnum)
+ shifted ((dir 0) scaled r_dlm[@].rad),
+ arc_angle (r_dlm[@].rad, width dlm_pct) tnum);
+ r_dlm[@].lng=ngl_part sub_rmost_ppt[@];
+ arc_init r_dlb[@](
+ text_arc (r_dlb[@], r_dlb[@].rad) tnum,
+ arc_angle (r_dlb[@].rad, width r_dlb[@]) tnum);
+ r_dlb[@].lng=r_dlm[@].rng;
+ sub_rmost_ppt[@]:=(r_dlb[@].rad, r_dlb[@].rng);
+ fi
+ fi
+ if (known l_dlb[@]) or boxed[@]:
+ save idx;
+ numeric idx;
+ idx:=@;
+ forever:
+ nfr_lmost_ppt[idx]:=sub_lmost_ppt[@];
+ exitif unknown l_prm[idx];
+ idx:=l_prm[idx];
+ endfor
+ fi
+ if (known r_dlb[@]) or boxed[@]:
+ save idx;
+ numeric idx;
+ idx:=@;
+ forever:
+ nfr_rmost_ppt[idx]:=sub_rmost_ppt[@];
+ exitif unknown r_prm[idx];
+ idx:=r_prm[idx];
+ endfor
+ fi
+enddef;
+
%
% Freezing
%
-vardef drv_freeze_root[]=
+vardef drv_box_freeze[]=
for prm_rnk=0 upto prm_num[@]-1:
- drv_freeze_root[prm[@][prm_rnk]];
+ drv_box_freeze[prm[@][prm_rnk]];
endfor
for sbj_rnk=0 upto sbj_num[@]-1:
box_freeze sbj[@][sbj_rnk];
@@ -1728,22 +2310,60 @@ vardef drv_freeze_root[]=
endfor
enddef;
+vardef drv_arc_freeze[]=
+ for prm_rnk=0 upto prm_num[@]-1:
+ drv_arc_freeze[prm[@][prm_rnk]];
+ endfor
+ for sbj_rnk=0 upto sbj_num[@]-1:
+ arc_freeze sbj[@][sbj_rnk];
+ endfor
+ forsuffixes sfx=
+ iln, jdg, phm,
+ l_dlb, l_dlm, l_ilb, l_plb,
+ r_dlb, r_dlm, r_ilb, r_plb:
+ if known sfx[@]:
+ arc_freeze sfx[@];
+ fi
+ endfor
+enddef;
+
vardef drv_freeze=
if not drv_checked:
drv_check;
fi
- save root_idx;
- numeric root_idx;
- for root_rnk=0 upto root_num-1:
- root_idx:=root[root_rnk];
- drv_build_root[root_idx];
+ save root_idx, tnum;
+ numeric root_idx, tnum;
+ %
+ % first root
+ %
+ root_idx:=root[0];
+ if drv_radialmode_on:
+ drv_rad_build[root_idx];
+ if unknown jdg[root_idx].rad:
+ jdg[root_idx].rad=10(num_hg-den_dp)/crv_scl;
+ fi
+ drv_ngl_build[root_idx];
+ tnum:=if bot_jdg[root_idx]: - fi 1; % turning number
+ if unknown jdg[root_idx].cng:
+ jdg[root_idx].cng=-tnum*azimuth_ngl;
+ fi
+ if unknown jdg[root_idx].org:
+ %
+ % default math axis
+ %
+ jdg[root_idx].org=
+ (dir -jdg[root_idx].cng) scaled (tnum*axis_hg[drv_sty]+
+ if drv_axis_ref="iln":
+ iln[root_idx].rad
+ else: % drv_axis_ref="jdg"
+ jdg[root_idx].rad
+ fi);
+ fi
+ drv_arc_freeze[root_idx];
+ else:
+ drv_lin_build[root_idx];
if unknown xpart jdg[root_idx].c:
- if root_rnk=0:
- xpart jdg[root_idx].c=0;
- else:
- sub_min_x[root_idx]=sub_max_x[root[root_rnk-1]]
- +prm_skp_scl*prm_skp[drv_sty];
- fi
+ xpart jdg[root_idx].c=0;
fi
if unknown ypart jdg[root_idx].c:
%
@@ -1755,8 +2375,64 @@ vardef drv_freeze=
ypart jdg[root_idx].c=axis_hg[drv_sty];
fi
fi
- drv_freeze_root[root_idx];
- endfor
+ drv_box_freeze[root_idx];
+ fi
+ %
+ % other roots
+ %
+ if drv_radialmode_on:
+ save l_rmost_rad, l_rmost_ngl, r_lmost_rad, r_lmost_ngl;
+ numeric l_rmost_rad, l_rmost_ngl, r_lmost_rad, r_lmost_ngl;
+ for root_rnk=1 upto root_num-1:
+ root_idx:=root[root_rnk];
+ drv_rad_build[root_idx];
+ if unknown jdg[root_idx].rad:
+ jdg[root_idx].rad=10(num_hg-den_dp)/crv_scl;
+ fi
+ drv_ngl_build[root_idx];
+ tnum:=if bot_jdg[root_idx]: - fi 1; % turning number
+ l_rmost_rad:=rad_part sub_rmost_ppt[root[root_rnk-1]];
+ l_rmost_ngl:=ngl_part sub_rmost_ppt[root[root_rnk-1]];
+ r_lmost_rad:=rad_part sub_lmost_ppt[root_idx];
+ r_lmost_ngl:=ngl_part sub_lmost_ppt[root_idx];
+ if unknown jdg[root_idx].cng:
+ r_lmost_ngl=l_rmost_ngl+
+ if bot_jdg[root_idx]=bot_jdg[root[root_rnk-1]]:
+ arc_angle (min (r_lmost_rad, l_rmost_rad),
+ prm_skp_scl*prm_skp[drv_sty]) tnum
+ else:
+ 180
+ fi;
+ fi
+ if unknown jdg[root_idx].org:
+ jdg[root_idx].org=
+ if bot_jdg[root_idx]=bot_jdg[root[root_rnk-1]]:
+ jdg[root[root_rnk-1]].org
+ else:
+ (dir l_rmost_ngl)
+ scaled jdg[root[root_rnk-1]].rad
+ shifted jdg[root[root_rnk-1]].org
+ shifted ((dir (l_rmost_ngl-tnum*90))
+ scaled (prm_skp_scl*prm_skp[drv_sty]))
+ shifted ((dir l_rmost_ngl) scaled jdg[root_idx].rad)
+ fi;
+ fi
+ drv_arc_freeze[root_idx];
+ endfor
+ else:
+ for root_rnk=1 upto root_num-1:
+ root_idx:=root[root_rnk];
+ drv_lin_build[root_idx];
+ if unknown xpart jdg[root_idx].c:
+ sub_min_x[root_idx]=sub_max_x[root[root_rnk-1]]
+ +prm_skp_scl*prm_skp[drv_sty];
+ fi
+ if unknown ypart jdg[root_idx].c:
+ ypart jdg[root_idx].c=ypart jdg[root[root_rnk-1]].c;
+ fi
+ drv_box_freeze[root_idx];
+ endfor
+ fi
drv_frozen:=true;
enddef;
@@ -1870,32 +2546,57 @@ vardef drv_tree=
enddef;
vardef drv_bbox[]=
- save min_x, max_x, mmy, min_y, max_y;
- pair mmy;
- numeric min_x, max_x, max_y, min_y;
if not drv_frozen:
drv_freeze;
fi
- min_x:=
- if known l_dlm[@].r:
- xpart l_dlm[@].r
- else:
- sub_min_x[@]
- fi-jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]];
- max_x:=
- if known r_dlm[@].l:
- xpart l_dlm[@].l
- else:
- sub_max_x[@]
- fi+jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]];
- mmy:=minmax_y[@];
- min_y:=xpart mmy;
- max_y:=ypart mmy;
- (min_x, min_y)--
- (min_x, max_y)--
- (max_x, max_y)--
- (max_x, min_y)--
- cycle
+ if drv_radialmode_on:
+ save l_ngl, r_ngl, tnum;
+ numeric l_ngl, r_ngl, tnum;
+ tnum:=if bot_jdg[@]: - fi 1; % turning number
+ l_ngl:=
+ if known l_dlm[@].rng:
+ l_dlm[@].rng-arc_angle
+ (l_dlm[@].rad, jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]]) tnum
+ else:
+ (ngl_part sub_lmost_ppt[@])-arc_angle
+ (rad_part sub_lmost_ppt[@],
+ jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]]) tnum
+ fi;
+ r_ngl:=
+ if known r_dlm[@].lng:
+ r_dlm[@].lng+arc_angle
+ (r_dlm[@].rad, jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]]) tnum
+ else:
+ (ngl_part sub_rmost_ppt[@])+arc_angle
+ (rad_part sub_rmost_ppt[@],
+ jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]]) tnum
+ fi;
+ (circ_path(max_rad[@], r_ngl-l_ngl) tnum--
+ reverse circ_path(min_rad[@], r_ngl-l_ngl) tnum--
+ cycle) rotated l_ngl shifted jdg[@].org
+ else:
+ save minx, maxx, miny, maxy;
+ numeric minx, maxx, maxy, miny;
+ minx:=
+ if known l_dlm[@].r:
+ xpart l_dlm[@].r
+ else:
+ sub_min_x[@]
+ fi-jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]];
+ maxx:=
+ if known r_dlm[@].l:
+ xpart l_dlm[@].l
+ else:
+ sub_max_x[@]
+ fi+jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]];
+ miny:=min_y[@];
+ maxy:=max_y[@];
+ (minx, miny)--
+ (minx, maxy)--
+ (maxx, maxy)--
+ (maxx, miny)--
+ cycle
+ fi
enddef;
vardef mth_axis @# (suffix ref_sfx) (expr idx)=
@@ -1986,6 +2687,25 @@ vardef check_position_left (suffix pos_sfx) (expr default)=
fi
enddef;
+vardef check_position_bot (suffix pos_sfx) (expr default)=
+ save pos_str;
+ string pos_str;
+ pos_str:=str pos_sfx;
+ if pos_str="t":
+ false
+ elseif pos_str="b":
+ true
+ else:
+ begingroup
+ drv_errhelp "Valid identifiers are"&
+ " t (top) and"&
+ " b (bottom).";
+ drv_errmessage (pos_str&" is not a valid root position identifier");
+ default
+ endgroup
+ fi
+enddef;
+
vardef check_mode_on (suffix status_sfx) (expr default)=
save status_str;
string status_str;
@@ -2027,7 +2747,7 @@ vardef drv_math_style (suffix typ_sfx) (expr sty_str)=
else:
forsuffixes sfx=scantokens (typ_str&"_sty"):
for idx=0 upto 3:
- sfx[idx]:=min(idx+sty_idx, 3);
+ sfx[idx]:=min (idx+sty_idx, 3);
endfor
endfor
fi
@@ -2046,12 +2766,15 @@ vardef drv_scale (suffix scl_sfx) (expr scl)=
jdg_skp_scl:=scl;
elseif (scl_str="ilb") or (scl_str="lbl"): % "lbl" is deprecated
ilb_skp_scl:=scl;
+ elseif scl_str="crv":
+ crv_scl:=scl;
else:
drv_errhelp "Valid identifiers are"&
" clr,"&
" prm,"&
- " jdg and"&
- " ilb.";
+ " jdg,"&
+ " ilb and"&
+ " crv.";
drv_errmessage (scl_str&" is not a valid scale identifier");
fi
enddef;
@@ -2104,19 +2827,7 @@ vardef drv_labels_position text ARG=
enddef;
vardef drv_roots_position suffix pos_sfx=
- save pos_str;
- string pos_str;
- pos_str:=str pos_sfx;
- if pos_str="t":
- drv_bot_roots:=false;
- elseif pos_str="b":
- drv_bot_roots:=true;
- else:
- drv_errhelp "Valid identifiers are"&
- " t (top) and"&
- " b (bottom).";
- drv_errmessage (pos_str&" is not a valid root position identifier");
- fi
+ drv_bot_roots:=check_position_bot (pos_sfx) (drv_bot_roots);
enddef;
vardef drv_axis_reference suffix ref_sfx=
@@ -2161,6 +2872,14 @@ vardef drv_proof_mode suffix status_sfx=
drv_proofmode_on:=check_mode_on (status_sfx, drv_proofmode_on);
enddef;
+vardef drv_radial_mode suffix status_sfx=
+ drv_radialmode_on:=check_mode_on (status_sfx, drv_radialmode_on);
+enddef;
+
+vardef drv_azimuth expr ngl=
+ azimuth_ngl:=ngl;
+enddef;
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -2192,6 +2911,10 @@ drv_box_mode off;
drv_fraction_mode on;
drv_proof_mode off;
+drv_radial_mode off;
+drv_scale (crv, 1);
+drv_azimuth 90;
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%