# Projection of included 2D graphics to a plane

## General purpose

I want to project a graphic file from external sources (example.pdf saved on my computer e.g. a chip design) on the bottom of a 3D graphic (which I can draw in LaTeX by using TikZ, pstrick or asymptote).

I know that it works for text letters, see How to project text onto a plane?. So I guess that it would also work with an included graphics!

## Example using TikZ

I also achieved a minor step towards this goal but I am not happy with performing a 2D rotation in 3D. How can I configure the command

/tikz/cm={a, b, c, d, coordinate}


in order to perform a 3D rotation? The command is given in the tikz-pgf manual (v3.0.0, p.363) in chapter 25.3. Or is there a simpler way to go? Also Canvas Transformation could be used...

By the way, I perform 3D rotations by using

\tdplotsetmaincoords{phi}{theta}


which is contained in the package tikz-3dplot.

See my MWE:

\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{3D,calc}

\begin{document}

\begin{tikzpicture}
\coordinate (chip) at (0,0,0);
\node[cm={1,0,cos(20),sin(20),(0,0)}] at (coordA){\includegraphics[width=20em]{example.pdf}};
\end{tikzpicture}
\end{document}


## Asymptote

I am also interested whether I can include graphics with asymptote or not.

## Supplementary information

If you are further interested in what it is about read this part. A potential chip design in 2D looks like the following:

Two horizontally oriented boxes should be posed on top of such a chip drawing.

-
For someone who is already used to LaTeX, the simplest way to include graphics in Asymptote is to create a label with the text (in your case) "\includegraphics[width=20em]{example.pdf}". Two notes here. First, if your included graphic is anything other than an eps file, then you need to make sure the line settings.tex="pdflatex"; shows up near the beginning of your asymptote code. Second, this will only work if your label is positioned using 2d coordinates; if you try to position it directly in the 3d picture, it will show up as a great big black rectangle. –  Charles Staats Jan 18 at 22:10

Not sure if this is what you want, but adapting the code provided by Alain Matthes in How to project text onto a plane? is easy to obtain

The code is:

\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usepackage{mwe}
\usetikzlibrary{3D,calc}

\begin{document}

\begin{tikzpicture}[x={(0.5cm,0.5cm)}, y={(1cm,0cm)}, z={(0cm,1cm)}]
\begin{scope}[canvas is yx plane at z=0]
\node[draw,transform shape] (a) {\includegraphics[width=20em]{example-image.pdf}};
\end{scope}

\foreach \i in {south west, south east, north east, north west}
\draw[dashed] (a.\i) --++(0,0,2) coordinate(b-\i);

\draw (b-south west)--(b-south east)--(b-north east)--(b-north west)--cycle;

\end{tikzpicture}
\end{document}

-
In principle you're completely right. My goal is to draw only smaller boxes on part of the image, e.g. drawing some items (fan etc.) on top of a motherboard. I thought also of rotating the image. In addition the boxes on top of it have some orientation which is refusing the additional rotation of the image. –  strpeter Jan 20 at 8:01
@strpeter I'm sorry but I don't understand what's your problem. Could you show us an image with your wrong results? What's this "additional rotation"? –  Ignasi Jan 20 at 18:03