TikZ 包:圆弧与线交点的坐标

TikZ 包:圆弧与线交点的坐标

我一直在尝试创建一些圆弧和直线的交点。

这是我的代码:

\coordinate (A) at (0, 5);
\coordinate[label=below:$M$] (B) at (0, 0);
\coordinate (C) at (5, 0);
\path[name=arc1] (C) arc[start angle=0, end angle=90, radius=5cm];
\coordinate (D) at (intersection of arc1 and 1,0--1,5); % throws error
            
\draw[help lines] (0, 0) grid (5, 5); % draw grid
\draw[line width=0.5mm] (A) -- (B) -- (C) arc[start angle=0, end angle=90, radius=5cm] -- cycle; % draw quarter circle

所需交叉路口

图像中的黄点是我希望这些交点所在的位置。LaTeX 会抛出一个错误,(intersection of arc1 and 1,0--1,5)因为显然arc1没有定义,尽管我[name=arc1]在定义圆弧时写了。

答案1

多个交叉路口

\documentclass[tikz,border=3.14mm]{standalone}

\usetikzlibrary{intersections}

\begin{document}
    \begin{tikzpicture}
    
        \draw[help lines] (0, 0) grid (5, 5);
        \coordinate (A) at (0, 5);
        \coordinate[label=below:$M$] (B) at (0, 0);
        \coordinate (C) at (5, 0);
        \draw[name path=arc] (C) arc[start angle=0, end angle=90, radius=5cm];
        \path[name path=lines] (0,0) -| (1,5) -| (2,0) -| (3,5) -| (4,0);
        \fill[name intersections={of=arc and lines, name=i, total=\t}][yellow,opacity=0.5,every node/.style={above right,black,opacity=1}]\foreach\s in {1,...,\t}{(i-\s)circle(2pt)node{\footnotesize\s}};
        
    \end{tikzpicture}
\end{document}

相关内容