2

I want to make some basic drawings of optics. I've consulted pst-optics, but this very nice package was to complicated for the drawings that I need.

My question is: I want to add a pattern on the outside of the circle (the same is the plane mirror). In fact I also need the pattern on the inside (couple of mm), but I think when I have the first, the second will be similar.

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\newcommand{\midarrow}{\tikz \draw[-triangle 60] (0,0) -- +(.1,0);}

\begin{document}
\begin{center}
\begin{tikzpicture}
\tkzInit[ymin=0,ymax=5,xmin=0,xmax=10]
\tkzClip
%\tkzGrid
\tkzDefPoints{4/1/B, 2/1/C, 6/1/D, 6/0.8/F}
\tkzDefShiftPoint[B](135:4){A};
\draw (A)-- node[sloped] {\midarrow} (B);
\tkzDrawSegment[very thick](C,D);
\draw [fill,pattern=north east lines,draw=none] (C) rectangle (F);
\end{tikzpicture}
\end{center}


\begin{tikzpicture}
\tkzInit[ymin=0,ymax=8,xmin=0,xmax=14]
\tkzClip
%\tkzGrid
\tkzDefPoints{11/4/O, 1/4/S, 6/4/F}
\tkzDefCircle[radius](O,S)
\tkzDrawCircle(O,S)
\tkzDrawPoints(O,S,F)
\tkzLabelPoints(O,S,F)
\draw [->, very thick] (11,4) -- (11,6);
\draw [thick] (0,4) -- (18,4);
\end{tikzpicture}

\end{document}

enter image description here

1
  • I updated my answer; now the radius is calculated automatically. Sep 26, 2015 at 14:32

1 Answer 1

3

Here's one option:

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\newcommand{\midarrow}{\tikz \draw[-triangle 60] (0,0) -- +(.1,0);}

\begin{document}
\begin{center}
\begin{tikzpicture}
\tkzInit[ymin=0,ymax=5,xmin=0,xmax=10]
\tkzClip
%\tkzGrid
\tkzDefPoints{4/1/B, 2/1/C, 6/1/D, 6/0.8/F}
\tkzDefShiftPoint[B](135:4){A};
\draw (A)-- node[sloped] {\midarrow} (B);
\tkzDrawSegment[very thick](C,D);
\draw [fill,pattern=north east lines,draw=none] (C) rectangle (F);
\end{tikzpicture}
\end{center}


\begin{tikzpicture}
\tkzInit[ymin=0,ymax=8,xmin=0,xmax=14]
\tkzClip
%\tkzGrid
\tkzDefPoints{11/4/O, 1/4/S, 6/4/F, 8/4/V}
\tkzDefShiftPoint[V](90:2){VV};
\tkzDefCircle[radius](O,S)
\tkzGetLength{rOSpt}
\tkzpttocm(\rOSpt){rOScm}
\tkzDrawCircle(O,S)
\tkzDrawPoints(O,S,F)
\tkzLabelPoints(O,S,F)
\draw [->, thick] (V) -- (VV);
\tkzDrawLines[add= 0.1 and 0.2](O,S);
\fill[pattern=north east lines]
  (S) arc[start angle=180,end angle=140,radius=\rOScm cm] --
  ++(-10pt,0pt) arc[start angle=140,end angle=220,radius=\rOScm cm] -- 
  ++(10pt,0pt) arc[start angle=220,end angle=180,radius=\rOScm cm];
\end{tikzpicture}

\end{document}

enter image description here

And another option using an arc instead of a full clipped circle:

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\newcommand{\midarrow}{\tikz \draw[-triangle 60] (0,0) -- +(.1,0);}

\begin{document}
\begin{center}
\begin{tikzpicture}
\tkzInit[ymin=0,ymax=5,xmin=0,xmax=10]
\tkzClip
%\tkzGrid
\tkzDefPoints{4/1/B, 2/1/C, 6/1/D, 6/0.8/F}
\tkzDefShiftPoint[B](135:4){A};
\draw (A)-- node[sloped] {\midarrow} (B);
\tkzDrawSegment[very thick](C,D);
\draw [fill,pattern=north east lines,draw=none] (C) rectangle (F);
\end{tikzpicture}
\end{center}


\begin{tikzpicture}
\def\StartAngle{150}
\def\EndAngle{210}
\tkzInit[ymin=0,ymax=8,xmin=0,xmax=14]
\tkzClip
%\tkzGrid

\tkzDefPoints{11/4/O, 1/4/S, 6/4/F, 8/4/V}
\tkzDefShiftPoint[V](90:2){VV};
\tkzDefCircle[radius](O,S)
\tkzGetLength{rOSpt}
\tkzpttocm(\rOSpt){rOScm}

% the two ends of the arc M is the upper end and N is the lower end
\tkzDefPoint[shift={(11,4)}](\StartAngle:\rOScm){M}
\tkzDefPoint[shift={(11,4)}](\EndAngle:\rOScm){N}
\tkzDrawArc(O,M)(N)
%\tkzDrawCircle(O,S)
\tkzDrawPoints(O,S,F)
\tkzLabelPoints(O,S,F)
\draw [->, thick] (V) -- (VV);
\tkzDrawLines[add= 0.1 and 0.2](O,S);
\fill[pattern=north east lines]
  (M)  --
  ++(-10pt,0pt) arc[start angle=\StartAngle,end angle=\EndAngle,radius=\rOScm cm] -- 
  ++(10pt,0pt) arc[start angle=\EndAngle,end angle=\StartAngle,radius=\rOScm cm] -- cycle;
\end{tikzpicture}

\end{document}
10
  • @ Gonzalo Medina: thanks for the added automation! Sep 26, 2015 at 14:33
  • 1
    @Arne You're welcome. In fact, I improved it a little more in my newly updated answer by using native tkz-euclide tools, so ne no need for the calc library anymore. Sep 26, 2015 at 14:44
  • 1
    @Arne Please be careful with your edits; you had \tkzDrawLines[add= 0.1 and 0.2](O,M); and this triggered an error (M was not defined); it should have been \tkzDrawLines[add= 0.1 and 0.2](O,S);. I fixed it already in my code. Sep 26, 2015 at 15:05
  • 1
    @Arne No problem. I added another option using an arc and with bettwe coding that might be of interest for you. Sep 26, 2015 at 17:23
  • 1
    @Arne Ah, I see. In that case, then yes, perhaps it's better to use the circle. Sep 26, 2015 at 18:24

You must log in to answer this question.

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