首页 pstrick

pstrick

举报
开通vip

pstrick PSTricks pst-coil Special node connections v.1.03 February 1, 2010 Documentation by Package author(s): Herbert Voß Timothy Van Zandt Herbert Voß Coils, springs and zigzag curves do not really count to the ordinary when creating graphics. They are of...

pstrick
PSTricks pst-coil Special node connections v.1.03 February 1, 2010 Documentation by Package author(s): Herbert Voß Timothy Van Zandt Herbert Voß Coils, springs and zigzag curves do not really count to the ordinary when creating graphics. They are of some importance though when dealing with the creation of coilish connections. They can also be used for node connections which will be shown at the end of this chapter. The parameters especially for the coil variants are only easy to understand when keeping in mind that three dimensional helixes are dealt with, which are only projected onto the two dimensional paper plane. This will be elaborated on at the corresponding places. Thanks to: Marco Daniel, Denis Girou, Uwe Siart. Contents 3 Contents 1 Parameters 4 1.1 coilwidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2 coilheight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.3 coilarm, coilarmA and coilarmB . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.4 coilaspect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.5 coilinc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.6 ppoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.7 periods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.8 amplitude . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.9 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2 Makros 9 2.1 \pscoil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2 \psCoil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.3 \pszigzag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3 Node connections 10 4 List of all optional arguments for pst-coil 12 References 12 1.1 coilwidth 4 1 Parameters Table 1 shows a compilation of the special parameters valid for pst-coil. Table 1: Compilation of all parameters for pst-coil name value default coilwidth 1cm coilheight 1 coilarm 0.5cm coilarmA 0.5cm coilarmB 0.5cm coilaspect 45 coilinc 45 periods 1 amplitude 1 function sin ppoints 360 1.1 coilwidth coilwidth denotes the diameter of the coil resp. the height of a zigzag line. The diame- ter corresponds to the height with a perpendicular parallel projection transverse to the length. coilwidth 0.75cm 0.50cm 0.25cm 0.50cm coilwidth 0.75cm 0.50cm 0.25cm 0.50cm 1 \begin{pspicture}(0,-5)(5,5) 2 \pscoil(0,4)(3.5,4) 3 {\psset{linewidth=0.2pt} 4 \psline[arrowscale=2,tbarsize=3mm]{|<->|}(4.5,3.5) (4.5,4.5) 5 \psline[linestyle=dashed](3.25,4.5)(4.5,4.5) 6 \psline[linestyle=dashed](2.75,3.5)(4.5,3.5)} 7 \uput*[0](3.5,4){coilwidth} 8 \pscoil[coilwidth=0.75cm](0,2.6)(3.6,2.6) 9 \uput*[0](3.5,2.6){0.75cm} 10 \pscoil[coilwidth=0.5cm](0,1.8)(3.5,1.8) 11 \uput*[0](3.5,1.8){0.50cm} 12 \pscoil[coilwidth=0.25cm](0,1.2)(3.5,1.2) 13 \uput*[0](3.5,1.2){0.25cm} 14 \pscoil*[coilwidth=0.5cm](0,0.5)(3.5,0.5) 15 \uput*[0](3.5,0.5){0.50cm} 16 % zigzag 17 \pszigzag(0,-4)(3.5,-4) 18 19 [ ... ] 1.2 coilheight 5 1.2 coilheight coilheight is in contrast to coilwidth no length but only a factor, whereat the distance between two windings resp. jags is composed as follows: dx = coilheight · coilwidth (1) As can be seen in the following example, not the same physical distance is yielded. This is caused by the internal three dimensional representation of the coil; it is not seen under an angle of 90◦ but 45◦. (Section 1.4) coilheight×coilwidth coilwidth 0.75 0.50 1.25 0.50 1 \begin{pspicture}(0,-4)(5,5) 2 \pscoil(0,4)(3.5,4) 3 {\psset{linewidth=0.2pt} 4 \psline[arrowscale=2,tbarsize=3mm]{|<->|}(4.5,3.5) (4.5,4.5) 5 \psline[linestyle=dashed](3.25,4.5)(4.5,4.5) 6 \psline[linestyle=dashed](2.75,3.5)(4.5,3.5) 7 \psline[arrowscale=2,tbarsize=3mm]{|<->|}(1.75,3.2) (2.5,3.2) 8 \uput[-90](2.15,3){\footnotesize\texttt{coilheight $\times$coilwidth}}} 9 \uput*[0](3.5,4){coilwidth} 10 \pscoil[coilheight=0.75](0,1.5)(3.6,1.5) 11 \uput*[0](3.5,1.5){0.75} 12 \pscoil[coilheight=0.5](0,0)(3.5,0) 13 \uput*[0](3.5,0){0.50} 14 \pscoil[coilheight=1.25](0,-1.5)(3.5,-1.5) 15 \uput*[0](3.5,-1.5){1.25} 16 \pscoil*[coilheight=0.5](0,-3)(3.5,-3) 17 \uput*[0](3.5,-3){0.50} 18 \end{pspicture} 1.3 coilarm, coilarmA and coilarmB 6 coilheight×coilwidth coilwidth 0.75 0.50 1.25 0.50 1 \begin{pspicture}(0,-4)(5,5) 2 \pszigzag(0,4)(3.5,4) 3 { \psset{linewidth=0.2pt} 4 \psline[arrowscale=2,tbarsize=3mm]{|<->|}(4.5,3.5) (4.5,4.5) 5 \psline[linestyle=dashed](2.5,4.5)(4.5,4.5) 6 \psline[linestyle=dashed](2.75,3.5)(4.5,3.5) 7 \psline[arrowscale=2,tbarsize=3mm]{|<->|}(1.75,3.2) (2.75,3.2) 8 \uput[-90](2.15,3){\footnotesize\texttt{coilheight $\times$coilwidth}} } 9 \uput*[0](3.5,4){coilwidth} 10 \pszigzag[coilheight=0.75](0,1.5)(3.6,1.5) 11 \uput*[0](3.5,1.5){0.75} 12 \pszigzag[coilheight=0.5](0,0)(3.5,0) 13 \uput*[0](3.5,0){0.50} 14 \pszigzag[coilheight=1.25](0,-1.5)(3.5,-1.5) 15 \uput*[0](3.5,-1.5){1.25} 16 \pszigzag*[coilheight=0.5](0,-3)(3.5,-3) 17 \uput*[0](3.5,-3){0.50} 18 \end{pspicture} 1.3 coilarm, coilarmA and coilarmB coilarm, coilarmA, and coilarmB denotes the part of a straight line made left and right. Negative values are possible, but do not make a lot of sense as a rule. As can be gathered from the example, the coil is lenghtened by a negative value in this case, so that the part of a straight line is led back to the specified starting point resp. endpoint and consequently has a negative “direction”. This parameter is not available for \psCoil. 1 \begin{pspicture}(4,4.5) 2 \pscoil(0,4)(4,4) 3 \psset{coilwidth=0.5} 4 \pscoil[coilarm=0](0,3)(4,3) 5 \pscoil[coilarmA=1cm,coilarmB=0.2cm](0,2)(4,2) 6 \pscoil[coilarm=-10pt](0,1)(4,1) 7 \end{pspicture} 1 \begin{pspicture}(4,4.5) 2 \pszigzag(0,4)(4,4) 3 \psset{coilwidth=0.5} 4 \pszigzag[coilarm=0](0,3)(4,3) 5 \pszigzag[coilarmA=1cm,coilarmB=0.2cm](0,2)(4,2) 6 \pszigzag[coilarm=-10pt](0,1)(4,1) 7 \end{pspicture} 1.4 coilaspect 7 1.4 coilaspect In Section 1.2 the three dimensional representation of the coil has been pointed out already. If it was regarded right-angled to its axis, the windings would not be recogniz- able. With coilaspect this “perspective” can be influenced, which is only possible for the “coil” variants of course. coilaspect=0 yields a sine curve. 1 \begin{pspicture}(4,4.5) 2 \pscoil(0,4)(4,4) 3 \psset{coilwidth=0.75} 4 \pscoil[coilaspect=0](0,3)(4,3) 5 \pscoil[coilaspect=30,coilheight=0.3](0,2)(4,2) 6 \pscoil[coilaspect=-30,coilheight=0.3](0,1)(4,1) 7 \end{pspicture} 1.5 coilinc The curve is drawn with the lineto procedure of PostScript , whereat coilinc spec- ifies the rotation angle in the angular measure at which the next point is calculated. It has already been mentioned that the calculation is done as a three dimensional coil and is projected onto the two dimensional plane only in the end. coilinc does also not make sense for zigzag lines, so that this parameter again only is available for the coil variant. Large angles result in a polygon line, small angles in harmonic progressions with increased calculation effort. 1 \begin{pspicture}(4,4.5) 2 \psset{coilwidth=0.8} 3 \pscoil(0,4)(4,4) 4 \psset{coilinc=0} 5 \pscoil[coilinc=5](0,3)(4,3) 6 \pscoil[coilinc=30](0,2)(4,2) 7 \pscoil[coilinc=60](0,1)(4,1) 8 \end{pspicture} 1.6 ppoints By default a line or node connection divides the total length into 360 segments. This should be increased for long distances or a large number of periodss. 1 \begin{pspicture}(5,2) 2 \pssin[ppoints=2000, 3 periods=30](0,1)(5,1) 4 \end{pspicture} 1.7 periods 8 1.7 periods The line from A to B is plotted by default as one period, which is the same as the relative periods=1. A setting of periods=3.3 plots the function 3.3 times for the given length. 1 \begin{pspicture}(5,2) 2 \pssin[linecolor=blue](0,1)(5,1) 3 \pssin[periods=3.3](0,1)(5,1) 4 \end{pspicture} A value without an unit for the period is always relative, with an unit it will be an absolute value. 0 1 2 0 1 2 3 4 1 \begin{pspicture}(5,2) 2 \psaxes(5mm,0)(4.5,2) 3 \psset{coilarm=5mm} 4 \pssin[linecolor=blue](0,1)(5,1) 5 \pssin[periods=1cm](0,1)(5,1) 6 \pssin[periods=2cm,linestyle=dashed](0,1)(5,1) 7 \end{pspicture} With a star as prefix the absolute value will be rounded to get an integer number of periods. 0 1 2 0 1 2 3 4 1 \begin{pspicture}(5,2) 2 \psset{coilarm=5mm} 3 \psaxes(5mm,0)(4.5,2) 4 \pssin[periods=1.1cm,linestyle=dotted, 5 linecolor=red](0,1)(5,1) 6 \pssin[periods=*1.1cm,linecolor=red](0,1)(5,1) 7 \pssin[periods=2.2cm,linestyle=dotted, 8 linecolor=blue](0,1)(5,1) 9 \pssin[periods=*2.2cm,linecolor=blue](0,1)(5,1) 10 \end{pspicture} 1.8 amplitude As usual the amplitude is the maximum of the plotted curve and preset to \psyunit, eg 1cm. 1 \begin{pspicture}(5,2) 2 \pssin[linecolor=blue](0,1)(5,1) 3 \pssin[amplitude=0.5, 4 linecolor=red](0,1)(5,1) 5 \end{pspicture} 1.9 function By default the curve is plotted as y = sin(x), The optional argument function allows to define any other object in PostScript notation. The value of the variable x is already on the stack! The following example plots the defualt curve and one with the function y = cos(x · sin(x)): 2 Makros 9 1 \begin{pspicture}(\linewidth,2) 2 \pssin[linecolor=blue](0,1)(\linewidth,1) 3 \pssin[function=dup sin mul cos, 4 linecolor=red,ppoints=10000, 5 periods=6](0,1)(\linewidth,1) 6 \end{pspicture} 2 Makros pst-coil defines three macros, which make the creation of coil or zigzag shaped lines possible. \pscoil * [Options] {arrows} (x0,y0) (x1,y1) \psCoil * [Options] {angle1}{angle2} \pszigzag * [Options] {arrows} (x0,y0) (x1,y1) \pssin * [Options] {arrows} (x0,y0) (x1,y1) • If only one coordinate pair is specified, the first point is automatically set to the origin of ordinates (0, 0). • Arrows may be set with the own parameter or with the optional parameter with arrows=<...-...>. • For \psCoil the coils are principally drawn without “arms”. The asterisk version are in principle pointless, since they do not allow a meaningful representation. Some could be seen with the description of parameters, but will not be described further in the following. 2.1 \pscoil Since \pscoil is nothing else than a polygon line, also all parameters are available which apply for lines. 1 \begin{pspicture}(4,4) 2 \pscoil[coilarm=.5cm,linewidth=1.5pt,coilwidth=.5cm ]{|->}(4,3) 3 \pscoil[linecolor=red,coilheight=0.25](3,4)(3,1) 4 \pscoil[doubleline=true,linecolor=cyan,coilheight =0.75](0,4)(3,0) 5 \end{pspicture} 2.2 \psCoil 10 2.2 \psCoil \psCoil draws starting at the current point to the angle α an invisible line and then from α to β a helix. \rput has to be used if they are to be placed at a particular position. The advantage is that with \psCoil the number of helixes to draw can be specified exactly. 1 \begin{pspicture}(4,4) 2 \psCoil[linewidth=1.5pt,coilwidth=.5cm]{1800}{3600} 3 \rput{-90}(3,4){\psCoil[linecolor=red,coilheight =0.25]{0}{3600}} 4 \rput{-45}(0,3.5){\psCoil[doubleline=true,linecolor=cyan ,coilheight=0.75]{100}{2700}} 5 \end{pspicture} 2.3 \pszigzag This macro represents the two dimensional variant and is correspondly easy to use. Es- pecially the linearc option can bring good results for \pszigzag. The specification of the “arm length” is not absolute here, since the line is principally ended in the geomet- rical middle and then led to the specified arm length. 1 \begin{pspicture}(4,4) 2 \pszigzag[coilarm=.5cm,linewidth=1.5pt,coilwidth=.5cm ]{|->}(4,3) 3 \pszigzag[linecolor=red,coilheight=0.2](3,4)(3,1) 4 \pszigzag[doubleline=true,linecolor=cyan,coilheight =0.75](0,4)(3,0) 5 \end{pspicture} 3 Node connections Prerequisite for this macro is that pst-node is loaded, then the following node connec- tions are available: \nccoil * [Options] {arrows} {nodeA}{nodeB} \nczigzag * [Options] {arrows} {nodeA}{nodeB} \pccoil * [Options] {arrows} {nodeA}{nodeB} \pczigzag * [Options] {arrows} {nodeA}{nodeB} \ncsin * [Options] {arrows} {nodeA}{nodeB} \pcsin * [Options] {arrows} {nodeA}{nodeB} 3 Node connections 11 1 \begin{pspicture}(4,3) 2 \pnode(0.5,0.5){A} 3 \pnode(3.5,2.5){B} 4 \ncsin{<->}{A}{B} 5 \end{pspicture} 1 \begin{pspicture}(5,2) 2 \pnode(0,1){A} 3 \pnode(5,1){B} 4 \ncsin[amplitude=0.5,periods=30,coilarm=5pt, 5 function=dup 0.1 mul sin exch sin add]{A}{B} 6 \end{pspicture} Th other connections behave completely analogue to those dealt with the package pst-node so that no further explanations are needed here. References 12 4 List of all optional arguments for pst-coil Key Type Default coilwidth ordinary 1cm coilheight ordinary 1 coilarmA ordinary 0.5cm coilarmB ordinary 0.5cm coilarm ordinary 0.5cm coilaspect ordinary 45 coilinc ordinary 10 periods ordinary 1 amplitude ordinary 1 ppoints ordinary 360 function ordinary sin References [1] Denis Girou. Présentation de PSTricks. Cahier GUTenberg, 16:21–70, April 1994. [2] Michel Goosens, Frank Mittelbach, Sebastian Rahtz, Dennis Roegel, and Herbert Voß. The LATEX Graphics Companion. Addison-Wesley Publishing Company, Boston, Mass., second edition, 2007. [3] Nikolai G. Kollock. PostScript richtig eingesetzt: vom Konzept zum praktischen Einsatz. IWT, Vaterstetten, 1989. [4] Herbert Voß. PSTricks – Grafik für TEX und LATEX. DANTE – Lehmanns, Heidel- berg/Hamburg, fifth edition, 2008. [5] Timothy Van Zandt. multido.tex - a loop macro, that supports fixed-point addition. CTAN:/macros/generic/multido.tex, 1997. [6] Timothy Van Zandt and Denis Girou. Inside PSTricks. TUGboat, 15:239–246, September 1994. Index amplitude, 4, 8 arrows, 9 coil, 4 coil, 7 coilarm, 4, 6 coilarmA, 4, 6 coilarmB, 4, 6 coilaspect, 4, 7 coilheight, 4, 5 coilinc, 4, 7 coilwidth, 4, 5 diameter, 4 function, 4, 8 Keyword amplitude, 4, 8 arrows, 9 coil, 7 coilarm, 4, 6 coilarmA, 4, 6 coilarmB, 4, 6 coilaspect, 4, 7 coilheight, 4, 5 coilinc, 4, 7 coilwidth, 4, 5 function, 4, 8 linearc, 10 periods, 4, 8 ppoints, 4 linearc, 10 lineto, 7 Macro \nccoil*, 10 \ncsin*, 10 \nczigzag*, 10 \pccoil*, 10 \pcsin*, 10 \pczigzag*, 10 \psCoil*, 9 \psCoil, 6, 9, 10 \pscoil*, 9 \pscoil, 9 \pssin*, 9 \psyunit, 8 \pszigzag*, 9 \pszigzag, 10 \rput, 10 \nccoil*, 10 \ncsin*, 10 \nczigzag*, 10 Package pst-coil, 4, 9 pst-node, 10, 11 \pccoil*, 10 \pcsin*, 10 \pczigzag*, 10 periods, 4, 8 PostScript lineto, 7 ppoints, 4 \psCoil, 6, 9, 10 \pscoil, 9 \psCoil*, 9 \pscoil*, 9 \pssin*, 9 pst-coil, 4, 9 pst-node, 10, 11 \psyunit, 8 \pszigzag, 10 \pszigzag*, 9 \rput, 10 three dimensional representation, 5 winding, 5 zigzag line, 4, 9 13 Parameters coilwidth coilheight coilarm, coilarmA and coilarmB coilaspect coilinc ppoints periods amplitude function Makros \pscoil \psCoil \pszigzag Node connections List of all optional arguments for pst-coil References
本文档为【pstrick】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_232005
暂无简介~
格式:pdf
大小:265KB
软件:PDF阅读器
页数:0
分类:互联网
上传时间:2013-07-18
浏览量:15