class DRAWKNOT_TEX_ALG
****
Convert knot diagram to Tpic graphic data for plainTeX, AmS-TeX, LaTex, or pstricks for LaTeX.

I assume as follows in this version. Use 'mm' as a unit length. Diagram is scaled into the box of (width,height) with margin of 'margin'.

(xofs(mm),yofs(mm)) is offset from top-left in LaTeX picture.

To use this, copy to LaTeX file as picture environment. top-left is origin of LaTeX/picture and tpic. But, note their direction. picture: right to positive, under to negative tpic : right to positive, under to positive In tpic , unit length is 1/1000 in.


Flattened version is here



Public


Readonly Shareds
shared widthTeX,heightTeX:FLT;
**** size of picture
shared kxmin, kxmax, kymin, kymax, kwidth:INT;
****
shared kxmin, kxmax, kymin, kymax, kwidth:INT;
****
shared kxmin, kxmax, kymin, kymax, kwidth:INT;
****
shared kxmin, kxmax, kymin, kymax, kwidth:INT;
****
shared kxmin, kxmax, kymin, kymax, kwidth:INT;
****
shared mode:CARD;
**** 1: tpic, 2:pstricks
shared scale:FLT;
**** scaling
shared widthTeX,heightTeX:FLT;
**** size of picture
shared xofsTP, yofsTP:FLT;
**** (left,top) of knot
shared xofsTP, yofsTP:FLT;
**** (left,top) of knot

Writable Shareds
shared widthTeX,heightTeX:FLT;
**** size of picture
shared kxmin, kxmax, kymin, kymax, kwidth:INT;
****
shared kxmin, kxmax, kymin, kymax, kwidth:INT;
****
shared kxmin, kxmax, kymin, kymax, kwidth:INT;
****
shared kxmin, kxmax, kymin, kymax, kwidth:INT;
****
shared kxmin, kxmax, kymin, kymax, kwidth:INT;
****
shared mode:CARD;
**** 1: tpic, 2:pstricks
shared scale:FLT;
**** scaling
shared widthTeX,heightTeX:FLT;
**** size of picture
shared xofsTP, yofsTP:FLT;
**** (left,top) of knot
shared xofsTP, yofsTP:FLT;
**** (left,top) of knot

Features
DrawKnotPic(Knot:KNOT, width, height, margin:INT, scalingMode:CARD)
DrawKnotPic(Knot:KNOT, width, height, margin:INT, scalingMode:CARD,smoothDraw:BOOL,latexMode:CARD)
****
__width,_height,_margin_:_unit_length_1mm
JIS standard fat line : 0.3-0.8mm medium line : 0.2-0.4mm thin line : <0.2mm
SetScale(Knot:KNOT, width, height, margin:INT, scalingMode:CARD)
arrowPic(x0, y0, x1, y1:INT)
**** Draw arrow at the center of pt.0 and pt.1
circle(x, y, r:INT, incol:STR)
flush(inout Bridge:KNOT,smoothDraw:BOOL)
setCol(col:STR, w:CARD)
**** set line color/width
setPa(x, y:INT)
spc:STR
**** TeX special command.
unitLen:FLT
**** Note that unit length of tpic is 0.001in = 0.001*25.4mm.
xposTP(x:INT):STR
yposTP(y:INT):STR

The Sather Home Page