圆弧与直线的交点

圆弧与直线的交点

我想找到圆弧和直线的交点。但我收到错误“我不知道路径名‘curc’”

\begin{tikzpicture}[scale=1, font=\footnotesize, line join=round, line cap=round, >=stealth]

\path (0:0) coordinate(a) (10:5) coordinate(b) (90:6) coordinate(d) ($(b)+(d)-(a)$) coordinate(c) ($(a)!.5!(b)$) coordinate(m);

\begin{scope}[shift={(m)}]

\def\au{1.2} \def\bu{.5}

\draw[name path=curc] (0:\au) coordinate(A) arc (0:-160:{\au} and {\bu});

\end{scope}

\path[name path=ab] (a)--(b);

\path[name intersections={of=curc and ab,by={I}}];

\end{tikzpicture}

答案1

  • 请始终提供可重现问题的 MWE
  • 抱歉,您的问题不太清楚。您想从代码片段中得到什么?只是说明一个或多个交叉点?
  • 您的代码片段不完整。
  • 代码片段中定义的路径不相交

为了说明起见,您可以简化图片代码,例如:

\documentclass[tikz,border=3.141592]{standalone}
\usetikzlibrary{intersections}
\usepackage[low-sup]{subdepth}

\begin{document}
    \begin{tikzpicture}[
dot/.style = {circle, fill=orange, semitransparent, inner sep=1.2pt},
every label/.append style = {inner sep=1pt, font = \footnotesize}
                        ]
\def\au{1}
\def\bu{.5}

\path   (185:2.5)   coordinate[label=a] (a)
        ( 15:2.5)   coordinate[label=b] (b);
\draw[name path=C] (30:\au) coordinate[label=A] (A) arc (0:-160:{\au} and {\bu});
\draw[name path=ab] (a) -- node[above, sloped] {m} (b);
\path[name intersections={of=C and ab, by=s}]
        node[dot, label=below:$s$] at (s) {};
    \end{tikzpicture}
\end{document}

在此处输入图片描述

如果您想指示两个交叉点,则对于交叉点代码使用:

\path[name intersections={of=C and ab, by={s1,s2}}]
        node[dot, label=below:$s_1$] at (s1) {}
        node[dot, label=below:$s_2$] at (s2) {};

你将获得:

在此处输入图片描述

答案2

扩大范围可能会有所帮助

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc, shadings, shadows, shapes.arrows}
\usetikzlibrary{positioning, intersections}
\tikzset{mark coordinate/.style={inner sep=0pt,
        outer sep=0pt,
        minimum size=3pt,
        fill=#1,
        circle}
}
\begin{document}
    \begin{tikzpicture}[scale=1, font=\footnotesize, line join=round, line cap=round, >=stealth]
        
        \path   (0:0) coordinate[label=a](a) 
                (10:5) coordinate[label=b](b) 
                (90:6) coordinate[label=d](d) 
                ($(b)+(d)-(a)$) coordinate[label=c](c) 
                ($(a)!.5!(b)$) coordinate[label=m](m);
        
        \begin{scope}[shift={(m)}]
            
            \def\au{1} 
            \def\bu{.9}
            
            \draw[name path=curc] 
            (40:\au) coordinate[label=A](A) 
            arc (0:-160:{\au} and {\bu});
            
    
        
        \draw[name path=ab] (a)--(b);
        
        \draw[name intersections={of=curc and ab,by={I}}];
        
        \fill [name intersections={of=curc and ab, name=l}] 
        (l-1) coordinate [mark coordinate=orange]; 
            \end{scope}
    \end{tikzpicture} 
\end{document}

在此处输入图片描述

相关内容