我尝试了 和(O.center)
,(F.center)
但圆弧没有在线 处结束FS
。我该如何构造这个圆弧?
\documentclass[tikz,convert=false]{standalone}
\usetikzlibrary{intersections, arrows, backgrounds, calc}
\begin{document}
\begin{tikzpicture}[
every label/.append style = {font = \small},
dot/.style = {inner sep = +0pt, shape = circle,
draw = black, label = {#1}},
small dot/.style = {minimum size = .05cm, dot = {#1}},
big dot/.style = {minimum size = .1cm, dot = {#1}},
extended line/.style = {shorten >=-#1, shorten <=-#1},
extended line/.default = 1cm,
one end extended/.style = {shorten >=-#1},
one end extended/.default = 1.25cm, line cap = round, line join = round,
>=triangle 45]
\pgfmathsetmacro{\a}{3}
\pgfmathsetmacro{\b}{2.5}
\pgfmathsetmacro{\c}{sqrt(\a^2 - \b^2)}
\node[fill = black, big dot = {below left: \(A\)}] (A) at (-3, 0) {};
\node[fill = black, big dot = {below right: \(P\)}] (P) at (3, 0) {};
\node[fill = black, big dot = {below left: \(D\)}] (D) at (0, -2.5) {};
\node[fill = black, big dot = {above left: \(B\)}] (B) at (0, 2.5) {};
\node[fill = black, big dot = {below left: \(F\)}] (F) at (\c, 0) {};
\node[fill = black, big dot = {below left: \(O\)}] (O) at (0,0) {};
\draw (0, -3.25) -- (0, 3.25) node[scale = .75, fill = white,
inner sep = 0cm, pos = .7] {\(b\)};
\draw[name path = xline] (-3.25, 0) -- (5, 0) node[scale = .8, fill = white,
inner sep = 0cm, pos = .2] {\(a\)};
\draw[red, name path = circle] (O) circle (3cm);
\draw[blue, name path = ellipse] (O) ellipse (3cm and 2.5cm);
\path[name path = line] (2.25, 3) -- (2.25, -1);
\path[name intersections = {of = circle and line, by = P1}];
\node[fill = black, big dot = {above: \(Q\)}] (Q) at (P1) {};
\path[name intersections = {of = line and xline, by = P2}];
\draw[black] (Q) -- (P2) node[fill = black, big dot = {below right: \(V\)}]
(V) at (P2) {};
\path[name intersections = {of = line and ellipse, by = P3}];
\node[fill = black, big dot = {right: \(S\)}] (S) at (P3) {};
\draw (O) -- (Q) node[scale = .75, pos = .5, fill = white, inner sep = 0cm]
{\(a\)};
\draw[one end extended] (F) -- (S) node[scale = .8, pos = .5,
fill = white, inner sep = 0.03cm] {\(r\)} coordinate (P4);
\begin{scope}[on background layer]
\begin{scope}
\clip (S) rectangle (P);
\shadedraw[blue, outer color = blue!30!black, inner color = red!30] (O) ellipse (3cm and 2.5cm);
\end{scope}
\filldraw[bottom color = cyan!50!blue, top color = green!20] (S.center) -- (F.center) -- (V.center) -- cycle;
\end{scope}
\draw[latex-latex] let
\p0 = (O),
\p1 = (P),
\p2 = (P4),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {3.5cm}
in (O.center) +(\n1:\n3) arc[radius = \n3, start angle = \n1,
end angle = \n2];
\end{tikzpicture}
\end{document}
有问题的代码摘录如下:
\draw[latex-latex] let
\p0 = (O),
\p1 = (P),
\p2 = (P4),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {3.5cm}
in (O.center) +(\n1:\n3) arc[radius = \n3, start angle = \n1,
end angle = \n2];
答案1
我会找到箭头应与两条路径的交点结束的坐标:
代码
\documentclass[tikz,convert=false]{standalone}
\usetikzlibrary{intersections, arrows, calc, backgrounds}
\begin{document}
\begin{tikzpicture}[
every label/.append style = {font = \small},
dot/.style = {inner sep = +0pt, shape = circle,
draw = black, label = {#1}},
big dot/.style = {minimum size = .1cm, dot = {#1}},
extended line/.style = {shorten >=-#1, shorten <=-#1},
extended line/.default = 1cm,
one end extended/.style = {shorten >=-#1},
one end extended/.default = 1.25cm, line cap = round, line join = round,
>=triangle 45]
\pgfmathsetmacro{\a}{3}
\pgfmathsetmacro{\b}{2.5}
\pgfmathsetmacro{\c}{sqrt(\a^2 - \b^2)}
\node[fill = black, big dot = {below right: \(P\)}] (P) at (3, 0) {};
\node[fill = black, big dot = {below left: \(F\)}] (F) at (\c, 0) {};
\node[fill = black, big dot = {below left: \(O\)}] (O) at (0,0) {};
\draw[blue, name path = ellipse] (O) ellipse (3cm and 2.5cm);
\path[name path = line] (2.25, 3) -- (2.25, -1);
\path[name intersections = {of = line and ellipse, by = P3}];
\node[fill = black, big dot = {right: \(S\)}] (S) at (P3) {};
\draw[one end extended] (F) -- (S) node[scale = .8, pos = .5,
fill = white, inner sep = 0.03cm] {\(r\)} coordinate[pos=2] (P4);
\path[name path=bigCircle] (O) circle [radius=3.5cm];
\path[name path=longFS] (F) -- (P4);
\tikzset{name intersections={of=bigCircle and longFS,by=P4}}
\draw[latex-latex] let
\p0 = (O),
\p1 = (P),
\p2 = (P4),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {3.5cm}
in (O.center) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2];
\end{tikzpicture}
\end{document}