在Tikz:曲线的单位切向量,Jake 帮助为椭圆添加了切向量。然而,在那道题中,椭圆的半长轴和短轴与 x 轴和 y 轴成一线。
在这个问题中TikZ:通过两点绘制椭圆,Percusse 帮助构建了一个随机椭圆弧,我在这里使用的就是这个。所以我们不知道半长轴和短轴的排列。也许我们可以找到它的旋转,但我100%
还没有找到。
在缺乏这些信息的情况下,我的问题是如何向以 结束的路径添加法线和切线向量P2
?
杰克的答案可以调整吗,或者我们是否需要采用不同的方法,因为椭圆方向的模糊性?
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows,calc}
\begin{document}
\begin{tikzpicture}[
dot/.style = {outer sep = +0pt, inner sep = +0pt, shape = circle, draw = black, label = {#1}},
small dot/.style = {minimum size = 1pt, dot = {#1}},
big dot/.style = {minimum size = 2pt, dot = {#1}},
line join = round, line cap = round, >=triangle 45
]
\node[ fill = black, big dot = {below: \(F\)}] (F) at (0, 0) {};
\node[ fill = black, big dot = {below: \(P_1\)}] (P1) at (2, 0) {};
\node[ fill = black, big dot = {above right=.25cm:\(P_2\)}] (P2) at (-2, 2) {};
\begin{pgfinterruptboundingbox}
\begin{scope}[decoration = {markings,
mark = at position 0.5 with {\arrow{>}}
}]
\clip (2, 0) -- (-2, 0) -- (-2, 4) -- (2, 4) -- cycle;
\draw[name path global = ellp, postaction = decorate] let
\p0 = ($(P2) - (F)$),
\p1 = ($(P1) - (P2)$)
in (P2|-P1) ++ (\x1, 0) arc (0:100: \x1 and \y0);
\end{scope}
\end{pgfinterruptboundingbox}
\path[name path = aux1] (P2) circle [radius = 1bp];
\draw[name intersections = {of = ellp and aux1}, -latex] (P2) --
($(intersection-2)!.75cm!(intersection-1)$);
\end{tikzpicture}
\end{document}
答案1
您可以使用与在Tikz:曲线的单位切向量获取切向矢量:
如果您已经定义了一个非常小的圆路径aux1
,例如,围绕切线/法线点,则可以找到此圆与曲线之间的交点。两个交点之间的连接线将大致与曲线相切。要绘制法线,可以使用calc
旋转线的语法:
(P2) -- ($(P2)!0.75cm!-90:($(intersection-2)!.75cm!(intersection-1)$)$)
\documentclass[tikz, border=5mm]{standalone}
\usetikzlibrary{arrows,calc, decorations.markings, intersections}
\begin{document}
\begin{tikzpicture}[
dot/.style = {outer sep = +0pt, inner sep = +0pt, shape = circle, draw = black, label = {#1}},
small dot/.style = {minimum size = 1pt, dot = {#1}},
big dot/.style = {minimum size = 2pt, dot = {#1}},
line join = round, line cap = round, >=triangle 45
]
\node[ fill = black, big dot = {below: \(F\)}] (F) at (0, 0) {};
\node[ fill = black, big dot = {below: \(P_1\)}] (P1) at (2, 0) {};
\node[ fill = black, big dot = {above right=.25cm:\(P_2\)}] (P2) at (-2, 2) {};
\begin{pgfinterruptboundingbox}
\begin{scope}[decoration = {markings,
mark = at position 0.5 with {\arrow{>}}
}]
\clip (2, 0) -- (-2, 0) -- (-2, 4) -- (2, 4) -- cycle;
\draw[name path global = ellp, postaction = decorate] let
\p0 = ($(P2) - (F)$),
\p1 = ($(P1) - (P2)$)
in (P2|-P1) ++ (\x1, 0) arc (0:100: \x1 and \y0);
\end{scope}
\end{pgfinterruptboundingbox}
\path[name path = aux1] (P2) circle [radius = 1bp];
\draw[name intersections = {of = ellp and aux1}, -latex] (P2) --
($(intersection-2)!.75cm!(intersection-1)$);
\draw [-latex] (P2) --
($(P2)!0.75cm!-90:($(intersection-2)!.75cm!(intersection-1)$)$);
\end{tikzpicture}
\end{document}