How to invert a parabola bend in TikZ
You've used bend left
/bend right
earlier in the drawing, use that again, and it works fine. For example \draw[fill=white] (8.5,0) to[bend right] (4.5,0);
This image shows output of your original code, with some style changes. The blue arrow is made with bend left
, the dashed red line with parabola bend
. They're not 100% equivalent, but very close.
Speaking of the arrow tips, do you want to make them larger (they're hardly visible)? Or remove them altogether?
Some other comments:
- The
hyperref
package should in general be loaded late, see Which packages should be loaded after hyperref instead of before? - As I mentioned in a comment, you need to place the
\label
after the\caption
, or cross references wont work, see Why does an environment's label have to appear after the caption? - Your
scope
environment doesn't really do anything useful. - I added
\centering
before\begin{tikzpicture}
- In the block starting with
%Draw Pin-Cushion Distortion
, you have an empty node in each line, which isn't needed. - When you draw the lines between the corners, you also have
fill=lime
. Did you intend to fill any region withlime
, or is that just something you've forgotten to remove?
That said, here is a complete example. Using named coordinates can be useful sometime, I rewrote the code to show one method using such. Of course, you don't have to use it.
\documentclass{article}
\usepackage[usenames,dvipsnames,x11names]{xcolor}
\usepackage{tikz}
\usepackage{hyperref}
\begin{document}
\begin{figure}[ht]
\centering
\begin{tikzpicture} %detector on right (Pin-Cushion distorted)
\begin{scope}[every label/.style={font=\footnotesize}]
% coordinates at outer corners
\coordinate [label=left:$A_1$] (A1) at (4,4.5);
\coordinate [label=right:$A_2$] (A2) at (9,4.5);
\coordinate [label=right:$A_3$] (A3) at (9,-0.5);
\coordinate [label=left:$A_4$] (A4) at (4,-0.5);
\end{scope}
% inner corners, relative to outer corners
\path (A1) ++(0.5,-0.5) coordinate (B1);
\path (A2) ++(-0.5,-0.5) coordinate (B2);
\path (A3) ++(-0.5,0.5) coordinate (B3);
\path (A4) ++(0.5,0.5) coordinate (B4);
%Grid and outer layers of detector
\draw[black, very thick] (A4) rectangle (A2);
\draw[black, very thick] (B4) rectangle (B2);
\draw[step=5mm,black] (B4) grid (B2);
%Anode wiring
\foreach \i in {1,...,4}
\draw (A\i) -- (B\i);
% draw and fill bendy lines
\draw[bend left,fill=white] (B4) to (B3);
\draw[bend right,fill=white] (B4) to (B1);
\draw[bend left,fill=white] (B3) to (B2);
\draw[bend left,fill=white] (B2) to (B1);
\end{tikzpicture}
\caption{An interesting diagram...}
\label{PCDistort}
\end{figure}
\end{document}
It is possible to draw the parabola bend horizontally and then rotate it. I have named the coordinates to make things easier for me:
\documentclass{article}
\usepackage{hyperref}
\usepackage[usenames,dvipsnames,x11names]{xcolor}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows,snakes,shapes}
\begin{document}
\begin{tikzpicture}
% Coordinates
\coordinate (sw) at (4.5, 0);
\coordinate (ne) at ([shift=(sw)] 4, 4);
\coordinate (nw) at (sw |- ne);
\coordinate (se) at (sw -| ne);
\coordinate[label=left:$A_1$] (A1) at ([shift=(nw)] -.5, .5);
\coordinate[label=right:$A_2$] (A2) at ([shift=(ne)] .5, .5);
\coordinate[label=right:$A_3$] (A3) at ([shift=(se)] .5, -.5);
\coordinate[label=left:$A_4$] (A4) at ([shift=(sw)] -.5, -.5);
% Grid and outer layers of detector
\draw[black, very thick] (A1) rectangle (A3);
\draw[black, very thick] (sw) rectangle (ne);
\draw[step=5mm,black] (sw) grid (ne);
% Anode wiring
\draw (A1) -- (nw);
\draw (A2) -- (ne);
\draw (A3) -- (se);
\draw (A4) -- (sw);
%Colour in distorted areas
\draw[fill=white] (sw) parabola bend +(2, .6) (se) -- cycle;
\draw[fill=white] (nw) parabola bend +(2, -.6) (ne) -- cycle;
\begin{scope}[shift=(sw), rotate=90]
\draw[fill=white] (0,0) parabola bend +(2, -.6) ++(4, 0) -- cycle;
\end{scope}
\begin{scope}[shift=(se), rotate=90]
\draw[fill=white] (0,0) parabola bend +(2, .6) ++(4, 0) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}