# rotate a polygon around point

I have the following code:

\documentclass[a4paper]{article}
\usepackage{pstricks}
\usepackage{pst-plot}
\begin{document}
\begin{pspicture}(-6,-10)(10,10)
\psset{xunit=1cm,yunit=1cm,linewidth=0.5\pslinewidth}
\psgrid[gridcolor=lightgray,subgridcolor=lightgray,subgriddiv=2, gridlabels=0](-10,-10)(10,10)(-10,-10)
\psaxes[xsubticks=2,xsubticksize=0.5,showorigin=false,ticks=all]{->}(0,0)(-10,0)(10,0)
\psaxes[ysubticks=2,ysubticksize=0.5,showorigin=false]{->}(0,0)(0,-10)(0,10)
\psset{linewidth=3\pslinewidth}
\psdots(3,4)\uput{0.2}(3,4){$P(3|4)$}
\pspolygon
(6,-4)
(7,-4)
(7,-3)
(8,-3)
(8,-4)
(9,-4)
(9,-2)
(8,-2)
(8,1)
(9,1)
(9,3)
(8,3)
(8,2)
(7,2)
(7,3)
(6,3)
(6,1)
(7,1)
(7,-2)
(6,-2)
(6,-4)
\end{pspicture}
\end{document}


When using \rput, the polygon seems to be rotated around O(0/0), but I want it to be rotated arount P(3/4) instead. Using the translation feature \rput[tl]{-120}(3,4){...} doesn't work, either. I'm sure, I'm missing something very obvious, but I don't get it...

Can anyone help?

You can use a nested \rput to rotate something relative to another coordinate point. For example, using "pseudo code":

\rput{<angle>}(<point>){
\rput(-<point>){
<stuff>
}
} \documentclass[a4paper]{article}
\usepackage{pstricks}
\usepackage{pst-plot}
\begin{document}

\begin{pspicture}(-6,-10)(10,10)
\psset{xunit=1cm,yunit=1cm,linewidth=0.5\pslinewidth,fillstyle=solid}
\psgrid[gridcolor=lightgray,subgridcolor=lightgray,subgriddiv=2, gridlabels=0](-10,-10)(10,10)(-10,-10)
\psaxes[xsubticks=2,xsubticksize=0.5,showorigin=false,ticks=all]{->}(0,0)(-10,0)(10,0)
\psaxes[ysubticks=2,ysubticksize=0.5,showorigin=false]{->}(0,0)(0,-10)(0,10)
\psset{linewidth=3\pslinewidth}
\psdots(3,4)\uput{0.2}(3,4){$P(3|4)$}
\pspolygon[fillcolor=red]
(6,-4)(7,-4)(7,-3)(8,-3)(8,-4)(9,-4)(9,-2)(8,-2)(8,1)
(9,1)(9,3)(8,3)(8,2)(7,2)(7,3)(6,3)(6,1)(7,1)(7,-2)
(6,-2)(6,-4)
(6,-4)(7,-4)(7,-3)(8,-3)(8,-4)(9,-4)(9,-2)(8,-2)(8,1)
(9,1)(9,3)(8,3)(8,2)(7,2)(7,3)(6,3)(6,1)(7,1)(7,-2)
(6,-2)(6,-4)}
\rput{-90}(3,4){\pspolygon[fillcolor=blue]% Rotated about P (3,4), with all coordinates relative to P
(6,-4)(7,-4)(7,-3)(8,-3)(8,-4)(9,-4)(9,-2)(8,-2)(8,1)
(9,1)(9,3)(8,3)(8,2)(7,2)(7,3)(6,3)(6,1)(7,1)(7,-2)
(6,-2)(6,-4)}
`