diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex | 655 |
1 files changed, 331 insertions, 324 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex index 60cede3f006..c5b9ee1e99a 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex,v 1.29 2013/10/07 15:51:46 tantau Exp $ +\ProvidesFileRCS{pgfcorepathconstruct.code.tex} \newdimen\pgf@path@lastx @@ -22,9 +22,9 @@ % % #1 = in-size of arc % #2 = out-size of arc -% +% % Description: -% +% % This command influences path construction command like % \pgfpathlineto or \pgfpatharc. It will cause the corners at the end % of these commands to be replaced by little arcs. If the @@ -33,9 +33,9 @@ % the quarter circle will instead by a quarter ellipse. If the angle % is different from 90 degrees, a deformed quarter circle will % result, which may or may not be desirable. For a ``perfect'' arc you -% must use the \pgfpatharc command. -% -% +% must use the \pgfpatharc command. +% +% % Example: One rounded corner. % % \pgfpathmoveto{\pgfpointxy{0}{0}} @@ -80,7 +80,7 @@ % The following protocol the passed sizes and all the corresponding % softpath commands. The nonlinear transformation (nlt) module -% overwrites these commands. +% overwrites these commands. \def\pgf@lt@moveto#1#2{% \pgf@protocolsizes{#1}{#2}% @@ -110,7 +110,7 @@ % Move current point to #1. % % #1 = new current point -% +% % Example: % % \pgfpathmoveto{\pgfxy(0,0)} @@ -169,7 +169,7 @@ % Append a line from the current point to #1 to the current path. % % #1 = end of line -% +% % Example: % % \pgfpathmoveto{\pgfxy(0,0)} @@ -213,7 +213,7 @@ % #1 = first control point % #2 = second control point % #3 = end point -% +% % Example: % % \pgfpathmoveto{\pgfpointxy{0}{0}} @@ -241,7 +241,7 @@ % % #1 = control point % #2 = end point -% +% % Example: % % \pgfpathmoveto{\pgfpointxy{0}{0}} @@ -279,7 +279,7 @@ % #1 = angle of first point % #2 = angle of second point % #3 = radius or x-radius/y-radius -% +% % Example: % % \pgfpathmoveto{\pgfxy(0,0)} @@ -347,7 +347,7 @@ \pgfutil@tempdima=\pgf@arc@radius@a pt% \pgfutil@tempdimb=\pgf@arc@radius@b pt% % - \pgf@xa=\pgf@arc@local@angle@a\relax% + \pgf@xa=\pgf@arc@local@angle@a\relax% \pgf@xb=\pgf@arc@local@angle@b\relax% \advance\pgf@xb by-\pgf@xa\relax% \ifdim\pgf@xb<0pt\relax% @@ -368,7 +368,7 @@ \else% \advance\pgf@xa by -90pt\relax% \fi% - \edef\pgf@arc@angle{\pgf@sys@tonumber{\pgf@xa}}% + \edef\pgf@arc@angle{\pgf@sys@tonumber{\pgf@xa}}% \pgfpointtransformed{\pgfpointpolar{\pgf@arc@angle}{\pgfutil@tempdima and \pgfutil@tempdimb}}% \advance\pgf@x by-\pgf@pt@x% \advance\pgf@y by-\pgf@pt@y% @@ -412,7 +412,7 @@ % #2 = angle of second point % #3 = first axis % #4 = second axis -% +% % Example: % % \pgfpathmoveto{\pgfxy(0,0)} @@ -428,7 +428,7 @@ -% Append an arc to the current point that ends at a given position. +% Append an arc to the current point that ends at a given position. % % #1 = x-radius % #2 = y-radius @@ -442,18 +442,18 @@ % This command implements an arc drawing where a given target % coordinate (#6) is given and the task is to draw an arc of an % ellipse with the given radii. The center point of the ellipse is not -% give, but computed automatically. +% give, but computed automatically. % % This kind of "endpoint parameterization" of an arc is exactly the % same as the one specified by the SVG-specification for the "A" and % "a" path commands. Please see the SVG-specification for details. -% +% % Note that the problem is internally converted to drawing an arc % using \pgfpatharc. This means that there may be a heavy loss of % accuracy. -% +% % Example: -% +% % \pgfpathmoveto{\pgfpoint{1cm}{1cm}} % \pgfpatharcto{1cm}{1cm}{0}{0}{0}{\pgfpoint{0cm}{2cm}} @@ -461,10 +461,10 @@ {% % The following code is based on the transformation described in svg % 1.1 specification Section F.6.5 - % + % % Step 1: store the simple parameters (xa=x1 since TeX does not % allow numbers in names) - % + % \pgfmathsetmacro\pgf@arcto@rx{abs(#1)}% \pgfmathsetmacro\pgf@arcto@ry{abs(#2)}% \ifdim\pgf@arcto@rx pt=0pt% special rule: zero radius=straight line @@ -487,11 +487,11 @@ \pgf@process{#6} \edef\pgf@arcto@xb{\the\pgf@x}% \edef\pgf@arcto@yb{\the\pgf@y}% - % + % % Step 2: x1,y1 is more complicated to compute: It is given by lastx % and lasty, but these are transformed coordinates, we need the % untransformed ones. So, we inverse the transformation (arghh...) - % + % \pgftransforminvert% \pgf@process{\pgfpointtransformed{\pgfqpoint{\pgf@path@lastx}{\pgf@path@lasty}}} \edef\pgf@arcto@xa{\the\pgf@x} @@ -504,15 +504,15 @@ % % Ok, now we got all the parameters setup. Now comes the % computation... - % - % + % + % % Step 3: Start with a new coordinate system and rotate everything % by the negated phi. - % + % \pgftransformreset \pgftransformrotate{-\pgf@arcto@phi} % Ok, using \pgfpointtransformed we now get transformed points... - % + % % Step 4: Compute x1' and y1' (xaprime and yaprime) % \pgf@process{ @@ -524,8 +524,8 @@ } \edef\pgf@arcto@xaprime{\pgf@sys@tonumber\pgf@x} \edef\pgf@arcto@yaprime{\pgf@sys@tonumber\pgf@y} - % - % Compute Lambda + % + % Compute Lambda % \pgfmathsetmacro\pgf@arcto@frac@x{\pgf@arcto@xaprime/\pgf@arcto@rx} \pgfmathsetmacro\pgf@arcto@frac@y{\pgf@arcto@yaprime/\pgf@arcto@ry} @@ -537,9 +537,9 @@ \pgfmathsetmacro\pgf@arcto@rx{\pgf@arcto@sqrt@lambda*\pgf@arcto@rx} \pgfmathsetmacro\pgf@arcto@ry{\pgf@arcto@sqrt@lambda*\pgf@arcto@ry} \fi - % - % Do some scaling - % + % + % Do some scaling + % \pgfmathsetmacro\pgf@arcto@xaprime@abs{abs(\pgf@arcto@xaprime)} \pgfmathsetmacro\pgf@arcto@yaprime@abs{abs(\pgf@arcto@yaprime)} \pgfmathmax@{\pgf@arcto@rx,\pgf@arcto@ry,\pgf@arcto@xaprime@abs,\pgf@arcto@yaprime@abs} @@ -548,9 +548,9 @@ \pgfmathsetmacro\pgf@arcto@ry@scaled{\pgf@arcto@scaling*\pgf@arcto@ry} \pgfmathsetmacro\pgf@arcto@xaprime@scaled{\pgf@arcto@scaling*\pgf@arcto@xaprime} \pgfmathsetmacro\pgf@arcto@yaprime@scaled{\pgf@arcto@scaling*\pgf@arcto@yaprime} - % - % Step 5: Now comes the messy computation of c1' and c2'. - % + % + % Step 5: Now comes the messy computation of c1' and c2'. + % \ifdim\pgf@arcto@rx pt>\pgf@arcto@ry pt% \pgfmathsetmacro\pgf@arcto@rx@over@ry{\pgf@arcto@rx/\pgf@arcto@ry} \pgfmathsetmacro\pgf@arcto@ry@over@rx{\pgf@arcto@ry/\pgf@arcto@rx} @@ -595,9 +595,9 @@ \pgfmathsetmacro\pgf@arcto@cyprime{ -\pgf@arcto@factor*\pgf@arcto@ry@over@rx*\pgf@arcto@xaprime } - % - % Step 6: Ok, now compute cx,cy - % + % + % Step 6: Ok, now compute cx,cy + % \pgftransformreset \pgftransformrotate{\pgf@arcto@phi} \pgf@process{ @@ -613,9 +613,9 @@ } \edef\pgf@arcto@cx{\the\pgf@x} \edef\pgf@arcto@cy{\the\pgf@y} - % - % Step 7: Compute start angle: - % + % + % Step 7: Compute start angle: + % \pgfmathsetmacro\pgf@arcto@vec@x{(\pgf@arcto@xaprime-\pgf@arcto@cxprime)/\pgf@arcto@rx} \pgfmathsetmacro\pgf@arcto@vec@y{(\pgf@arcto@yaprime-\pgf@arcto@cyprime)/\pgf@arcto@ry} \pgfmathsetmacro\pgf@arcto@denominator{veclen(\pgf@arcto@vec@x,\pgf@arcto@vec@y)} @@ -624,9 +624,9 @@ \ifdim\pgf@arcto@vec@y pt<0pt \pgfmathsetmacro\pgf@arcto@theta@start{-\pgf@arcto@theta@start} \fi - % - % Step 8: Compute end angle: - % + % + % Step 8: Compute end angle: + % \pgfmathsetmacro\pgf@arcto@vec@x{(-\pgf@arcto@xaprime-\pgf@arcto@cxprime)/\pgf@arcto@rx} \pgfmathsetmacro\pgf@arcto@vec@y{(-\pgf@arcto@yaprime-\pgf@arcto@cyprime)/\pgf@arcto@ry} \pgfmathsetmacro\pgf@arcto@denominator{veclen(\pgf@arcto@vec@x,\pgf@arcto@vec@y)} @@ -695,190 +695,190 @@ % #7 the ratio xradius/yradius of the ellipse % #8 the ratio yradius/xradius of the ellipse % Example: -% \def\cx{1cm}% center x -% \def\cy{1cm}% center y -% \def\startangle{0}% -% \def\endangle{45}% -% \def\a{5cm}% xradius -% \def\b{10cm}% yradius -% \pgfmathparse{\a/\b}\let\abratio=\pgfmathresult -% \pgfmathparse{\b/\a}\let\baratio=\pgfmathresult +% \def\cx{1cm}% center x +% \def\cy{1cm}% center y +% \def\startangle{0}% +% \def\endangle{45}% +% \def\a{5cm}% xradius +% \def\b{10cm}% yradius +% \pgfmathparse{\a/\b}\let\abratio=\pgfmathresult +% \pgfmathparse{\b/\a}\let\baratio=\pgfmathresult % % \pgfpathmoveto{\pgfpoint{\cx+\a*cos(\startangle)}{\cy+\b*sin(\startangle)}}% % \pgfpatharctoprecomputed -% {\pgfpoint{\cx}{\cy}} -% {\startangle} -% {\endangle} -% {\pgfpoint{\cx+\a*cos(\endangle)}{\cy+\b*sin(\endangle)}}% -% {\a} -% {\b} -% {\abratio} -% {\baratio} +% {\pgfpoint{\cx}{\cy}} +% {\startangle} +% {\endangle} +% {\pgfpoint{\cx+\a*cos(\endangle)}{\cy+\b*sin(\endangle)}}% +% {\a} +% {\b} +% {\abratio} +% {\baratio} % \def\pgfpatharctoprecomputed#1#2#3#4#5#6#7#8{% - \begingroup - % Implementation idea: - % - % let - % m = center (#1) - % \gamma_0 = start angle - % \gamma_1 = end angle - % a = x radius - % b = y radius - % - % an axis parallel ellipse is parameterized by - % C(\gamma) = m + ( a cos(\gamma), b sin(\gamma) ), \gamma in [0,360]. - % - % Now, consider the segment \gamma(t), - % \gamma:[0,1] -> [\gamma_0,\gamma_1], - % t -> \gamma_0 + t(\gamma_1 - \gamma_0) - % and - % C(\gamma(t)) which is defined on [0,1]. - % - % I'd like to approximate the arc by one or more cubic bezier - % splines which interpolate through the last and first provided - % points. - % - % In general, a Bezier spline C:[0,1] -> \R of order n fulfills - % C'(0) = n ( P_1 - P_0 ), - % C'(1) = n ( P_n - P_{n-1} ). - % For n=3 and given P_0 and P_3, I can directly compute P_1 and P_2 once I know - % the derivatives at t=0 and t=1. - % - % The derivatives in our case are - % ( C \circ \gamma )'(t) = C'[\gamma(t)] * \gamma'(t) - % = ( -a pi/180 sin(\gamma(t)), b pi/180 cos(\gamma(t)) ) * (\gamma_1 - \gamma_0). - % The pi/180 comes into play since we are working with degrees. - % - % Expression (C\circ\gamma)'(0) using P_0 and (C \circ \gamma)'(1) - % using P_3 yields the expressions - % (C \circ \gamma)'(0) = - % pi/180 * (\gamma_1 - \gamma_0)* [ - a/b(P_0^y - my), b/a (P_0^x - mx) ] - % (C \circ \gamma)'(1) = - % pi/180 * (\gamma_1 - \gamma_0)* [ - a/b(P_3^y - my), b/a (P_3^x - mx) ] - % - % defining - % scaleA = a/b * pi / (3*180) * (\gamma_1 - \gamma_0) - % and - % scaleB = b/a * pi / (3*180) * (\gamma_1 - \gamma_0) - % yields the direct expressions for the intermediate bezier - % control points - % - % P_1 = [ - % P_0^x - scaleA* ( P_0^y -my), - % P_0^y + scaleB* ( P_0^x -mx) ] - % and - % P_2 = [ - % P_3^x + scaleA* ( P_3^y -my), - % P_3^y - scaleB* ( P_3^x -mx) ]. - % - % This works fast, with few operations, if - % - a/b and b/a are known in advance - % - P_0 and P_3 are known in advance - % - \gamma_0 and \gamma_1 are known. - % - % It is also reliable if (\gamma_1 - \gamma_0) is small - % - \pgf@process{#1}% - \edef\pgfpath@center@x{\the\pgf@x}% - \edef\pgfpath@center@y{\the\pgf@y}% - \def\pgfpath@completearcend{#4}% - % compute scale (#3-#2) * pi/(3*180) = (#3 - #2) * pi/27 * 1/20 - % splitting pi/(3*180) into two scales has higher TeX accuracy - \pgf@xa=#2pt - \pgf@xb=#3pt - \edef\pgfpath@startangle{#2pt}% - \edef\pgfpath@endangle{\pgf@sys@tonumber\pgf@xb}% - % - \pgf@ya=\pgf@xb - \advance\pgf@ya by-\pgf@xa - % - \ifx\pgfpatharctomaxstepsize\pgfutil@empty - \def\pgfpath@N{1}% - \pgf@xc=\pgf@ya - \else - \pgf@xc=\pgf@ya% compute N = floor((gamma_1 - gamma_0) / max) +1 - \ifdim\pgf@xc<0pt - \multiply\pgf@xc by-1 - \fi - \divide\pgf@xc by\pgfpatharctomaxstepsize\relax - \afterassignment\pgfutil@gobble@until@relax - \c@pgf@counta=\the\pgf@xc\relax - \advance\c@pgf@counta by1 - \edef\pgfpath@N{\the\c@pgf@counta}% - % - \pgf@xc=\pgf@ya - \divide\pgf@xc by\c@pgf@counta - \fi - % - \edef\pgfpath@h{\pgf@sys@tonumber\pgf@xc}% - % + \begingroup + % Implementation idea: + % + % let + % m = center (#1) + % \gamma_0 = start angle + % \gamma_1 = end angle + % a = x radius + % b = y radius + % + % an axis parallel ellipse is parameterized by + % C(\gamma) = m + ( a cos(\gamma), b sin(\gamma) ), \gamma in [0,360]. + % + % Now, consider the segment \gamma(t), + % \gamma:[0,1] -> [\gamma_0,\gamma_1], + % t -> \gamma_0 + t(\gamma_1 - \gamma_0) + % and + % C(\gamma(t)) which is defined on [0,1]. + % + % I'd like to approximate the arc by one or more cubic bezier + % splines which interpolate through the last and first provided + % points. + % + % In general, a Bezier spline C:[0,1] -> \R of order n fulfills + % C'(0) = n ( P_1 - P_0 ), + % C'(1) = n ( P_n - P_{n-1} ). + % For n=3 and given P_0 and P_3, I can directly compute P_1 and P_2 once I know + % the derivatives at t=0 and t=1. + % + % The derivatives in our case are + % ( C \circ \gamma )'(t) = C'[\gamma(t)] * \gamma'(t) + % = ( -a pi/180 sin(\gamma(t)), b pi/180 cos(\gamma(t)) ) * (\gamma_1 - \gamma_0). + % The pi/180 comes into play since we are working with degrees. + % + % Expression (C\circ\gamma)'(0) using P_0 and (C \circ \gamma)'(1) + % using P_3 yields the expressions + % (C \circ \gamma)'(0) = + % pi/180 * (\gamma_1 - \gamma_0)* [ - a/b(P_0^y - my), b/a (P_0^x - mx) ] + % (C \circ \gamma)'(1) = + % pi/180 * (\gamma_1 - \gamma_0)* [ - a/b(P_3^y - my), b/a (P_3^x - mx) ] + % + % defining + % scaleA = a/b * pi / (3*180) * (\gamma_1 - \gamma_0) + % and + % scaleB = b/a * pi / (3*180) * (\gamma_1 - \gamma_0) + % yields the direct expressions for the intermediate bezier + % control points + % + % P_1 = [ + % P_0^x - scaleA* ( P_0^y -my), + % P_0^y + scaleB* ( P_0^x -mx) ] + % and + % P_2 = [ + % P_3^x + scaleA* ( P_3^y -my), + % P_3^y - scaleB* ( P_3^x -mx) ]. + % + % This works fast, with few operations, if + % - a/b and b/a are known in advance + % - P_0 and P_3 are known in advance + % - \gamma_0 and \gamma_1 are known. + % + % It is also reliable if (\gamma_1 - \gamma_0) is small + % + \pgf@process{#1}% + \edef\pgfpath@center@x{\the\pgf@x}% + \edef\pgfpath@center@y{\the\pgf@y}% + \def\pgfpath@completearcend{#4}% + % compute scale (#3-#2) * pi/(3*180) = (#3 - #2) * pi/27 * 1/20 + % splitting pi/(3*180) into two scales has higher TeX accuracy + \pgf@xa=#2pt + \pgf@xb=#3pt + \edef\pgfpath@startangle{#2pt}% + \edef\pgfpath@endangle{\pgf@sys@tonumber\pgf@xb}% + % + \pgf@ya=\pgf@xb + \advance\pgf@ya by-\pgf@xa + % + \ifx\pgfpatharctomaxstepsize\pgfutil@empty + \def\pgfpath@N{1}% + \pgf@xc=\pgf@ya + \else + \pgf@xc=\pgf@ya% compute N = floor((gamma_1 - gamma_0) / max) +1 + \ifdim\pgf@xc<0pt + \multiply\pgf@xc by-1 + \fi + \divide\pgf@xc by\pgfpatharctomaxstepsize\relax + \afterassignment\pgfutil@gobble@until@relax + \c@pgf@counta=\the\pgf@xc\relax + \advance\c@pgf@counta by1 + \edef\pgfpath@N{\the\c@pgf@counta}% + % + \pgf@xc=\pgf@ya + \divide\pgf@xc by\c@pgf@counta + \fi + % + \edef\pgfpath@h{\pgf@sys@tonumber\pgf@xc}% + % %\message{pgfpathellipse: using N =\pgfpath@N\space spline points y0 = \pgfpath@startangle, y0+i*h, yN=\pgfpath@endangle, i=1,...,(\pgfpath@N-1), with h=\pgfpath@h\space mesh width (total arc angle \pgf@sys@tonumber\pgf@ya).}% - % - % - \pgf@xc=0.116355283466289\pgf@xc % pi/27 - \divide\pgf@xc by20 - \pgf@xa=#7\pgf@xc - \edef\pgfpath@scale@A{\pgf@sys@tonumber\pgf@xa}% - \pgf@xa=#8\pgf@xc - \edef\pgfpath@scale@B{\pgf@sys@tonumber\pgf@xa}% - % - % compute intermediate spline segments for - % i = 1,...,N-1 - % this is a no-op for N=1. - \c@pgf@countd=1 - \pgfutil@loop - \ifnum\c@pgf@countd<\pgfpath@N\relax - % - \pgf@xa=\pgfpath@startangle % compute \pgf@xa = y_0 + i*h - \pgf@xb=\pgfpath@h pt - \multiply\pgf@xb by\c@pgf@countd - \advance\pgf@xa by\pgf@xb - \edef\pgfpath@angle@i{\pgf@sys@tonumber\pgf@xa}% + % + % + \pgf@xc=0.116355283466289\pgf@xc % pi/27 + \divide\pgf@xc by20 + \pgf@xa=#7\pgf@xc + \edef\pgfpath@scale@A{\pgf@sys@tonumber\pgf@xa}% + \pgf@xa=#8\pgf@xc + \edef\pgfpath@scale@B{\pgf@sys@tonumber\pgf@xa}% + % + % compute intermediate spline segments for + % i = 1,...,N-1 + % this is a no-op for N=1. + \c@pgf@countd=1 + \pgfutil@loop + \ifnum\c@pgf@countd<\pgfpath@N\relax + % + \pgf@xa=\pgfpath@startangle % compute \pgf@xa = y_0 + i*h + \pgf@xb=\pgfpath@h pt + \multiply\pgf@xb by\c@pgf@countd + \advance\pgf@xa by\pgf@xb + \edef\pgfpath@angle@i{\pgf@sys@tonumber\pgf@xa}% %\message{angle \the\c@pgf@countd: \pgfpath@angle@i...}% - % - \pgfpatharcofellipse@{% - \pgfpoint - {\pgfpath@center@x + #5*cos(\pgfpath@angle@i)} - {\pgfpath@center@y + #6*sin(\pgfpath@angle@i)}% - }% - % - \advance\c@pgf@countd by1 - \pgfutil@repeat - % - % compute final spline segment. It only differs insofar as the - % final point is already known explicitly and should be - % interpolated without additional math error. + % + \pgfpatharcofellipse@{% + \pgfpoint + {\pgfpath@center@x + #5*cos(\pgfpath@angle@i)} + {\pgfpath@center@y + #6*sin(\pgfpath@angle@i)}% + }% + % + \advance\c@pgf@countd by1 + \pgfutil@repeat + % + % compute final spline segment. It only differs insofar as the + % final point is already known explicitly and should be + % interpolated without additional math error. %\message{angle \pgfpath@N: \pgfpath@endangle...}% - \pgfpatharcofellipse@{\pgfpath@completearcend}% - \endgroup + \pgfpatharcofellipse@{\pgfpath@completearcend}% + \endgroup }% \def\pgfpatharcofellipse@#1{% - \begingroup - \pgf@process{#1}% - \edef\pgfpath@endpt{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% - % - \pgfpathcurveto{ - \begingroup - \global\pgf@x=\pgf@path@lastx - \global\pgf@y=\pgf@path@lasty - \pgf@xa=\pgf@x \advance\pgf@xa by-\pgfpath@center@x - \pgf@ya=\pgf@y \advance\pgf@ya by-\pgfpath@center@y - \global\advance\pgf@x by-\pgfpath@scale@A\pgf@ya - \global\advance\pgf@y by \pgfpath@scale@B\pgf@xa - \endgroup - }{% - \begingroup - \pgfpath@endpt - \pgf@xa=\pgf@x \advance\pgf@xa by-\pgfpath@center@x - \pgf@ya=\pgf@y \advance\pgf@ya by-\pgfpath@center@y - \global\advance\pgf@x by \pgfpath@scale@A\pgf@ya - \global\advance\pgf@y by-\pgfpath@scale@B\pgf@xa - \endgroup - }{% - \pgfpath@endpt - }% - \endgroup + \begingroup + \pgf@process{#1}% + \edef\pgfpath@endpt{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% + % + \pgfpathcurveto{ + \begingroup + \global\pgf@x=\pgf@path@lastx + \global\pgf@y=\pgf@path@lasty + \pgf@xa=\pgf@x \advance\pgf@xa by-\pgfpath@center@x + \pgf@ya=\pgf@y \advance\pgf@ya by-\pgfpath@center@y + \global\advance\pgf@x by-\pgfpath@scale@A\pgf@ya + \global\advance\pgf@y by \pgfpath@scale@B\pgf@xa + \endgroup + }{% + \begingroup + \pgfpath@endpt + \pgf@xa=\pgf@x \advance\pgf@xa by-\pgfpath@center@x + \pgf@ya=\pgf@y \advance\pgf@ya by-\pgfpath@center@y + \global\advance\pgf@x by \pgfpath@scale@A\pgf@ya + \global\advance\pgf@y by-\pgfpath@scale@B\pgf@xa + \endgroup + }{% + \pgfpath@endpt + }% + \endgroup } @@ -894,7 +894,7 @@ % #1 = center % #2 = first axis % #3 = second axis -% +% % Example: % % % Add a circle of radius 3cm around the origin @@ -980,7 +980,7 @@ \advance\pgf@x by\pgf@xc% \advance\pgf@y by\pgf@yc% \advance\pgf@xb by\pgf@xc% - \advance\pgf@yb by\pgf@yc% + \advance\pgf@yb by\pgf@yc% \pgf@temp% \pgf@nlt@curveto{\pgf@xc}{\pgf@yc}{\pgf@x}{\pgf@y}{\pgf@xb}{\pgf@yb}% }% @@ -1001,7 +1001,7 @@ \advance\pgf@x by\pgf@xc% \advance\pgf@y by\pgf@yc% \advance\pgf@xa by\pgf@xc% - \advance\pgf@ya by\pgf@yc% + \advance\pgf@ya by\pgf@yc% \pgf@temp% \pgf@nlt@curveto{\pgf@xc}{\pgf@yc}{\pgf@x}{\pgf@y}{\pgf@xa}{\pgf@ya}% }% @@ -1015,10 +1015,10 @@ % % #1 = center % #2 = radius -% +% % Example: % -% % Append a circle of radius 3cm around the the point (1,1) +% % Append a circle of radius 3cm around the point (1,1) % \pgfpathcircle{\pgxy(1,1)}{3cm} \def\pgfpathcircle#1#2{\pgfpathellipse{#1}{\pgfpoint{#2}{0pt}}{\pgfpoint{0pt}{#2}}} @@ -1030,7 +1030,7 @@ % % #1 = lower left corner point of rectangle % #2 = width and height vector -% +% % Example: % % % A rectangle with corners (2,2) and (3,3) @@ -1082,7 +1082,7 @@ % % #1 = one corner of the rectangle % #2 = opposite corner of the rectangle -% +% % Example: % % % A rectangle with corners (2,2) and (3,3) @@ -1103,13 +1103,13 @@ % % #1 = first corner point of grid % #2 = second corner point of grid -% -% Options: -% +% +% Options: +% % stepx = x-step dimension (default 1cm) % stepy = y-step dimension (default 1cm) -% step = dimesion vector -% +% step = dimension vector +% % Example: % % \pgfsetlinewidth{0.8pt} @@ -1146,75 +1146,82 @@ \pgf@yb=\pgf@ya% \pgf@ya=\pgf@y% \fi% - \c@pgf@counta=\pgf@ya\relax% - \c@pgf@countb=\pgf@yc\relax% - \divide\c@pgf@counta by\c@pgf@countb\relax% - \pgfutil@tempdima=\c@pgf@counta\pgf@yc\relax% - \ifdim\pgfutil@tempdima<\pgf@ya% + \ifdim \pgf@yc > .01pt\relax% if to draw horizontal lines + \c@pgf@counta=\pgf@ya\relax% + \c@pgf@countb=\pgf@yc\relax% + \divide\c@pgf@counta by\c@pgf@countb\relax% + \pgfutil@tempdima=\c@pgf@counta\pgf@yc\relax% + \ifdim\pgfutil@tempdima<\pgf@ya% + \advance\pgfutil@tempdima by\pgf@yc% + \fi% + \pgfutil@tempdimb\pgf@x + \pgfutil@loop% horizontal lines + {% + \pgf@xa=\pgfutil@tempdimb% + \pgf@ya=\pgfutil@tempdima% + \pgf@pos@transform{\pgf@xa}{\pgf@ya} + \pgf@nlt@moveto{\pgf@xa}{\pgf@ya}% + \pgf@xa=\pgf@xb% + \pgf@ya=\pgfutil@tempdima% + \pgf@pos@transform{\pgf@xa}{\pgf@ya} + \pgf@nlt@lineto{\pgf@xa}{\pgf@ya}% + }% \advance\pgfutil@tempdima by\pgf@yc% + \ifdim\pgfutil@tempdima<\pgf@yb% + \pgfutil@repeat% + \advance\pgfutil@tempdima by-0.01pt\relax% + \ifdim\pgfutil@tempdima<\pgf@yb% + {% + \pgf@xa=\pgfutil@tempdimb% + \pgf@ya=\pgfutil@tempdima% + \pgf@pos@transform{\pgf@xa}{\pgf@ya} + \pgf@nlt@moveto{\pgf@xa}{\pgf@ya}% + \pgf@xa=\pgf@xb% + \pgf@ya=\pgfutil@tempdima% + \pgf@pos@transform{\pgf@xa}{\pgf@ya} + \pgf@nlt@lineto{\pgf@xa}{\pgf@ya}% + }% + \fi% \fi% - \pgfutil@tempdimb\pgf@x - \pgfutil@loop% horizontal lines - {% - \pgf@xa=\pgfutil@tempdimb% - \pgf@ya=\pgfutil@tempdima% - \pgf@pos@transform{\pgf@xa}{\pgf@ya} - \pgf@nlt@moveto{\pgf@xa}{\pgf@ya}% - \pgf@xa=\pgf@xb% - \pgf@ya=\pgfutil@tempdima% - \pgf@pos@transform{\pgf@xa}{\pgf@ya} - \pgf@nlt@lineto{\pgf@xa}{\pgf@ya}% - }% - \advance\pgfutil@tempdima by\pgf@yc% - \ifdim\pgfutil@tempdima<\pgf@yb% - \pgfutil@repeat% - \advance\pgfutil@tempdima by-0.01pt\relax% - \ifdim\pgfutil@tempdima<\pgf@yb% - {% - \pgf@xa=\pgfutil@tempdimb% - \pgf@ya=\pgfutil@tempdima% - \pgf@pos@transform{\pgf@xa}{\pgf@ya} - \pgf@nlt@moveto{\pgf@xa}{\pgf@ya}% - \pgf@xa=\pgf@xb% - \pgf@ya=\pgfutil@tempdima% - \pgf@pos@transform{\pgf@xa}{\pgf@ya} - \pgf@nlt@lineto{\pgf@xa}{\pgf@ya}% - }% - \fi% - \c@pgf@counta=\pgfutil@tempdimb\relax% - \c@pgf@countb=\pgf@xc\relax% - \divide\c@pgf@counta by\c@pgf@countb\relax% - \pgfutil@tempdimb=\c@pgf@counta\pgf@xc\relax% - \ifdim\pgfutil@tempdimb<\pgf@xa% - \advance\pgfutil@tempdimb by\pgf@xc% - \fi% - \pgfutil@loop% vertical lines - {% - \pgf@xc=\pgfutil@tempdimb% - \pgf@yc=\pgf@ya% - \pgf@pos@transform{\pgf@xc}{\pgf@yc} - \pgf@nlt@moveto{\pgf@xc}{\pgf@yc}% - \pgf@xc=\pgfutil@tempdimb% - \pgf@yc=\pgf@yb% - \pgf@pos@transform{\pgf@xc}{\pgf@yc} - \pgf@nlt@lineto{\pgf@xc}{\pgf@yc}% - }% - \advance\pgfutil@tempdimb by\pgf@xc% - \ifdim\pgfutil@tempdimb<\pgf@xb% - \pgfutil@repeat% - \advance\pgfutil@tempdimb by-0.01pt\relax% - \ifdim\pgfutil@tempdimb<\pgf@xb% - {% - \pgf@xc=\pgfutil@tempdimb% - \pgf@yc=\pgf@ya% - \pgf@pos@transform{\pgf@xc}{\pgf@yc} - \pgf@nlt@moveto{\pgf@xc}{\pgf@yc}% - \pgf@xc=\pgfutil@tempdimb% - \pgf@yc=\pgf@yb% - \pgf@pos@transform{\pgf@xc}{\pgf@yc} - \pgf@nlt@lineto{\pgf@xc}{\pgf@yc}% - }% + \ifdim \pgf@xc > .01pt\relax% if to draw vertical lines + \c@pgf@counta=\pgf@xa\relax% + \c@pgf@countb=\pgf@xc\relax% + \divide\c@pgf@counta by\c@pgf@countb\relax% + \pgfutil@tempdimb=\c@pgf@counta\pgf@xc\relax% + \ifdim\pgfutil@tempdimb<\pgf@xa% + \advance\pgfutil@tempdimb by\pgf@xc% + \fi% + \pgfutil@loop% vertical lines + {% + \pgf@xc=\pgfutil@tempdimb% + \pgf@yc=\pgf@ya% + \pgf@pos@transform{\pgf@xc}{\pgf@yc} + \pgf@nlt@moveto{\pgf@xc}{\pgf@yc}% + \pgf@xc=\pgfutil@tempdimb% + \pgf@yc=\pgf@yb% + \pgf@pos@transform{\pgf@xc}{\pgf@yc} + \pgf@nlt@lineto{\pgf@xc}{\pgf@yc}% + }% + \advance\pgfutil@tempdimb by\pgf@xc% + \ifdim\pgfutil@tempdimb<\pgf@xb% + \pgfutil@repeat% + \advance\pgfutil@tempdimb by-0.01pt\relax% + \ifdim\pgfutil@tempdimb<\pgf@xb% + {% + \pgf@xc=\pgfutil@tempdimb% + \pgf@yc=\pgf@ya% + \pgf@pos@transform{\pgf@xc}{\pgf@yc} + \pgf@nlt@moveto{\pgf@xc}{\pgf@yc}% + \pgf@xc=\pgfutil@tempdimb% + \pgf@yc=\pgf@yb% + \pgf@pos@transform{\pgf@xc}{\pgf@yc} + \pgf@nlt@lineto{\pgf@xc}{\pgf@yc}% + }% + \fi% \fi% + \pgf@process{#3}% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \pgf@nlt@moveto{\pgf@x}{\pgf@y}% } @@ -1223,20 +1230,20 @@ % % #1 = bend (relative to current point) % #2 = end point (relative to bend point) -% +% % Description: -% +% % This command appends a half-parabola that starts at the current point % and has its bend at #1+current point. Then, a second parabola is % appended that starts at #1+current point, where it also has its % minimum/maximum, and ends at #1+current point+#2, which becomes the -% new current point. -% +% new current point. +% % By setting #2 = (0,0) you draw only a half parabola that goes from the % current point to the bend; by setting #1 = (0,0) % you draw a half parabola that going to current point + #2 and has its -% bend at the current point. -% +% bend at the current point. +% % Examples: % % % Half-parabola going ``up and right'' @@ -1264,7 +1271,7 @@ \ifdim\pgf@yb=0pt\relax% \pgfutil@tempswafalse% \fi% - \fi% + \fi% {% \ifpgfutil@tempswa% \pgf@arccornersfalse @@ -1276,7 +1283,7 @@ \pgfutil@tempswafalse% \fi% \fi% - \ifpgfutil@tempswa + \ifpgfutil@tempswa {% \pgf@pt@x=\pgf@path@lastx% \pgf@pt@y=\pgf@path@lasty% @@ -1299,8 +1306,8 @@ {\pgfqpoint{\pgf@xc}{\pgf@yc}}% }% \fi% - }% -} + }% +} @@ -1308,12 +1315,12 @@ % Append a sine curve between 0 and \pi/2 to the path. % % #1 = vector, describing the width and height of the curve -% +% % Description: -% +% % This command appends a sine curve in the interval 0 and \pi/2 to the % current path. The sine curve ends at currentpoint+#1. -% +% % Examples: % % % One complete sine in the interval [0,\pi] @@ -1329,16 +1336,16 @@ \pgf@pt@x=\pgf@path@lastx% evil trickery to transform to the last point \pgf@pt@y=\pgf@path@lasty% \pgfpathcurveto% - {\pgfqpoint{.31831\pgf@xc}{.5\pgf@yc}}% found by trial and error - {\pgfqpoint{.63503\pgf@xc}{\pgf@yc}}% found by trial and error + {\pgfqpoint{.3260\pgf@xc}{.5120\pgf@yc}}% + {\pgfqpoint{.6380\pgf@xc}{\pgf@yc}}% {\pgfqpoint{\pgf@xc}{\pgf@yc}}% - }% -} + }% +} % Append a cosine curve between 0 and \pi/2 to the path. % % #1 = vector, describing the width and height of the curve -% +% % Examples: % % % One complete sine in the interval [0,\pi] @@ -1354,11 +1361,11 @@ \pgf@pt@x=\pgf@path@lastx% evil trickery to transform to the last point \pgf@pt@y=\pgf@path@lasty% \pgfpathcurveto% - {\pgfqpoint{.36497\pgf@xc}{0pt}}% found by trial and error - {\pgfqpoint{.68169\pgf@xc}{.5\pgf@yc}}% found by trial and error + {\pgfqpoint{.3620\pgf@xc}{0pt}}% + {\pgfqpoint{.6740\pgf@xc}{.4880\pgf@yc}}% {\pgfqpoint{\pgf@xc}{\pgf@yc}}% - }% -} + }% +} @@ -1371,7 +1378,7 @@ % #5 - second control % #6 - end point of the curve % -% There are two versions, \pgfpathcurvebetweentime and +% There are two versions, \pgfpathcurvebetweentime and % \pgfpathcurvebetweentimecontinue. The latter does not insert a % moveto to the first point. % @@ -1395,7 +1402,7 @@ \def\pgf@@@pathcurvebetweentime#1#2#3#4#5{% % Q1 = P1. - \pgf@process{#2}% + \pgf@process{#2}% \pgf@xc=\pgf@x% \pgf@yc=\pgf@y% % Q2 = P1 + t*(P2-P1). @@ -1417,7 +1424,7 @@ \pgf@process{% \pgf@process{#4}% \pgf@xa=#1\pgf@x% - \pgf@ya=#1\pgf@y% + \pgf@ya=#1\pgf@y% % \pgf@process{#3}% \pgf@xc=\pgf@x% @@ -1428,7 +1435,7 @@ \pgf@x=\pgf@xb% \pgf@y=\pgf@yb% \advance\pgf@x by#1\pgf@xa% - \advance\pgf@y by#1\pgf@ya% + \advance\pgf@y by#1\pgf@ya% \advance\pgf@x by-#1\pgf@xb% \advance\pgf@y by-#1\pgf@yb% \advance\pgf@x by#1\pgf@xc% @@ -1437,7 +1444,7 @@ \pgf@xa=\pgf@x% \pgf@ya=\pgf@y% % Q4 = (1-t)^3*P1 + 3*t(1-t)^2*P2 + 3*t^2(1-t)*P3 + t^3*P4. - \pgf@process{\pgfpointcurveattime{#1}{#2}{#3}{#4}{#5}}% + \pgf@process{\pgfpointcurveattime{#1}{#2}{#3}{#4}{#5}}% \ifx#1\pgf@time@t% % First time round... \pgfmathdivide@{\pgf@time@s}{\pgf@time@t}% |