I'm preparing a presentation about microcomputed tomography and it's been a while since I used TikZ.
I cannot figure out how I can rotate a grey xray cone in the drawing below around the center of the drawing.
\documentclass[export]{standalone}
\usepackage{animate}
\usepackage{tikz}
\begin{document}
\begin{animateinline}[autoplay,loop]{10}
\multiframe{36}{n=1+1}{
\begin{tikzpicture}[scale=2]
% Coordinate network
% \draw[help lines,step=0.5cm,ultra thin] (-1.45,-1.45) grid (1.45,1.45);
\draw[->] (-1.75,0) -- (1.75,0);
\draw[->] (0,-1.75) -- (0,1.75);
% Rotation arc
\draw[->, ultra thick,rotate around={\n*10:(0,0)}] (1,0) arc [start angle=0, end angle=180, radius=1];
\draw[->, ultra thick,rotate around={\n*10:(0,0)}] (-1,0) arc [start angle=-180, end angle=0, radius=1];
% Stuff
\fill[red,rotate around={\n*10:(0,0)}] (-0.25,1) rectangle node (source) [black,fill=white, semitransparent, text opacity=1] {X-ray} +(0.5,0.5);
\fill[green] (-0.25,-0.25) rectangle node [black,fill=white, semitransparent, text opacity=1] {Sample} +(0.5,0.5) ;
\fill[blue,fill,rotate around={\n*10:(0,0)}] (-0.5,-1.25) rectangle node (detector) [black,fill=white, semitransparent, text opacity=1] {Detector} +(1,0.25);
\draw[rotate around={\n*10:(0,0)}] (-0.5,-1) node (edgeleft) {L};
\draw[rotate around={\n*10:(0,0)}] (0.5,-1) node (edgeright) {R};
% Cone, based on section 4.1.5 in pgfmanual.pdf
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
\coordinate (A) at (-0,1);
\coordinate (B) at (-0.25,-1);
\coordinate (C) at (0.25,-1);
\begin{pgfonlayer}{background}
\fill[blue,semitransparent] (A) -- (B) -- (C) -- cycle;
\fill[gray,semitransparent] (source) -- (B) -- (C) -- cycle;
\fill[green, ultra thick] (source) -- (edgeleft) -- (edgeright) -- cycle;
\draw [red] (source) -- (detector);
\end{pgfonlayer}
\end{tikzpicture}
}
\end{animateinline}
\end{document}
It feels to me that I should just be able to draw a polygon from source to the two edges of the detector (as I tried in the code, commented out), but this does not work.
Drawing a
- (red) rotating pencil beam (red)
- (blue) 'static' cone based on the three coordinates in the code (straight from the manual :) )
- and a (grey) moving cone from the source to the starting position of the detector
works all fine, but I need a moving cone pointing from source to the edges of the detector.
The only thing that I manage is a (green) line to the edgeleft.
This green line is extremely thin and only visible in the compiled PDF...
Can someone provide me some insight on how I can rotate around the gray cone?
PS1: The animated gifs were exported with ImageMagick and this command
PS2: The styling of the animation is far from final, but first I need rotation :)



scope. I'll use that in my final version. Funny that with your conversion the faint green line is still visible, while in mine it isn't. – Habi Nov 08 '19 at 19:37