diff options
author | Karl Berry <karl@freefriends.org> | 2010-12-19 00:31:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-12-19 00:31:06 +0000 |
commit | 4836b219399bf031cee7c22265f48c76db68facc (patch) | |
tree | a69dd2c79c78e01de4b07f46d0b9808336c8e7d6 /Master/texmf-dist/tex/generic/pstricks-add | |
parent | a3486a2d404fca82e9fc0db0a72c7d61efe4824b (diff) |
pstricks-add (18dec10)
git-svn-id: svn://tug.org/texlive/trunk@20794 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pstricks-add')
-rw-r--r-- | Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex | 185 |
1 files changed, 171 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex index 3d2a9e33c44..1505289d7ed 100644 --- a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex +++ b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex @@ -1,4 +1,4 @@ -%% $Id: pstricks-add.tex 431 2010-12-13 10:53:46Z herbert $ +%% $Id: pstricks-add.tex 439 2010-12-18 18:45:23Z herbert $ %% %% %% This is file `pstricks-add.tex', @@ -31,8 +31,8 @@ \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi \ifx\PSTmathLoaded\endinput\else \input pst-math \fi % -\def\fileversion{3.46} -\def\filedate{2010/12/13} +\def\fileversion{3.48} +\def\filedate{2010/12/18} \message{`pstricks-add' v\fileversion, \filedate\space (dr,hv)} % \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax @@ -2027,40 +2027,197 @@ dup #1Delta.X m 1 add get mul #1.X m get add #1Tick.X j 3 -1 roll put % s on sta \endgroup% } % +\newcount\psVectorCtr \define@boolkey[psset]{pstricks-add}[Pst@]{markAngle}[true]{} \psset[pstricks-add]{markAngle=false} \newpsstyle{psMarkAngleStyle}{arrows=->,arrowsize=4pt} \newpsstyle{psMarkAngleLineStyle}{linestyle=dotted,arrows=-} % -\def\psStartPoint(#1){\pst@getcoor{#1}\pst@tempA +\def\psStartPoint{\@ifnextchar[{\psStartPoint@i}{\psStartPoint@i[Vector]}} +\def\psStartPoint@i[#1](#2){% + \global\psVectorCtr=\@ne + \gdef\psVectorName{#1} + \pnode(#2){#10} + \pst@getcoor{#2}\pst@tempA% \pstVerb{tx@Dict begin \pst@tempA \pst@number\psyunit div /cp.Y exch def - \pst@number\psxunit div /cp.X exch def end - }} -\psStartPoint(0,0) + \pst@number\psxunit div /cp.X exch def end }} % -\def\psVector{\@ifnextchar[\psVector@i{\psVector@i[]}} -\def\psVector@i[#1](#2){% +\def\psVector{\pst@object{psVector}} +\def\psVector@i(#1){% \pst@killglue% - \pst@getcoor{#2}\pst@tempCoor% + \pst@getcoor{#1}\pst@tempCoor% + \addbefore@par{arrows=->,arrowsize=6pt}% \begingroup - \psset{arrows=->,arrowsize=6pt,#1}% + \use@par% \rput(! cp.X cp.Y ){% - \psline(0,0)(#2)% + \psline(0,0)(#1)% \ifPst@markAngle \psarc[style=psMarkAngleStyle](0,0){1}{0}{!\pst@tempCoor exch atan}% \psline[style=psMarkAngleLineStyle](1.5,0)% \fi}% + \pnode(! \pst@tempCoor \pst@number\psyunit div cp.Y add exch + \pst@number\psxunit div cp.X add exch ){\psVectorName\the\psVectorCtr}% + \global\advance\psVectorCtr by \@ne% \endgroup% - \pstVerb{tx@Dict begin + \pst@Verb{%tx@Dict begin \pst@tempCoor \pst@number\psyunit div cp.Y add /cp.Y exch def - \pst@number\psxunit div cp.X add /cp.X exch def end + \pst@number\psxunit div cp.X add /cp.X exch def %end }% \ignorespaces% } % +\def\psCircleTangents(#1){\@ifnextchar({\psCircleTangents@i(#1)}{\psCircleTangents@ii(#1)}} +\def\psCircleTangents@i(#1)(#2)#3{% point circle radius + \pst@killglue% + \begingroup% + \pst@getcoor{#1}\pst@CoorA% point + \pst@getcoor{#2}\pst@CoorB% circle + \pst@getlength{#3}\pst@LengthA% radius + \pst@Verb{ + 50 dict begin + \pst@CoorA \pst@number\psyunit div /Y1 ED % point + \pst@number\psxunit div /X1 ED + \pst@CoorB \pst@number\psyunit div /Y2 ED % circle + \pst@number\psxunit div /X2 ED + Y2 Y1 sub X2 X1 sub atan /Alpha ED + X1 Y1 X2 Y2 Pyth2 /distance ED + /m Alpha tan def + \pst@LengthA \pst@number\psrunit div /r1 ED +% we have the intersectionpoint of the inner tangents + /tangentAngle r1 distance div asin def + /negAngle Alpha tangentAngle sub def + /m2 negAngle tan def + /b Y1 m2 X1 mul sub def +% + /Z Y1 m2 X1 mul sub Y2 sub def + /k1 2 X2 mul 2 m2 mul Z mul sub 1 m2 dup mul add div neg def + k1 neg 2 div /x1 ED + /y1 m2 x1 mul b add def + /xS m X1 mul Y1 sub x1 m div add y1 add m 1 m div add div def + /yS m xS X1 sub mul Y1 add def + /x2 x1 2 xS x1 sub mul add def + /y2 y1 2 yS y1 sub mul add def +% + tx@NodeDict begin + { x1 \pst@number\psxunit mul y1 \pst@number\psyunit mul } false + /N@CircleT1 10 { InitPnode } NewNode + { x2 \pst@number\psxunit mul y2 \pst@number\psyunit mul } false + /N@CircleT2 10 { InitPnode } NewNode + end + end + }% + \endgroup% + \ignorespaces% +} +\def\psCircleTangents@ii(#1)#2(#3)#4{% two circles + \pst@killglue% + \begingroup% + \pst@getcoor{#1}\pst@CoorA% + \pst@getlength{#2}\pst@LengthA% + \pst@getcoor{#3}\pst@CoorB% + \pst@getlength{#4}\pst@LengthB% + \pst@Verb{ + 50 dict begin + \pst@CoorA \pst@number\psyunit div /Y1 ED + \pst@number\psxunit div /X1 ED + \pst@CoorB \pst@number\psyunit div /Y2 ED + \pst@number\psxunit div /X2 ED + Y2 Y1 sub X2 X1 sub atan /Alpha ED + X1 Y1 X2 Y2 Pyth2 /distance ED + /m Alpha tan def + \pst@LengthA \pst@number\psrunit div /r1 ED + \pst@LengthB \pst@number\psrunit div /r2 ED + distance r1 r1 r2 add div mul /d1 ED + d1 Alpha sin mul Y1 add /YQI ED + d1 Alpha cos mul X1 add /XQI ED + tx@NodeDict begin + { XQI \pst@number\psxunit mul YQI \pst@number\psyunit mul } false + /N@CircleTC1 10 { InitPnode } NewNode + end + /d2 distance d1 sub def +% we have the intersectionpoint of the inner tangents + /tangentAngle r2 d2 div asin def + /negAngle Alpha tangentAngle sub def + /m2 negAngle tan def + /b YQI m2 XQI mul sub def +% + /Z YQI m2 XQI mul sub Y2 sub def + /k1 2 X2 mul 2 m2 mul Z mul sub 1 m2 dup mul add div neg def + k1 neg 2 div /x1I ED + /y1I m2 x1I mul b add def + /xS m XQI mul YQI sub x1I m div add y1I add m 1 m div add div def + /yS m xS XQI sub mul YQI add def + /x2I x1I 2 xS x1I sub mul add def + /y2I y1I 2 yS y1I sub mul add def +% + /Z YQI m2 XQI mul sub Y1 sub def + /k1 2 X1 mul 2 m2 mul Z mul sub 1 m2 dup mul add div neg def + k1 neg 2 div /x1aI ED + /y1aI m2 x1aI mul b add def + /xS m XQI mul YQI sub x1aI m div add y1aI add m 1 m div add div def + /yS m xS XQI sub mul YQI add def + /x2aI x1aI 2 xS x1aI sub mul add def + /y2aI y1aI 2 yS y1aI sub mul add def + tx@NodeDict begin + { x1aI \pst@number\psxunit mul y1aI \pst@number\psyunit mul } false + /N@CircleTI1 10 { InitPnode } NewNode + { x1I \pst@number\psxunit mul y1I \pst@number\psyunit mul } false + /N@CircleTI2 10 { InitPnode } NewNode + { x2aI \pst@number\psxunit mul y2aI \pst@number\psyunit mul } false + /N@CircleTI3 10 { InitPnode } NewNode + { x2I \pst@number\psxunit mul y2I \pst@number\psyunit mul } false + /N@CircleTI4 10 { InitPnode } NewNode + end +% + /d1 distance r2 r1 div 1 sub div def + /tangentAngle r1 d1 div asin def + /negAngle Alpha tangentAngle sub def + /m2 negAngle tan def + /YQO Y1 d1 Alpha sin mul sub def + /XQO X1 d1 Alpha cos mul sub def + tx@NodeDict begin + { XQO \pst@number\psxunit mul YQO \pst@number\psyunit mul } false + /N@CircleTC2 10 { InitPnode } NewNode + end + % we have the new central point + /b YQO m2 XQO mul sub def + /Z YQO m2 XQO mul sub Y1 sub def + /k1 2 X1 mul 2 m2 mul Z mul sub 1 m2 dup mul add div neg def + k1 neg 2 div /x1O ED + /y1O m2 x1O mul b add def + /xS m XQO mul YQO sub x1O m div add y1O add m 1 m div add div def + /yS m xS XQO sub mul YQO add def + /x2O x1O 2 xS x1O sub mul add def + /y2O y1O 2 yS y1O sub mul add def +% + /Z YQO m2 XQO mul sub Y2 sub def + /k1 2 X2 mul 2 m2 mul Z mul sub 1 m2 dup mul add div neg def + k1 neg 2 div /x1aO ED + /y1aO m2 x1aO mul b add def + /xS m XQO mul YQO sub x1aO m div add y1aO add m 1 m div add div def + /yS m xS XQO sub mul YQO add def + /x2aO x1aO 2 xS x1aO sub mul add def + /y2aO y1aO 2 yS y1aO sub mul add def +% + tx@NodeDict begin + { x1aO \pst@number\psxunit mul y1aO \pst@number\psyunit mul } false + /N@CircleTO1 10 { InitPnode } NewNode + { x1O \pst@number\psxunit mul y1O \pst@number\psyunit mul } false + /N@CircleTO2 10 { InitPnode } NewNode + { x2aO \pst@number\psxunit mul y2aO \pst@number\psyunit mul } false + /N@CircleTO3 10 { InitPnode } NewNode + { x2O \pst@number\psxunit mul y2O \pst@number\psyunit mul } false + /N@CircleTO4 10 { InitPnode } NewNode + end + end + }% + \endgroup% + \ignorespaces% +} +% \def\resetOptions{% \def\pst@linetype{0}% \pstScalePoints(1,1){}{}% |