Draw a path along one existing path and then another
I have drawn two shapes in the code below, a red circle, and a black
rectangle. I have labeled four points, A, B, C and D. I would like to know
how to draw a path along the black rectangle from A to B, along the red
circle from B to C, and then back along the black rectangle from C to D
back to A.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\draw[name path=p0] (0,.8) node[above left] {$D$} -- ++(3,0) |- (0,2)
node[above left] {$A$} -- cycle;
\draw[red,name path=p2] (2.5,2) circle (1.5cm);
\fill[name intersections={of=p0 and p2}] (intersection-1) circle (2pt)
node[below left] {$C$} (intersection-2) circle (2pt) node[above left]
{$B$};
\end{tikzpicture}
\end{document}
No comments:
Post a Comment