2

I would like to be able to direct an image from a fixed point in a pspicture to various locations in the picture individual specifying angles and radii from that point.

Consider the code (which I compile with xelatex)

\documentclass[12pt]{book} \usepackage{pstricks,psvectorian} \usepackage{xcolor,graphicx}

\begin{document} \thispagestyle{empty} \begin{pspicture}(-5,-5)(4,4)% \psframe[fillcolor=blue!65!red,fillstyle=solid](-5,-5)(5,12) \psframe[linecolor=blue!65!red](-5,-5)(5,12) \rput[tr]{-45}(1.75,1.75){\psvectorian[width=2.1cm,color=white]{63}} \rput(-2,2){\includegraphics[width=2em]{example-image-b}} \rput(-1,1){\includegraphics[width=2em]{example-image-a}} \end{pspicture}% \end{document} 

which produces

enter image description here

In the case of the MWE, I would like to fix the Cartesian point (-1,1) (which contains Image A) and project it to the point (-2,2) (which now contains Image B) by specifying the angle (-45 degree) and a radius of \sqrt{2}. If this can be done, then I can proceed to scatter Image A (with various scaling factors individually assigned) to other locations in the pspicture. This would be a lot easier, I think, than using the common plotting method since the type of plotting I need this for involves thinking of the angles and radii prior to plotting the image.

QUESTION: How may I direct Image A from the Cartesian point (-1,1) to say, the following three locations: (1) angle=-45 (deg); radius=\sqrt{2}. (2) angle=90; radius=3. and (3) angle=30; radius=2.5?

Thank you.

1 Answer 1

1

If you don't mind switching to lualatex, you can do this with Metapost, wrapped up in luamplib which gives you full access to LaTeX packages for labels, and to a complete language for drawing.

enter image description here

\documentclass[border=5mm]{standalone} \usepackage{luamplib} \usepackage{psvectorian} \usepackage{graphicx} \begin{document} \mplibtextextlabel{enable} \begin{mplibcode} beginfig(1); fill unitsquare shifted -(1/2, 1/2) scaled 8cm withcolor 2/3[red, blue]; label("\psvectorian[color=white, width=2cm]{63}", origin) rotated -45; label("\includegraphics[width=2em]{example-image-a}", sqrt(2) * cm * dir -45); label("\includegraphics[width=2em]{example-image-a}", 3 cm * dir 90); label("\includegraphics[width=2em]{example-image-a}", 2.5 cm * dir 30); endfig; \end{mplibcode} \end{document} 

Compile this with lualatex to produce a PDF file directly.

1
  • Thank you for your answer (and for overlooking my error of -45 degrees in stating the problem, which should have been 135 degrees). Although I had been looking for an answer that modifies the MWE, I nevertheless appreciate your answer Metapost approach---Metapost being something that I had wanted to become more familiar with. Commented May 19, 2022 at 23:09

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.