Tikz 004
Tikz 004
However, he wisely decides that shadings usually only distract without adding anything to the picture.
Karl used the fact sin 30◦ = 1/2. However, he very much doubts that his students know this, so it would
be nice to have a way of specifying “the point straight down from (30:1cm) that lies on the x-axis”. This
is, indeed, possible using a special syntax: Karl can write (30:1cm |- 0,0). In general, the meaning of
(hpi |- hqi) is “the intersection of a vertical line through p and a horizontal line through q”.
Next, let us draw the cosine line. One way would be to say (30:1cm |- 0,0) -- (0,0). Another way
is the following: we “continue” from where the sine ends:
\begin{tikzpicture}[scale=3]
\clip (-0.1,-0.2) rectangle (1.1,0.75);
\draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4);
\draw (-1.5,0) -- (1.5,0);
\draw (0,-1.5) -- (0,1.5);
\draw (0,0) circle [radius=1cm];
\filldraw[fill=green!20,draw=green!50!black] (0,0) -- (3mm,0mm)
arc [start angle=0, end angle=30, radius=3mm] -- cycle;
\draw[red,very thick] (30:1cm) -- +(0,-0.5);
\draw[blue,very thick] (30:1cm) ++(0,-0.5) -- (0,0);
\end{tikzpicture}
Note that there is no -- between (30:1cm) and ++(0,-0.5). In detail, this path is interpreted as follows:
“First, the (30:1cm) tells me to move my pen to (cos 30◦ , 1/2). Next, there comes another coordinate
40