4

Is it possible to use either less than 3 \rput or just a single \uput to rotate and translate the following object? Please don't use other transformation macros because my intent is to learn how \rput and \uput work.

enter image description here

\documentclass[border=12pt]{standalone}
\usepackage{pstricks}
\def\obj#1{\psline[linecolor=#1](2,6)(6,6)(7,3.5)(6,1)\ignorespaces}

\begin{document}
\begin{pspicture}[showgrid](8,6)
    \obj{red}
\end{pspicture}
\qquad
\begin{pspicture}[showgrid](8,6)
    \obj{red}
    \rput(6,1){\rput{180}(0,0){\rput(-2,-6){\obj{blue}}}}
\end{pspicture}
\end{document}

3 Answers 3

7
\documentclass[border=12pt]{standalone}
\usepackage{pstricks}
\def\obj#1{\psline[linecolor=#1](2,6)(6,6)(7,3.5)(6,1)\ignorespaces}

\begin{document}
\begin{pspicture}[showgrid](8,6)
    \obj{red}
\end{pspicture}
\qquad
\begin{pspicture}[showgrid](8,6)
    \obj{red}
    \rput{180}(8,7){\obj{blue}}
\end{pspicture}
\end{document}
1
  • Genius! I am waiting for another answer with \uput if possible. Thank you! May 3, 2013 at 12:16
0
\documentclass[border=12pt]{standalone}
\usepackage{pstricks}
\def\obj#1{\psline[linecolor=#1](2,-2.5)(3,0)(2,2.5)(-2,2.5)}

\begin{document}
\begin{pspicture}[showgrid](-4,-4)(4,4)
    \obj{red}
\end{pspicture}
\qquad
\begin{pspicture}[showgrid](-4,-4)(4,4)
    \obj{red}%
    \rput{180}{\obj{blue}}
\end{pspicture}
\end{document}
2
  • The only "bonus" here is the shift in origin via a different pspicture, which drops a coordinate addition to \rput (or it defaults to (0,0)). Hmmmm...
    – Werner
    May 3, 2013 at 20:03
  • Practically \obj and pspicture should not be changed because it will affect the existing other objects. May 3, 2013 at 20:05
0

The following is taken from the PSTricks bible.

enter image description here

Thus there are infinite number of ways to invoke \uput to mimic \rput{180}(8,7){\obj} (the answer given by David Carlisle).

As an example, I choose

\uput{1}[60]{180}(!8 1 2 div sub 7 3 sqrt 2 div sub){\obj{blue}}

Honestly, I don't know when we have to use \uput instead of \rput (in the case of handling zero dimensional objects). Is it just a personal preference?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .