我怎样才能强调椭圆 ecc2768 上的逆时针轨迹和椭圆 ecc6789 上的顺时针轨迹?
P1
是否有一个命令可以跟随从到的省略号P2
?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections, calc, arrows, decorations.markings, backgrounds}
\tikzset{
invclip/.style={
clip,
insert path={
(-16383.99999pt,-16383.99999pt) rectangle
(16383.99999pt,16383.99999pt)
}
}
}
\begin{document}
\begin{tikzpicture}[scale = 1.75,
every label/.append style = {font = \small},
dot/.style = {outer sep = +0pt, inner sep = +0pt,
shape = circle, draw = black, label = {#1}},
dot/.default =,
small dot/.style = {minimum size = 2.5pt, dot = {#1}},
small dot/.default =,
big dot/.style = {minimum size = 5pt, dot = {#1}},
big dot/.default =,
line join = round, line cap = round, >=triangle 45
]
\pgfmathsetmacro{\e}{0.2768}
\pgfmathsetmacro{\etilde}{0.6789}
\pgfmathsetmacro{\a}{1.36}
\pgfmathsetmacro{\b}{\a * sqrt(1 - \e^2)}
\pgfmathsetmacro{\btilde}{\a * sqrt(1 - (\etilde)^2)}
\pgfmathsetmacro{\c}{sqrt(\a^2 - \b^2)}
\pgfmathsetmacro{\ctilde}{sqrt(\a^2 - (\btilde)^2)}
\pgfmathsetmacro{\angle}{88.23}
\node[scale = .75, fill = orange, big dot = {below: \(F\)}] (F)
at (0, 0) {};
\draw[red, name path = r2] (0, 0) circle (1.523679cm);
\draw[blue, name path = r1] (0, 0) circle (1cm);
\begin{pgfinterruptboundingbox}
\begin{pgfonlayer}{background}
\begin{scope}[decoration = {markings,
mark = at position 0.7 with {\arrow{<}}
}]
\path[invclip] (0, 0) -- ($(0,0)!100cm!(P1)$) -- (0cm, 100cm) --
($(0,0)!100cm!(P2)$) -- (0, 0);
\draw[name path global = ecc2768, postaction = decorate] (-\c, 0)
ellipse [x radius = \a cm, y radius = \b cm];
\end{scope}
\end{pgfonlayer}
\end{pgfinterruptboundingbox}
\draw[name intersections = {of = ecc2768 and r1}] (F) -- (intersection-1)
coordinate (P1) node[fill, big dot = {right: \(P_1\)}, minimum size = 3pt]
{};
\draw[name intersections = {of = ecc2768 and r2}] (F) -- (intersection-1)
coordinate (P2) node[fill, big dot = {left, above = 2pt: \(P_2\)},
minimum size = 3pt] {};
\path [name path global = ecc6789unrotated] (\ctilde, 0) ellipse
(\a cm and \btilde cm);
\draw [name intersections = {of = r1 and ecc6789unrotated}]
(intersection-2)
let
\p0 = (F),
\p1 = (P1),
\p2 = (intersection-2),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {\n1 - \n2}
in
\pgfextra{\xdef\myangle{\n3}}
[rotate = \n3, name path global = ecc6789rotated] (\ctilde, 0) ellipse
(\a cm and \btilde cm);
\begin{pgfinterruptboundingbox}
\begin{pgfonlayer}{background}
\path[clip] (0, 0) -- ($(0,0)!100cm!(P1)$) -- (0cm, 100cm) --
($(0,0)!100cm!(P2)$) -- (0, 0);
\draw [dashed, cyan] (-\c, 0) ellipse [x radius = \a cm,
y radius = \b cm];
\end{pgfonlayer}
\end{pgfinterruptboundingbox}
\end{tikzpicture}
\end{document}
此代码导致invclip
以下错误并且没有pdf
输出。
ERROR: Dimension too large.
--- TeX said --- <recently read>
\pgf@x l.2729 \path[invclip] ( 0, 0) -- ($(0,0)!100cm!(P1)$) -- (0cm, 100c...
--- HELP --- From the .log file...
I can't work with sizes bigger than about 19 feet. Continue and I'll use the largest value I can.
答案1
Qrrbrbirlbels 计算角度的另一种方法是使用较大的剪切路径,然后再次绘制椭圆,可能使用图层将其放置在原始椭圆后面。
这是突出显示两个任意点之间的椭圆形段的示例(我们假设我们不知道椭圆上各点的角度)。
该方法可以与 Paul Gaborit 的invclip
反转剪辑区域。
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, backgrounds}
\tikzset{
invclip/.style={
clip,
insert path={
(-16383.99999pt,-16383.99999pt) rectangle (16383.99999pt,16383.99999pt)
}
}
}
\begin{document}
\begin{tikzpicture}
\draw (0,0) ellipse [x radius=4cm, y radius=2cm];
\fill (27:4cm and 2cm) circle [radius=2pt] coordinate (P1);
\fill (137:4cm and 2cm) circle [radius=2pt] coordinate (P2);
\begin{pgfinterruptboundingbox} % To prevent the clipping path from making our picture larger
\begin{pgfonlayer}{background}
\begin{scope} % to limit the clip
\path [clip] (0,0) -- ($(0,0)!100cm!(P1)$) -- (0cm,100cm) -- ($(0,0)!100cm!(P2)$) -- (0,0);
\draw [line width=5pt, orange] (0,0) ellipse [x radius=4cm, y radius=2cm];
\end{scope}
\begin{scope} % to limit the clip
\path [invclip] (0,0) -- ($(0,0)!100cm!(P1)$) -- (0cm,100cm) -- ($(0,0)!100cm!(P2)$) -- (0,0);
\draw [line width=5pt, cyan] (0,0) ellipse [x radius=4cm, y radius=2cm];
\end{scope}
\end{pgfonlayer}
\end{pgfinterruptboundingbox}
\end{tikzpicture}
\end{document}
答案2
指定椭圆的中心点后,如下coordinate (M)
所示:
\draw[name path global = ecc2768, postaction = decorate]
(-\c, 0) coordinate (M) ellipse (\a cm and \b cm);
我们可以用以下方法重新绘制圆弧
\draw[green!50!black, thick] let \p1=($(P1)-(M)$),
\p2=($(P2)-(M)$) in
(P1) arc [x radius=+\a cm,
y radius=+\b cm,
start angle={atan2(\x1, \y1)},
end angle={atan2(\x2, \y2)}
];
该圆弧和椭圆之间似乎存在一些小的不精确性,从另一点绘制时也会发生这种情况:
\draw[yellow!50!black, thick] let \p1=($(P1)-(M)$),
\p2=($(P2)-(M)$) in
(P2) arc [x radius=+\a cm,
y radius=+\b cm,
start angle={atan2(\x2, \y2)},
end angle={atan2(\x1, \y1)}
];
这可能会或可能不会被手动纠正。
代码
\documentclass[border=5mm,convert=false]{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections, calc, arrows, decorations.markings}
\begin{document}
\begin{tikzpicture}[scale = 1.75,
every label/.append style = {font = \small},
dot/.style = {outer sep = +0pt, inner sep = +0pt,
shape = circle, draw = black, label = {#1}},
dot/.default =,
small dot/.style = {minimum size = 2.5pt, dot = {#1}},
small dot/.default =,
big dot/.style = {minimum size = 5pt, dot = {#1}},
big dot/.default =,
line join = round, line cap = round, >=triangle 45
]
\pgfmathsetmacro{\e}{0.2768}
\pgfmathsetmacro{\etilde}{0.6789}
\pgfmathsetmacro{\rone}{1}
\pgfmathsetmacro{\rtwo}{1.524}
\pgfmathsetmacro{\deltanu}{107}
\pgfmathsetmacro{\a}{1.36}
\pgfmathsetmacro{\am}{1.1442}
\pgfmathsetmacro{\s}{2 * \am}
\pgfmathsetmacro{\cord}{2 * \s - \rone - \rtwo}
\pgfmathsetmacro{\b}{\a * sqrt(1 - \e^2)}
\pgfmathsetmacro{\btilde}{\a * sqrt(1 - (\etilde)^2)}
\pgfmathsetmacro{\c}{sqrt(\a^2 - \b^2)}
\pgfmathsetmacro{\ctilde}{sqrt(\a^2 - (\btilde)^2)}
\pgfmathsetmacro{\angle}{88.23}
\draw[dashed, rotate = \angle] (-\a + \ctilde, 0) -- (\a + \ctilde, 0);
\draw[dashed] (-\a - \c, 0) -- (\a - \c, 0);
\node[scale = .75, fill = orange, big dot = {below: \(F\)}] (F)
at (0, 0) {};
\node[scale = .75, fill = white, big dot = {below: \(F^*\)}] (FS)
at (-2 * \c cm, 0) {};
\draw[red, name path = r2] (0, 0) circle (1.523679cm);
\draw[blue, name path = r1] (0, 0) circle (1cm);
\begin{scope}[decoration = {markings,
mark = at position 0.15 with {\arrow{>}},
mark = at position 0.7 with {\arrow{<}}
}]
\draw[name path global = ecc2768, postaction = decorate] (-\c, 0) coordinate (M) ellipse (\a cm and \b cm);
\end{scope}
\draw[name intersections = {of = ecc2768 and r1}] (F) -- (intersection-1)
coordinate (P1) node[fill, big dot = {right: \(P_1\)}, minimum size = 3pt]
{};
\draw[name intersections = {of = ecc2768 and r2}] (F) -- (intersection-1)
coordinate (P2) node[fill, big dot = {left, above = 2pt: \(P_2\)},
minimum size = 3pt] {};
\draw[green!50!black, thick] let \p1=($(P1)-(M)$),
\p2=($(P2)-(M)$) in
(P1) arc [x radius=+\a cm,
y radius=+\b cm,
start angle={atan2(\x1, \y1)},
end angle={atan2(\x2, \y2)}
];
\draw[yellow!50!black, thick] let \p1=($(P1)-(M)$),
\p2=($(P2)-(M)$) in
(P2) arc [x radius=+\a cm,
y radius=+\b cm,
start angle={atan2(\x2, \y2)},
end angle={atan2(\x1, \y1)}
];
\end{tikzpicture}
\end{document}