# How to avoid setting hard-coded values to the point arguments of pspicture?

I want to shrink and expand the canvas based on the 2 variables \Base and \Angle. The following code still use a hard-coded value for the ordinate of pspicture, which is equal to 6, for example.

I want to avoid using such a hard-coded value. I want to replace it by something that equals to Angle tan Base mul. Is there any idea to do so?

\documentclass[border=12pt]{standalone}

\def\Base{3}
\def\Angle{60}

\pstVerb
{
/Base \Base\space def
/Angle \Angle\space def
}

\begin{document}
\begin{pspicture}[showgrid=top](\Base,6)
\pspolygon[fillcolor=yellow,fillstyle=solid](!Base 0)(!0 Angle tan Base mul)
\end{pspicture}
\end{document}


-

Here is a quick hack:

\documentclass[border=12pt]{standalone}
\usepackage{fp}

\def\newconst#1#2{%
\expandafter\FPeval\csname#1\endcsname{#2}%
\pstVerb{/#1 \csname#1\endcsname\space def}%
}

% User defined constants
\newconst{Base}{4}
\newconst{Angle}{30}
\newconst{Height}{Base*tan(Angle*pi/180)}

\begin{document}

\begin{pspicture}[showgrid=top](\Base,\Height)
\pspolygon(!Base 0)(!0 Height)
\end{pspicture}

\end{document}

-
see my edit, I used fp, but it is also possible without the fp package –  Herbert Jul 11 '12 at 17:14
that was only for testing, makes it easier to see if everthing works well –  Herbert Jul 11 '12 at 18:05