First: On http://latex-community.org/forum/viewtopic.php?t=21601, Thorsten pointed me to an example on how to define the center of a
\psPolygon. I am not sure if the following has anything to do with this.Consider the following MWE:
Code: Select all
\documentclass{article}
\usepackage{auto-pst-pdf,pst-poly,pstricks-add}
\usepackage{expl3}
\ExplSyntaxOn
\cs_new_eq:NN
\calculate
\fp_eval:n
\ExplSyntaxOff
\begin{document}
\begin{figure}
\def\AntalSider{8 }
\def\Sidelaengde{60 }
\def\RadiusB{78.39377789258259 }
%\def\RadiusB{\calculate{\Sidelaengde/(2*sin(180/\AntalSider))} }
\def\RelVinkel{\calculate{360/\AntalSider} }
\def\Rotation{\calculate{\RelVinkel/2} }
\centering
\begin{pspicture}[showgrid=false](156.8,156.8)
\psset{unit=0.05cm}
\pnode(!\RadiusB \RadiusB){A}
\pscircle(A){\RadiusB}
\PstPolygon[PolyNbSides=\AntalSider,PolyRotation=\Rotation,unit=\RadiusB]
\end{pspicture}
\end{figure}
\end{document}Code: Select all
\def\RadiusB{78.39377789258259 }Code: Select all
\def\RadiusB{\calculate{\Sidelaengde/(2*sin(180/\AntalSider))} }Code: Select all
60/(2*sin(180/8)) = 78.39377789258259\RadiusB so that I do not have to re-calculate the radius of the circle (\RadiusB) manually every time I change the number of vertices of the polygon (\AntalSider) or the length of the sides in the polygon (\Sidelaengde).Thank you in advance!