2

Consider the following (non-minimal) example of a rotation of a quadrilateral around a point:

\documentclass{article}

\usepackage{pstricks-add}
\usepackage{xfp}

\begin{document}

\def\Ax{-1}
\def\Ay{4}
\def\Bx{-2}
\def\By{3}
\def\Cx{-1}
\def\Cy{1}
\def\Dx{0}
\def\Dy{3}
\def\Ex{1}
\def\Ey{2}
\def\rotation{90}
\def\punkt(#1){%
  \def\str{0.1}
  \rput(#1){%
    \psline(-\str,-\str)(\str,\str)
    \psline(-\str,\str)(\str,-\str)}
  \uput[45](#1){$#1$}}%
\begin{pspicture}(-2.45,-1.12)(2.05,4.4)
  \pnodes(\Ax,\Ay){A}(\Bx,\By){B}(\Cx,\Cy){C}(\Dx,\Dy){D}(\Ex,\Ey){E}
 {\psset{
    linewidth = 1.5\pslinewidth,
    fillstyle = solid,
    fillcolor = cyan!50
  }
  \pspolygon(A)(B)(C)(D)
  \psrotate(E){\rotation}{%
    \pspolygon[
      linecolor = red
    ](\Ax,\Ay)(\Bx,\By)(\Cx,\Cy)(\Dx,\Dy)
  \uput[180]{\fpeval{360-\rotation}}(\Ax,\Ay){$A'$}
  \uput[270]{\fpeval{360-\rotation}}(\Bx,\By){$B'$}
  \uput[90]{\fpeval{360-\rotation}}(\Cx,\Cy){$C'$}
  \uput[90]{\fpeval{360-\rotation}}(\Dx,\Dy){$D'$}}}
  \uput[90](A){$A$}
  \uput[180](B){$B$}
  \uput[270](C){$C$}
  \uput[0](D){$D$}
  \punkt(E)
\end{pspicture}

\end{document}

output

The nodes A'--D' are not placed as I expected; I would like A' to be placed to the left of the vertex A, B' below the vertex B, and so on.

How do I achieve this?

3

The trick (!!) is to not forget the polar axis, used for the direction along which the label is put, was also rotated. Whence:

\documentclass{article}

\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}

\begin{document}

\def\Ax{-1}
\def\Ay{4}
\def\Bx{-2}
\def\By{3}
\def\Cx{-1}
\def\Cy{1}
\def\Dx{0}
\def\Dy{3}
\def\Ex{1}
\def\Ey{2}
\def\rotation{90}
\def\punkt(#1){%
  \def\str{0.1}
  \rput(#1){%
    \psline(-\str,-\str)(\str,\str)
    \psline(-\str,\str)(\str,-\str)}
  \uput[45](#1){$#1$}}%
\begin{pspicture}(-2.45,-1.12)(2.05,4.4)
  \pnodes(\Ax,\Ay){A}(\Bx,\By){B}(\Cx,\Cy){C}(\Dx,\Dy){D}(\Ex,\Ey){E}
 {\psset{
    linewidth = 1.5\pslinewidth,
    fillstyle = solid,
    fillcolor = cyan!50
  }
  \pspolygon(A)(B)(C)(D)
  \psrotate(E){\rotation}{%
    \pspolygon[
      linecolor = red
    ](\Ax,\Ay)(\Bx,\By)(\Cx,\Cy)(\Dx,\Dy)
  \uput[90]{-\rotation}(\Ax,\Ay){$A'$}
  \uput[180]{-\rotation}(\Bx,\By){$B'$}
  \uput[-90]{-\rotation}(\Cx,\Cy){$C'$}
  \uput[0]{-\rotation}(\Dx,\Dy){$D'$}}}
  \uput[90](A){$A$}
  \uput[180](B){$B$}
  \uput[270](C){$C$}
  \uput[0](D){$D$}
  \punkt(E)
\end{pspicture}

\end{document}

enter image description here

  • You're welcome. It's a pleasure to help. – Bernard Jun 6 '16 at 19:34
  • @SvendTveskæg: I don't even remember what the removed code was supposed to do. If it works without it, I agree, of course. Thanks for having simplified! – Bernard Apr 22 '17 at 13:47
2
\uput[180]{E}(\Ax,\Ay){$A'$}
\uput[270]{E}(\Bx,\By){$B'$}
\uput[0]{E}(\Cx,\Cy){$C'$}
\uput[90]{E}(\Dx,\Dy){$D'$}}}
  • This only works for a rotation of 90 degrees, I think. – Svend Tveskæg Jun 15 '16 at 23:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.