diff options
Diffstat (limited to 'macros/latex/contrib/wargame/source/hex/coord.dtx')
-rw-r--r-- | macros/latex/contrib/wargame/source/hex/coord.dtx | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/macros/latex/contrib/wargame/source/hex/coord.dtx b/macros/latex/contrib/wargame/source/hex/coord.dtx index b996ffa3c2..147ae82892 100644 --- a/macros/latex/contrib/wargame/source/hex/coord.dtx +++ b/macros/latex/contrib/wargame/source/hex/coord.dtx @@ -278,11 +278,10 @@ % \begin{macrocode} \pgfmathparse{int(\hex@coords@col@fac*(\hex@col+\hex@coords@col@off))}% \xdef\hex@eff@col{\pgfmathresult}% - \hex@dbg{2}{Effective column: \hex@coords@col@fac * (\hex@col - + \hex@dbg{2}{Effective column: \hex@coords@col@fac * (\hex@col + \hex@coords@col@off) -> \hex@eff@col}% \pgfmathparse{\hex@eff@col*1.5}% \xdef\hex@x{\pgfmathresult}% - \expandafter\pgf@x=\hex@x cm% % \end{macrocode} % % And then for the $y$ coordinate and set the dimension \cs{pgf@y}. @@ -304,17 +303,21 @@ \hex@dbg{2}{Effective row: \hex@coords@row@fac * (\hex@row + \hex@coords@row@off) -> \hex@eff@row}% \pgfmathparse{(2*\hex@eff@row-mod(round((\hex@col+\hex@coords@col@off)),2))*\hex@yy}% + \pgfmathparse{(2*\hex@eff@row-mod(abs(round(\hex@col+\hex@coords@col@off)),2))*\hex@yy}% \xdef\hex@y{\pgfmathresult}% - \expandafter\pgf@x=\hex@y cm% % \end{macrocode} % % If we have a vertex specification add that location to the current % coordinates. If not, set the point. % % \begin{macrocode} - \ifx\hex@vtx\@empty\pgfpointxy{\hex@x}{\hex@y}\else% - \pgfpointadd{\pgfpointxy{\hex@x}{\hex@y}}{% - \pgfpointscale{\hex@off}{\pgfpointpolarxy{\hex@vtx}{1}}}\fi% + \ifx\hex@vtx\@empty\else% + \pgfmathparse{\hex@x+\hex@off*cos(\hex@vtx)}\xdef\hex@x{\pgfmathresult} + \pgfmathparse{\hex@y+\hex@off*sin(\hex@vtx)}\xdef\hex@y{\pgfmathresult} + \fi% + % \ifx\hex@vtx\@empty\pgfpointxy{\hex@x}{\hex@y}\else% + % \pgfpointadd{\pgfpointxy{\hex@x}{\hex@y}}{% + % \pgfpointscale{\hex@off}{\pgfpointpolarxy{\hex@vtx}{1}}}\fi% % \end{macrocode} % % If we have an edge specification add that location to the current @@ -322,20 +325,28 @@ % % \begin{macrocode} \ifx\hex@edg\@empty\else% - \pgfpointadd{\pgfpointxy{\hex@x}{\hex@y}}{% - \pgfpointscale{\hex@off}{\pgfpointpolarxy{\hex@edg}{\hex@yy}}}\fi + \pgfmathparse{\hex@x+\hex@off*\hex@yy*cos(\hex@edg)}% + \xdef\hex@x{\pgfmathresult}% + \pgfmathparse{\hex@y+\hex@off*\hex@yy*sin(\hex@edg)}% + \xdef\hex@y{\pgfmathresult}% + \fi% + % \ifx\hex@edg\@empty\else% + % \pgfpointadd{\pgfpointxy{\hex@x}{\hex@y}}{% + % \pgfpointscale{\hex@off}{\pgfpointpolarxy{\hex@edg}{\hex@yy}}}\fi % \end{macrocode} % % For debugging, we can print out stuff. % % \begin{macrocode} + \pgfpointxy{\hex@x}{\hex@y} \hex@dbg{2}{Hex coordinates: #1 - ^^J c=\hex@col - ^^J r=\hex@row - ^^J v=\hex@vtx - ^^J e=\hex@edg - ^^J x=\hex@x - ^^J y=\hex@y}% + ^^J c=`\hex@col' + ^^J r=`\hex@row' + ^^J v=`\hex@vtx' + ^^J e=`\hex@edg' + ^^J o=`\hex@off' + ^^J x=`\hex@x' + ^^J y=`\hex@y'}% \global\let\hex@x\hex@x% \global\let\hex@y\hex@y% \global\let\hex@row\hex@row% |